private void sendFuturesMarketDataRequest(Model.OrderModel orderModel) { var mdrq = new QuickFix.FIX42.MarketDataRequest( new MDReqID(orderModel.messageId), //DateTime.Now.ToOADate().ToString()), new SubscriptionRequestType(SubscriptionRequestType.SNAPSHOT), new MarketDepth(1) ); mdrq.AggregatedBook = new AggregatedBook(AggregatedBook.ONE_BOOK_ENTRY_PER_SIDE_PER_PRICE); QuickFix.FIX42.MarketDataRequest.NoMDEntryTypesGroup entryTypeGroups = new QuickFix.FIX42.MarketDataRequest.NoMDEntryTypesGroup(); entryTypeGroups.MDEntryType = new MDEntryType(MDEntryType.BID); mdrq.AddGroup(entryTypeGroups); entryTypeGroups.MDEntryType = new MDEntryType(MDEntryType.OFFER); mdrq.AddGroup(entryTypeGroups); QuickFix.FIX42.MarketDataRequest.NoRelatedSymGroup symGroup = new QuickFix.FIX42.MarketDataRequest.NoRelatedSymGroup(); //symGroup.Symbol = new Symbol("FOO1"); //symGroup.SecurityID = new SecurityID("secid1"); symGroup.Symbol = new Symbol(orderModel.underlyingExchangeSymbol); symGroup.SecurityType = StageOrdersToTTWPFLibrary.FixEnumTranslator.ToField(orderModel.securityType); symGroup.SecurityExchange = new SecurityExchange(orderModel.underlyingExchange); symGroup.MaturityMonthYear = new MaturityMonthYear(orderModel.maturityMonthYear); mdrq.AddGroup(symGroup); //mdrq.MDUpdateType = new MDUpdateType(MDEntryType.BID); //mdrq.MDUpdateType = new MDUpdateType(MDEntryType.OFFER); //mdrq.NoRelatedSym = new NoRelatedSym(1); if (_fixConnectionSystem.InitiatorRunning && _connectionViewModel.IsPriceConnected) { Thread sendToTargetThreading = new Thread(new ParameterizedThreadStart(sendToMarketDataRequestToTarget)); sendToTargetThreading.IsBackground = true; sendToTargetThreading.Start(mdrq); //QuickFix.Session.SendToTarget(mdrq, _fixConnectionSystem.priceSession.SessionID); } }
public QuickFix.FIX42.MarketDataRequest QueryMarketDataRequest42(string productName) { MDReqID mdReqID = new MDReqID("MARKETDATAID"); SubscriptionRequestType subType = new SubscriptionRequestType(SubscriptionRequestType.SNAPSHOT_PLUS_UPDATES); MarketDepth marketDepth = new MarketDepth(1); QuickFix.FIX42.MarketDataRequest.NoMDEntryTypesGroup marketDataEntryGroup = new QuickFix.FIX42.MarketDataRequest.NoMDEntryTypesGroup(); marketDataEntryGroup.Set(new MDEntryType(MDEntryType.BID)); QuickFix.FIX42.MarketDataRequest.NoRelatedSymGroup symbolGroup = new QuickFix.FIX42.MarketDataRequest.NoRelatedSymGroup(); symbolGroup.Set(new Symbol(productName)); symbolGroup.Set(new SecurityExchange("*")); symbolGroup.Set(new SecurityType(SecurityType.COMMON_STOCK)); QuickFix.FIX42.MarketDataRequest message = new QuickFix.FIX42.MarketDataRequest(mdReqID, subType, marketDepth); message.AddGroup(marketDataEntryGroup); message.AddGroup(symbolGroup); return(message); }
private QuickFix.FIX42.MarketDataRequest QueryMarketDataRequest42() { MDReqID mdReqID = new MDReqID("MARKETDATAID"); SubscriptionRequestType subType = new SubscriptionRequestType(SubscriptionRequestType.SNAPSHOT); MarketDepth marketDepth = new MarketDepth(0); QuickFix.FIX42.MarketDataRequest.NoMDEntryTypesGroup marketDataEntryGroup = new QuickFix.FIX42.MarketDataRequest.NoMDEntryTypesGroup(); marketDataEntryGroup.Set(new MDEntryType(MDEntryType.BID)); QuickFix.FIX42.MarketDataRequest.NoRelatedSymGroup symbolGroup = new QuickFix.FIX42.MarketDataRequest.NoRelatedSymGroup(); symbolGroup.Set(new Symbol("LNUX")); QuickFix.FIX42.MarketDataRequest message = new QuickFix.FIX42.MarketDataRequest(mdReqID, subType, marketDepth); message.AddGroup(marketDataEntryGroup); message.AddGroup(symbolGroup); QueryHeader(message.Header); Console.WriteLine(message.ToString()); return(message); }
public Task SendMarketDataRequest(string symbol, string exchange, Action <string> progressHandler) { return(Task.Run(() => { //Create object of Security Definition QuickFix.FIX42.MarketDataRequest securityDefinition = new QuickFix.FIX42.MarketDataRequest { MDReqID = new MDReqID(Guid.NewGuid().ToString()), SubscriptionRequestType = new SubscriptionRequestType(SubscriptionRequestType.SNAPSHOT_PLUS_UPDATES), MarketDepth = new MarketDepth(1), MDUpdateType = new MDUpdateType(0) }; var noMDEntryTypes = new QuickFix.FIX42.MarketDataRequest.NoMDEntryTypesGroup(); var mdEntryType_bid = new MDEntryType(MDEntryType.BID); noMDEntryTypes.Set(mdEntryType_bid); securityDefinition.AddGroup(noMDEntryTypes); noMDEntryTypes.Set(new MDEntryType(MDEntryType.OFFER)); securityDefinition.AddGroup(noMDEntryTypes); noMDEntryTypes.Set(new MDEntryType(MDEntryType.TRADE)); securityDefinition.AddGroup(noMDEntryTypes); noMDEntryTypes.Set(new MDEntryType(MDEntryType.OPENING_PRICE)); securityDefinition.AddGroup(noMDEntryTypes); noMDEntryTypes.Set(new MDEntryType(MDEntryType.SETTLEMENT_PRICE)); securityDefinition.AddGroup(noMDEntryTypes); noMDEntryTypes.Set(new MDEntryType(MDEntryType.TRADING_SESSION_HIGH_PRICE)); securityDefinition.AddGroup(noMDEntryTypes); noMDEntryTypes.Set(new MDEntryType(MDEntryType.TRADING_SESSION_LOW_PRICE)); securityDefinition.AddGroup(noMDEntryTypes); noMDEntryTypes.Set(new MDEntryType(MDEntryType.TRADE_VOLUME)); securityDefinition.AddGroup(noMDEntryTypes); noMDEntryTypes.Set(new MDEntryType(MDEntryType.OPEN_INTEREST)); securityDefinition.AddGroup(noMDEntryTypes); securityDefinition.NoRelatedSym = new NoRelatedSym(1); var relatedSymbol = new QuickFix.FIX42.MarketDataRequest.NoRelatedSymGroup(); relatedSymbol.Set(new Symbol(symbol)); relatedSymbol.Set(new SecurityExchange(exchange)); securityDefinition.AddGroup(relatedSymbol); Session.SendToTarget(securityDefinition, _currentSessionId); progressHandler("Sent MarketData Request"); })); }
/// <summary> /// Request Bid and offer prices subscription for a specific contract. /// </summary> /// <param name="SecEx">Exchange</param> /// <param name="symbol">Exchange symbol for contract</param> /// <param name="secID">unique identifier supplied by the exchnage for this contract /// For eurex this is the ticker and expiration</param> public void ttMarketDataRequest(string SecEx, string symbol, string secID) { try { QuickFix.FIX42.MarketDataRequest mdr = new QuickFix.FIX42.MarketDataRequest(); mdr.Set(new QuickFix.Fields.MDReqID(string.Concat(SecEx, ":", symbol, ":", secID))); mdr.Set(new QuickFix.Fields.SubscriptionRequestType(QuickFix.Fields.SubscriptionRequestType.SNAPSHOT_PLUS_UPDATES)); mdr.Set(new QuickFix.Fields.MDUpdateType(QuickFix.Fields.MDUpdateType.FULL_REFRESH)); //required if above type is SNAPSHOT_PLUS_UPDATES mdr.Set(new QuickFix.Fields.MarketDepth(1)); mdr.Set(new QuickFix.Fields.AggregatedBook(true)); QuickFix.FIX42.MarketDataRequest.NoMDEntryTypesGroup tgroup = new QuickFix.FIX42.MarketDataRequest.NoMDEntryTypesGroup(); tgroup.Set(new QuickFix.Fields.MDEntryType(QuickFix.Fields.MDEntryType.BID)); mdr.AddGroup(tgroup); tgroup.Set(new QuickFix.Fields.MDEntryType(QuickFix.Fields.MDEntryType.OFFER)); mdr.AddGroup(tgroup); //tgroup.Set(new QuickFix.Fields.MDEntryType(QuickFix.Fields.MDEntryType.TRADE)); //mdr.addGroup(tgroup); QuickFix.FIX42.MarketDataRequest.NoRelatedSymGroup sgroup = new QuickFix.FIX42.MarketDataRequest.NoRelatedSymGroup(); sgroup.Set(new QuickFix.Fields.SecurityExchange(SecEx)); sgroup.Set(new QuickFix.Fields.Symbol(symbol)); sgroup.Set(new QuickFix.Fields.SecurityID(secID)); mdr.AddGroup(sgroup); QuickFix.Session.SendToTarget(mdr, priceSessionID); } catch (Exception ex) { log.WriteLog(ex.ToString()); } }
private QuickFix.FIX42.MarketDataRequest QueryMarketDataRequest42() { MDReqID mdReqID = new MDReqID( "MARKETDATAID" ); SubscriptionRequestType subType = new SubscriptionRequestType(SubscriptionRequestType.SNAPSHOT); MarketDepth marketDepth = new MarketDepth(0); QuickFix.FIX42.MarketDataRequest.NoMDEntryTypesGroup marketDataEntryGroup = new QuickFix.FIX42.MarketDataRequest.NoMDEntryTypesGroup(); marketDataEntryGroup.Set( new MDEntryType(MDEntryType.BID) ); QuickFix.FIX42.MarketDataRequest.NoRelatedSymGroup symbolGroup = new QuickFix.FIX42.MarketDataRequest.NoRelatedSymGroup(); symbolGroup.Set(new Symbol("LNUX")); QuickFix.FIX42.MarketDataRequest message = new QuickFix.FIX42.MarketDataRequest( mdReqID, subType, marketDepth ); message.AddGroup( marketDataEntryGroup ); message.AddGroup( symbolGroup ); QueryHeader( message.Header ); Console.WriteLine(message.ToString()); return message; }
public QuickFix.FIX42.MarketDataRequest QueryMarketDataRequest42(string productName) { MDReqID mdReqID = new MDReqID("MARKETDATAID"); SubscriptionRequestType subType = new SubscriptionRequestType(SubscriptionRequestType.SNAPSHOT_PLUS_UPDATES); MarketDepth marketDepth = new MarketDepth(1); QuickFix.FIX42.MarketDataRequest.NoMDEntryTypesGroup marketDataEntryGroup = new QuickFix.FIX42.MarketDataRequest.NoMDEntryTypesGroup(); marketDataEntryGroup.Set(new MDEntryType(MDEntryType.BID)); QuickFix.FIX42.MarketDataRequest.NoRelatedSymGroup symbolGroup = new QuickFix.FIX42.MarketDataRequest.NoRelatedSymGroup(); symbolGroup.Set(new Symbol(productName)); symbolGroup.Set(new SecurityExchange("*")); symbolGroup.Set(new SecurityType(SecurityType.COMMON_STOCK)); QuickFix.FIX42.MarketDataRequest message = new QuickFix.FIX42.MarketDataRequest(mdReqID, subType, marketDepth); message.AddGroup(marketDataEntryGroup); message.AddGroup(symbolGroup); return message; }