|
From: Christoph J. <chr...@ma...> - 2020-03-31 12:38:35
|
Did you go through this? https://github.com/quickfix-j/quickfixj#sending-messages I would not advise to send messages out of the onLogon() callback. Chris. On 31.03.20 14:29, Fuad Azhar wrote: > wait this is about quickfixj... > > Successfully called onCreate for sessionId : FIX.4.2:MDValueTrade2UAT1->Fastmatch1 > Data Server IP 169.33.100.15 > Data Server Port 17543 > Login MDValueTrade2UAT1 Fastmatch1 > Logon > 8=FIX.4.29=11735=A34=149=MDValueTrade2UAT152=20200331-12:23:55.29156=Fastmatch149=MDValueTrade2UAT156=Fastmatch198=0108=3010=168 > Successfully called fromAdmin for sessionId : > 8=FIX.4.29=8235=A34=149=Fastmatch152=20200331-12:23:55.36756=MDValueTrade2UAT198=0108=3010=146 > errorquickfix.SessionNotFound: missing sender or target company ID > Successfully called fromAdmin for sessionId : > 8=FIX.4.29=7035=034=249=Fastmatch152=20200331-12:24:25.37056=MDValueTrade2UAT110=094 > Successfully called fromAdmin for sessionId : > 8=FIX.4.29=7035=034=349=Fastmatch152=20200331-12:24:55.37356=MDValueTrade2UAT110=101 > Successfully called fromAdmin for sessionId : > 8=FIX.4.29=7035=034=449=Fastmatch152=20200331-12:25:25.37656=MDValueTrade2UAT110=103 > Successfully called fromAdmin for sessionId : > 8=FIX.4.29=7035=034=549=Fastmatch152=20200331-12:25:55.38056=MDValueTrade2UAT110=102 > Successfully called fromAdmin for sessionId : > 8=FIX.4.29=7035=034=649=Fastmatch152=20200331-12:26:25.38356=MDValueTrade2UAT110=104 > Successfully called fromAdmin for sessionId : > 8=FIX.4.29=7035=034=749=Fastmatch152=20200331-12:26:55.38656=MDValueTrade2UAT110=111 > > i can logon to mybroker now. but when i want hit my broker for market data request i got error > like this errorquickfix.SessionNotFound: missing sender or target company ID > > when i logon i want to hit my broker using this code. > > public void onLogon(SessionID sessionID) { > // TODO Auto-generated method stub > TestMarketdataRequest.sessionID = sessionID; > Session s = Session.lookupSession(sessionID); > UUID uuid = UUID.randomUUID(); > String randomUUIDString = uuid.toString(); > Message message = new Message(); > quickfix.fix42.MarketDataRequest.NoMDEntryTypes group = > new quickfix.fix42.MarketDataRequest.NoMDEntryTypes(); > quickfix.fix42.MarketDataRequest.NoRelatedSym group1 = > new quickfix.fix42.MarketDataRequest.NoRelatedSym(); > MarketDataRequest marketdatarequest = new MarketDataRequest(); > Header header = marketdatarequest.getHeader(); > header.setField(new BeginString("FIX.4.2")); > header.setField(new SenderCompID("MDValueTrade2UAT1")); > header.setField(new TargetCompID("Fastmatch1")); > header.setField(new MsgType("V")); > message.setField(new MDReqID(randomUUIDString)); > message.setField(new SubscriptionRequestType((char) 1)); > message.setField(new MarketDepth(1)); > message.setField(new NoMDEntryTypes(1)); > group.setField(new MDEntryType((char) 1)); > message.addGroup(group); > group1.setField(new Symbol("ALL")); > message.addGroup(group1); > try > { > Session.sendToTarget(message); > System.out.println("message" + message); > }catch (Exception ex) > { > System.out.println("error" + ex); > } > } > > so what wrong with my code for market data request format ? > > Pada tanggal Sel, 31 Mar 2020 pukul 19.16 Christoph John <chr...@ma... > <mailto:chr...@ma...>> menulis: > > I still see no QFJ related classes in the stack trace so why do you think it is a QFJ problem? > Is it a Java problem when you try to cast something to String which cannot be cast to String? ;) > > Please make sure you read the documentation on how to create a QFJ application: > https://github.com/quickfix-j/quickfixj#basics > > Chris. > > On 31.03.20 14:08, Fuad Azhar wrote: >> sorry christoph now the problem is about quickfixj application >> >> java -jar fastmatchmarketdata-0.0.1-SNAPSHOT-jar-with-dependencies.jar initiator.config >> Application: TestMarketdataRequest >> Config File initiator.config >> FIX Port xxxxx >> FIX IP xxx.xxx.xxx.xxx >> SenderCompID MDValueTrade2UAT1 TargetCompID Fastmatch1 >> java.lang.ClassCastException: com.dxtr.fastmatch.marketdatarequestapps.TestMarketdataRequest >> cannot be cast to quickfix.Application >> at >> com.dxtr.fastmatch.marketdatarequestapps.TestMarketdataRequest.<init>(TestMarketdataRequest.java:141) >> at com.dxtr.fastmatch.FastmatchMDRequest.<init>(FastmatchMDRequest.java:14) >> at com.dxtr.fastmatch.FastmatchMDRequest.main(FastmatchMDRequest.java:19) >> >> why to this error for initiator start ? >> >> Pada tanggal Sel, 31 Mar 2020 pukul 17.12 Fuad Azhar <fua...@gm... >> <mailto:fua...@gm...>> menulis: >> >> ok sorry for that... but i have try out the banzai example for read file for input stream >> initiator config. but the code cannot read my file config. how to set proper config file >> for initiator.config for make session from quickfixj >> >> >> Pada tanggal Sel, 31 Mar 2020 pukul 16.27 Christoph John <chr...@ma... >> <mailto:chr...@ma...>> menulis: >> >> Don't get me wrong but I don't have time to debug your code. ;) >> I am pretty sure that this Exception is not thrown out of QFJ code. >> >> Cheers, >> Chris. >> >> >> On 31.03.20 08:06, Fuad Azhar wrote: >>> your solution run well but i have another error. for read config file. >>> my error is >>> Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0 >>> at com.dxtr.fastmatch.FastmatchMDRequest.<init>(FastmatchMDRequest.java:14) >>> at com.dxtr.fastmatch.FastmatchMDRequest.main(FastmatchMDRequest.java:19) >>> >>> and my config file code is here >>> >>> public TestMarketdataRequest(String configFile) { >>> try { >>> System.out.println(" Config File " + configFile); >>> Properties props = new Properties(); >>> try { >>> props.load(new FileInputStream(configFile)); >>> } catch (IOException e) { >>> e.printStackTrace(); >>> } >>> SenderCompID = props.getProperty("SenderCompID"); >>> TargetCompID = props.getProperty("TargetCompID"); >>> symbols = props.getProperty("Symbols"); >>> System.out.println(" FIX Port " + props.getProperty("SocketConnectPort")); >>> System.out.println(" FIX IP " + props.getProperty("SocketConnectHost")); >>> System.out.println(" SenderCompID " + SenderCompID + " TargetCompID " + >>> TargetCompID); >>> SessionSettings settings = new SessionSettings(configFile); >>> MessageStoreFactory messageStoreFactory = new FileStoreFactory(settings); >>> LogFactory logFactory = new FileLogFactory(settings); >>> MessageFactory messageFactory = new DefaultMessageFactory(); >>> Initiator initiator = new SocketInitiator((Application) this, >>> messageStoreFactory, settings, logFactory, messageFactory); >>> initiator.start(); >>> >>> and this is the args[0] >>> public static void main(String[] args){ >>> String configFile = args[0]; >>> new TestMarketdataRequest(configFile); >>> } >>> and my error is in this code >>> >>> public class FastmatchMDRequest { >>> >>> >>> >>> public FastmatchMDRequest(String args[]){ >>> System.out.println("Application: TestMarketdataRequest "); >>> new TestMarketdataRequest(args[0]); >>> } >>> >>> >>> public static void main(String args[]){ >>> new FastmatchMDRequest(args); >>> >>> >>> >>> >>> } >>> } >>> what is the problem from this ? i have add my config file as my resources and build >>> it in one jar. >>> >>> best regards, >>> >>> Fuad >> > > -- > Christoph John > Software Engineering > T +49 241 557080-28 > chr...@ma... <mailto:chr...@ma...> > > MACD GmbH > Oppenhoffallee 103 > 52066 Aachen, Germany > www.macd.com <http://www.macd.com> > > Amtsgericht Aachen: HRB 8151 > Ust.-Id: DE 813021663 > Geschäftsführer: George Macdonald > -- Christoph John Software Engineering T +49 241 557080-28 chr...@ma... MACD GmbH Oppenhoffallee 103 52066 Aachen, Germany www.macd.com Amtsgericht Aachen: HRB 8151 Ust.-Id: DE 813021663 Geschäftsführer: George Macdonald |