/// <summary> /// genera un mensaje especifico para Dukascopy /// </summary> /// <param name="ticker"></param> /// <param name="subscriptionRequestType"></param> public static void UpdateFeedSubscription(string ticker, SubscriptionRequestType subscriptionRequestType) { int topOfBook = 1; QuickFix44.MarketDataRequest message = new QuickFix44.MarketDataRequest( new MDReqID("1"), subscriptionRequestType, new MarketDepth(topOfBook)); QuickFix44.MarketDataRequest.NoRelatedSym tickersGroup = new QuickFix44.MarketDataRequest.NoRelatedSym(); tickersGroup.set(new QuickFix.Symbol(ticker)); message.addGroup(tickersGroup); QuickFix44.MarketDataRequest.NoMDEntryTypes sidesGroup = new QuickFix44.MarketDataRequest.NoMDEntryTypes(); sidesGroup.set(new QuickFix.MDEntryType(MDEntryType.BID)); message.addGroup(sidesGroup); sidesGroup.set(new QuickFix.MDEntryType(MDEntryType.OFFER)); message.addGroup(sidesGroup); message.set(new MDUpdateType(MDUpdateType.FULL_REFRESH)); message.set(new NoRelatedSym(1)); Credential dukascopyCredential = CredentialFactory.GetCredential(Counterpart.Dukascopy); Session.sendToTarget(message, dukascopyCredential.FeedSenderCompID, dukascopyCredential.FeedTargetCompID); }
/** * Capture and process the trading session status updates, part of the login process */ public override void onMessage(QuickFix44.TradingSessionStatus status, QuickFix.SessionID session) { // send notification Console.WriteLine("TradingSessionStatus received"); sessionStatus = status; // subscribe to CollateralReports QuickFix44.CollateralInquiry collateralInq = new QuickFix44.CollateralInquiry(); collateralInq.set(new QuickFix.CollInquiryID(nextID().ToString())); collateralInq.set(subscriptionType); send(collateralInq, session); // create a MarketDataRequest to subscribe QuickFix44.MarketDataRequest dataRequest = new QuickFix44.MarketDataRequest(); dataRequest.set(new QuickFix.MDReqID(nextID().ToString())); dataRequest.set(new QuickFix.MarketDepth(1)); // top of book is only choice for retail dataRequest.set(new QuickFix.MDUpdateType(QuickFix.MDUpdateType.FULL_REFRESH)); dataRequest.set(subscriptionType); // add the type of entries desired in the refresh // bid QuickFix44.MarketDataRequest.NoMDEntryTypes entryTypes; entryTypes = new QuickFix44.MarketDataRequest.NoMDEntryTypes(); entryTypes.set(new QuickFix.MDEntryType(QuickFix.MDEntryType.BID)); dataRequest.addGroup(entryTypes); // ask entryTypes = new QuickFix44.MarketDataRequest.NoMDEntryTypes(); entryTypes.set(new QuickFix.MDEntryType(QuickFix.MDEntryType.OFFER)); dataRequest.addGroup(entryTypes); // go through the sessionStatus in order to name each instrument to subscribe to for (uint g = 1; g <= sessionStatus.getField(new QuickFix.IntField(QuickFix.NoRelatedSym.FIELD)).getValue(); g++) { QuickFix44.SecurityList.NoRelatedSym relatedSymbols = new QuickFix44.SecurityList.NoRelatedSym(); QuickFix44.SecurityList.NoRelatedSym symbolGroup = (QuickFix44.SecurityList.NoRelatedSym)sessionStatus.getGroup(g, relatedSymbols); QuickFix44.MarketDataRequest.NoRelatedSym instrument = new QuickFix44.MarketDataRequest.NoRelatedSym(); instrument.set(symbolGroup.getSymbol()); dataRequest.addGroup(instrument); } // send notification Console.WriteLine("MarketDataRequest sent"); // send message to the API send(dataRequest, sessionID_md); // fire an event that the login is complete if (this.loginComplete != null) { this.loginComplete(); } }