예제 #1
0
        /// <summary>
        /// Creates a FIX4.3 MarketDataRequest message.
        /// </summary>
        /// <param name="id"></param>
        /// <param name="security"></param>
        /// <param name="subscriptionType"></param>
        /// <param name="depth"></param>
        /// <returns></returns>
        public QuickFix.FIX43.MarketDataRequest MarketDataRequest(string id, Security security, char subscriptionType, int depth)
        {
            QuickFix.FIX43.MarketDataRequest marketDataRequest = new QuickFix.FIX43.MarketDataRequest();

            QuickFix.Fields.SenderSubID senderSubId = new QuickFix.Fields.SenderSubID(this._senderSubId);
            marketDataRequest.SetField(senderSubId);

            QuickFix.Fields.DeliverToCompID deliverToCompId = new QuickFix.Fields.DeliverToCompID(this._deliverToCompId);
            marketDataRequest.SetField(deliverToCompId);

            QuickFix.Fields.NoRelatedSym noRelatedSym = new QuickFix.Fields.NoRelatedSym(1);
            marketDataRequest.SetField(noRelatedSym);

            QuickFix.Fields.MDReqID mdReqId = new QuickFix.Fields.MDReqID(id);
            marketDataRequest.SetField(mdReqId);

            QuickFix.Fields.SubscriptionRequestType subscriptionRequestType = new QuickFix.Fields.SubscriptionRequestType(subscriptionType);
            marketDataRequest.SetField(subscriptionRequestType);

            QuickFix.Fields.MarketDepth marketDepth = new QuickFix.Fields.MarketDepth(depth);
            marketDataRequest.SetField(marketDepth);

            QuickFix.Fields.MDUpdateType mdUpdateType = new QuickFix.Fields.MDUpdateType(MarketDataUpdateType.FullRefresh);
            marketDataRequest.SetField(mdUpdateType);

            // Indicates '2' requested fields i.e. OFFER/ASK and BID
            QuickFix.Fields.NoMDEntryTypes noMdEntryType = new QuickFix.Fields.NoMDEntryTypes(2);
            marketDataRequest.SetField(noMdEntryType);

            QuickFix.Fields.Symbol  symbol  = new QuickFix.Fields.Symbol(security.Symbol);
            QuickFix.Fields.Product product = new QuickFix.Fields.Product(Product.Currency);
            QuickFix.FIX43.MarketDataRequest.NoRelatedSymGroup relatedSymbols = new QuickFix.FIX43.MarketDataRequest.NoRelatedSymGroup();
            relatedSymbols.SetField(symbol);
            relatedSymbols.SetField(product);
            marketDataRequest.AddGroup(relatedSymbols);

            QuickFix.FIX43.MarketDataRequest.NoMDEntryTypesGroup mdEntryTypes = new QuickFix.FIX43.MarketDataRequest.NoMDEntryTypesGroup();
            {
                mdEntryTypes.SetField(new QuickFix.Fields.MDEntryType(MarketDataEntryType.Bid));
                marketDataRequest.AddGroup(mdEntryTypes);
                mdEntryTypes.SetField(new QuickFix.Fields.MDEntryType(MarketDataEntryType.Offer));
                marketDataRequest.AddGroup(mdEntryTypes);
            }

            return(marketDataRequest);
        }
 public void Set(QuickFix.Fields.Product val)
 {
     this.Product = val;
 }