Exemple #1
1
        /**
         * 现场交易请求
         * @return
         */
        public static Message createLiveTradesRequest()
        {
            QuickFix.FIX44.MarketDataRequest liveTradesRequest = new QuickFix.FIX44.MarketDataRequest();
            QuickFix.FIX44.MarketDataRequest.NoRelatedSymGroup noRelatedSym = new QuickFix.FIX44.MarketDataRequest.NoRelatedSymGroup();

            //		noRelatedSym.Set(new Symbol("LTC/USD"));
            noRelatedSym.Set(new Symbol("LTC/CNY"));
            liveTradesRequest.AddGroup(noRelatedSym);
            liveTradesRequest.Set(new MDReqID("123"));
            liveTradesRequest.Set(new SubscriptionRequestType('1'));
            liveTradesRequest.Set(new MarketDepth(0));
            QuickFix.FIX44.MarketDataRequest.NoMDEntryTypesGroup group = new QuickFix.FIX44.MarketDataRequest.NoMDEntryTypesGroup();
            group.Set(new MDEntryType('2'));
            liveTradesRequest.AddGroup(group);
            return liveTradesRequest;
        }
Exemple #2
1
        /**
         * 24h行情请求
         * @return
         */
        public static Message create24HTickerRequest()
        {
            QuickFix.FIX44.MarketDataRequest tickerRequest = new QuickFix.FIX44.MarketDataRequest();
            QuickFix.FIX44.MarketDataRequest.NoRelatedSymGroup noRelatedSym = new QuickFix.FIX44.MarketDataRequest.NoRelatedSymGroup();

            //noRelatedSym.Set(new Symbol("BTC/CNY"));
            noRelatedSym.Set(new Symbol("BTC/CNY"));

            tickerRequest.AddGroup(noRelatedSym);

            tickerRequest.Set(new MDReqID("123"));
            tickerRequest.Set(new SubscriptionRequestType('1'));
            tickerRequest.Set(new MarketDepth(0));

            QuickFix.FIX44.MarketDataRequest.NoMDEntryTypesGroup group1 = new QuickFix.FIX44.MarketDataRequest.NoMDEntryTypesGroup();
            group1.Set(new MDEntryType('4'));
            tickerRequest.AddGroup(group1);

            QuickFix.FIX44.MarketDataRequest.NoMDEntryTypesGroup group2 = new QuickFix.FIX44.MarketDataRequest.NoMDEntryTypesGroup();
            group2.Set(new MDEntryType('5'));
            tickerRequest.AddGroup(group2);

            QuickFix.FIX44.MarketDataRequest.NoMDEntryTypesGroup group3 = new QuickFix.FIX44.MarketDataRequest.NoMDEntryTypesGroup();
            group3.Set(new MDEntryType('7'));
            tickerRequest.AddGroup(group3);

            QuickFix.FIX44.MarketDataRequest.NoMDEntryTypesGroup group4 = new QuickFix.FIX44.MarketDataRequest.NoMDEntryTypesGroup();
            group4.Set(new MDEntryType('8'));
            tickerRequest.AddGroup(group4);

            QuickFix.FIX44.MarketDataRequest.NoMDEntryTypesGroup group5 = new QuickFix.FIX44.MarketDataRequest.NoMDEntryTypesGroup();
            group5.Set(new MDEntryType('9'));
            tickerRequest.AddGroup(group5);

            QuickFix.FIX44.MarketDataRequest.NoMDEntryTypesGroup group6 = new QuickFix.FIX44.MarketDataRequest.NoMDEntryTypesGroup();
            group6.Set(new MDEntryType('B'));
            tickerRequest.AddGroup(group6);

            return tickerRequest;
        }
Exemple #3
0
        private void MarketDataRequestFullOrderbookIncremential(string[] symbol_ids)
        {
            Console.WriteLine($"Sending MarketDataRequest with {symbol_ids.Length} items.");
            QuickFix.FIX44.MarketDataRequest mdr = new QuickFix.FIX44.MarketDataRequest();
            mdr.MDReqID = new MDReqID(Guid.NewGuid().ToString());
            mdr.SubscriptionRequestType = new SubscriptionRequestType(SubscriptionRequestType.SNAPSHOT_PLUS_UPDATES);
            mdr.MarketDepth             = new MarketDepth(0);
            mdr.MDUpdateType            = new MDUpdateType(MDUpdateType.INCREMENTAL_REFRESH);

            {
                var type = new QuickFix.FIX44.MarketDataRequest.NoMDEntryTypesGroup();
                type.MDEntryType = new MDEntryType(MDEntryType.BID);
                mdr.AddGroup(type);
            }
            {
                var type = new QuickFix.FIX44.MarketDataRequest.NoMDEntryTypesGroup();
                type.MDEntryType = new MDEntryType(MDEntryType.OFFER);
                mdr.AddGroup(type);
            }

            foreach (var symbol_id in symbol_ids)
            {
                var relatedsym = new QuickFix.FIX44.MarketDataRequest.NoRelatedSymGroup();
                relatedsym.Symbol = new Symbol(symbol_id);
                mdr.AddGroup(relatedsym);
            }

            SendMessage(mdr);
        }
Exemple #4
0
        private void MarketDataRequestQuotes(string[] symbol_ids)
        {
            QuickFix.FIX44.MarketDataRequest mdr = new QuickFix.FIX44.MarketDataRequest();
            mdr.MDReqID = new MDReqID(Guid.NewGuid().ToString());
            mdr.SubscriptionRequestType = new SubscriptionRequestType(SubscriptionRequestType.SNAPSHOT_PLUS_UPDATES);
            mdr.MarketDepth             = new MarketDepth(1);
            mdr.MDUpdateType            = new MDUpdateType(MDUpdateType.FULL_REFRESH);

            {
                var type = new QuickFix.FIX44.MarketDataRequest.NoMDEntryTypesGroup();
                type.MDEntryType = new MDEntryType(MDEntryType.BID);
                mdr.AddGroup(type);
            }
            {
                var type = new QuickFix.FIX44.MarketDataRequest.NoMDEntryTypesGroup();
                type.MDEntryType = new MDEntryType(MDEntryType.OFFER);
                mdr.AddGroup(type);
            }

            foreach (var symbol_id in symbol_ids)
            {
                var relatedsym = new QuickFix.FIX44.MarketDataRequest.NoRelatedSymGroup();
                relatedsym.Symbol = new Symbol(symbol_id);
                mdr.AddGroup(relatedsym);
            }

            SendMessage(mdr);
        }
        private void QueryMarketDataRequest()
        {
            QuickFix.FIX44.MarketDataRequest result = new QuickFix.FIX44.MarketDataRequest();
            result.SetField(new MDReqID(DateTime.Now.Millisecond.ToString()));

            var noContraBrokersGroup = new QuickFix.FIX44.ExecutionReport.NoContraBrokersGroup();

            noContraBrokersGroup.Set(QueryPool());
            result.AddGroup(noContraBrokersGroup);

            QuickFix.FIX44.MarketDataRequest.NoRelatedSymGroup symGroup = new QuickFix.FIX44.MarketDataRequest.NoRelatedSymGroup();
            symGroup.SetField(QuerySymbol());
            symGroup.SetField(new MDUpdateType(MDUpdateType.INCREMENTAL_REFRESH));
            symGroup.SetField(new MarketDepth(0));
            symGroup.SetField(new SubscriptionRequestType(SubscriptionRequestType.SNAPSHOT_PLUS_UPDATES));

            QuickFix.FIX44.MarketDataRequest.NoMDEntryTypesGroup typesGroup = new QuickFix.FIX44.MarketDataRequest.NoMDEntryTypesGroup();
            typesGroup.SetField(new MDEntryType(MDEntryType.BID));
            result.AddGroup(typesGroup);

            typesGroup = new QuickFix.FIX44.MarketDataRequest.NoMDEntryTypesGroup();
            typesGroup.SetField(new MDEntryType(MDEntryType.OFFER));
            result.AddGroup(symGroup);

            Console.WriteLine(result);

            SendMessage(result, ".MD");
        }
        public Task SendMarketDataRequest(string symbol, string exchange, Action <string> progressHandler)
        {
            return(Task.Run(() =>
            {
                //Create object of Security Definition
                QuickFix.FIX44.MarketDataRequest securityDefinition = new QuickFix.FIX44.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.FIX44.MarketDataRequest.NoMDEntryTypesGroup();
                noMDEntryTypes.Set(new MDEntryType(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.FIX44.MarketDataRequest.NoRelatedSymGroup();
                relatedSymbol.Set(new Symbol(symbol));
                relatedSymbol.Set(new SecurityExchange(exchange));
                securityDefinition.AddGroup(relatedSymbol);
                Session.SendToTarget(securityDefinition, _currentSessionId);
                progressHandler("Sent MarketData Request");
            }));
        }
        public void SubscribeMarketData(string symbol, string reqID)
        {
            MDReqID mdReqID = new MDReqID(reqID);
            SubscriptionRequestType subType      = new SubscriptionRequestType(SubscriptionRequestType.SNAPSHOT_PLUS_UPDATES);
            MarketDepth             marketDepth  = new MarketDepth(1);
            MDUpdateType            mdUpdateType = new MDUpdateType(0);

            QuickFix.FIX44.MarketDataRequest.NoMDEntryTypesGroup marketDataEntryGroup = new QuickFix.FIX44.MarketDataRequest.NoMDEntryTypesGroup();
            marketDataEntryGroup.SetField(new MDEntryType(MDEntryType.BID));
            marketDataEntryGroup.SetField(new MDEntryType(MDEntryType.OFFER));

            QuickFix.FIX44.MarketDataRequest.NoRelatedSymGroup symbolGroup = new QuickFix.FIX44.MarketDataRequest.NoRelatedSymGroup();
            symbolGroup.Set(new Symbol(symbol));

            QuickFix.FIX44.MarketDataRequest message = new QuickFix.FIX44.MarketDataRequest();
            message.SetField(mdReqID);
            message.SetField(subType);
            message.SetField(marketDepth);
            message.SetField(mdUpdateType);

            message.AddGroup(marketDataEntryGroup);
            message.AddGroup(symbolGroup);

            if (m_SessionID != null)
            {
                Session.SendToTarget(message, m_SessionID);
            }
        }
Exemple #8
0
        public void RepeatingGroup_FieldOrder()
        {
            QuickFix.FIX44.MarketDataRequest msg = new QuickFix.FIX44.MarketDataRequest();
            msg.MDReqID = new MDReqID("fooMdReqID");
            msg.SubscriptionRequestType = new SubscriptionRequestType('1');
            msg.MarketDepth             = new MarketDepth(0);

            // this group is irrelevant to the test, but it's required in the message
            QuickFix.FIX44.MarketDataRequest.NoMDEntryTypesGroup entryTypesGroup = new QuickFix.FIX44.MarketDataRequest.NoMDEntryTypesGroup();
            entryTypesGroup.MDEntryType = new MDEntryType('0');
            msg.AddGroup(entryTypesGroup);
            entryTypesGroup.MDEntryType = new MDEntryType('1');
            msg.AddGroup(entryTypesGroup);

            QuickFix.FIX44.MarketDataRequest.NoRelatedSymGroup symGroup = new QuickFix.FIX44.MarketDataRequest.NoRelatedSymGroup();
            // spec order of fields is 55,65,48,22
            symGroup.Symbol           = new Symbol("FOO1");
            symGroup.SymbolSfx        = new SymbolSfx("sfx1");
            symGroup.SecurityID       = new SecurityID("secid1");
            symGroup.SecurityIDSource = new SecurityIDSource("src1");
            msg.AddGroup(symGroup);
            symGroup.Symbol           = new Symbol("FOO2");
            symGroup.SymbolSfx        = new SymbolSfx("sfx2");
            symGroup.SecurityID       = new SecurityID("secid2");
            symGroup.SecurityIDSource = new SecurityIDSource("src2");
            msg.AddGroup(symGroup);

            string msgString = msg.ToString();
            string expected  = String.Join(Message.SOH, new string[] { "146=2",
                                                                       "55=FOO1", "65=sfx1", "48=secid1", "22=src1",
                                                                       "55=FOO2", "65=sfx2", "48=secid2", "22=src2", });

            StringAssert.Contains(expected, msgString);
        }
Exemple #9
0
        public static Message CreateLiveTradesRequest()
        {
            QuickFix.FIX44.MarketDataRequest liveTradesRequest = new QuickFix.FIX44.MarketDataRequest();
            QuickFix.FIX44.MarketDataRequest.NoRelatedSymGroup noRelatedSym = new QuickFix.FIX44.MarketDataRequest.NoRelatedSymGroup();

            noRelatedSym.Set(TradeSymbol);
            liveTradesRequest.AddGroup(noRelatedSym);
            liveTradesRequest.Set(new MDReqID(GetFreeID));
            liveTradesRequest.Set(new SubscriptionRequestType(SubscriptionRequestType.SNAPSHOT_PLUS_UPDATES));
            liveTradesRequest.Set(new MDUpdateType(MDUpdateType.INCREMENTAL_REFRESH));
            liveTradesRequest.Set(new MarketDepth(0));
            QuickFix.FIX44.MarketDataRequest.NoMDEntryTypesGroup group = new QuickFix.FIX44.MarketDataRequest.NoMDEntryTypesGroup();
            group.Set(new MDEntryType(MDEntryType.TRADE));
            liveTradesRequest.AddGroup(group);
            return(liveTradesRequest);
        }
Exemple #10
0
        /**
         * 现场交易请求
         * @return
         */
        public static Message createLiveTradesRequest()
        {
            QuickFix.FIX44.MarketDataRequest liveTradesRequest = new QuickFix.FIX44.MarketDataRequest();
            QuickFix.FIX44.MarketDataRequest.NoRelatedSymGroup noRelatedSym = new QuickFix.FIX44.MarketDataRequest.NoRelatedSymGroup();

            //		noRelatedSym.Set(new Symbol("LTC/USD"));
            noRelatedSym.Set(new Symbol("LTC/CNY"));
            liveTradesRequest.AddGroup(noRelatedSym);
            liveTradesRequest.Set(new MDReqID("123"));
            liveTradesRequest.Set(new SubscriptionRequestType('1'));
            liveTradesRequest.Set(new MarketDepth(0));
            QuickFix.FIX44.MarketDataRequest.NoMDEntryTypesGroup group = new QuickFix.FIX44.MarketDataRequest.NoMDEntryTypesGroup();
            group.Set(new MDEntryType('2'));
            liveTradesRequest.AddGroup(group);
            return(liveTradesRequest);
        }
Exemple #11
0
        private QuickFix.FIX44.MarketDataRequest QueryMarketDataRequest44()
        {
            MDReqID mdReqID = new MDReqID("MARKETDATAID");
            SubscriptionRequestType subType     = new SubscriptionRequestType(SubscriptionRequestType.SNAPSHOT);
            MarketDepth             marketDepth = new MarketDepth(0);

            QuickFix.FIX44.MarketDataRequest.NoMDEntryTypesGroup marketDataEntryGroup = new QuickFix.FIX44.MarketDataRequest.NoMDEntryTypesGroup();
            marketDataEntryGroup.Set(new MDEntryType(MDEntryType.BID));

            QuickFix.FIX44.MarketDataRequest.NoRelatedSymGroup symbolGroup = new QuickFix.FIX44.MarketDataRequest.NoRelatedSymGroup();
            symbolGroup.Set(new Symbol("LNUX"));

            QuickFix.FIX44.MarketDataRequest message = new QuickFix.FIX44.MarketDataRequest(mdReqID, subType, marketDepth);
            message.AddGroup(marketDataEntryGroup);
            message.AddGroup(symbolGroup);

            return(message);
        }
Exemple #12
0
        /**
         * 24h行情请求
         * @return
         */
        public static Message create24HTickerRequest()
        {
            QuickFix.FIX44.MarketDataRequest tickerRequest = new QuickFix.FIX44.MarketDataRequest();
            QuickFix.FIX44.MarketDataRequest.NoRelatedSymGroup noRelatedSym = new QuickFix.FIX44.MarketDataRequest.NoRelatedSymGroup();

            //noRelatedSym.Set(new Symbol("BTC/CNY"));
            noRelatedSym.Set(new Symbol("BTC/CNY"));

            tickerRequest.AddGroup(noRelatedSym);

            tickerRequest.Set(new MDReqID("123"));
            tickerRequest.Set(new SubscriptionRequestType('1'));
            tickerRequest.Set(new MarketDepth(0));

            QuickFix.FIX44.MarketDataRequest.NoMDEntryTypesGroup group1 = new QuickFix.FIX44.MarketDataRequest.NoMDEntryTypesGroup();
            group1.Set(new MDEntryType('4'));
            tickerRequest.AddGroup(group1);

            QuickFix.FIX44.MarketDataRequest.NoMDEntryTypesGroup group2 = new QuickFix.FIX44.MarketDataRequest.NoMDEntryTypesGroup();
            group2.Set(new MDEntryType('5'));
            tickerRequest.AddGroup(group2);

            QuickFix.FIX44.MarketDataRequest.NoMDEntryTypesGroup group3 = new QuickFix.FIX44.MarketDataRequest.NoMDEntryTypesGroup();
            group3.Set(new MDEntryType('7'));
            tickerRequest.AddGroup(group3);

            QuickFix.FIX44.MarketDataRequest.NoMDEntryTypesGroup group4 = new QuickFix.FIX44.MarketDataRequest.NoMDEntryTypesGroup();
            group4.Set(new MDEntryType('8'));
            tickerRequest.AddGroup(group4);

            QuickFix.FIX44.MarketDataRequest.NoMDEntryTypesGroup group5 = new QuickFix.FIX44.MarketDataRequest.NoMDEntryTypesGroup();
            group5.Set(new MDEntryType('9'));
            tickerRequest.AddGroup(group5);

            QuickFix.FIX44.MarketDataRequest.NoMDEntryTypesGroup group6 = new QuickFix.FIX44.MarketDataRequest.NoMDEntryTypesGroup();
            group6.Set(new MDEntryType('B'));
            tickerRequest.AddGroup(group6);

            return(tickerRequest);
        }
Exemple #13
0
        public static Message Create24HTickerRequest()
        {
            QuickFix.FIX44.MarketDataRequest tickerRequest = new QuickFix.FIX44.MarketDataRequest();
            QuickFix.FIX44.MarketDataRequest.NoRelatedSymGroup noRelatedSym = new QuickFix.FIX44.MarketDataRequest.NoRelatedSymGroup();

            noRelatedSym.Set(TradeSymbol);

            tickerRequest.AddGroup(noRelatedSym);

            tickerRequest.Set(new MDReqID(GetFreeID));
            tickerRequest.Set(new SubscriptionRequestType('1'));
            tickerRequest.Set(new MarketDepth(0));

            QuickFix.FIX44.MarketDataRequest.NoMDEntryTypesGroup group1 = new QuickFix.FIX44.MarketDataRequest.NoMDEntryTypesGroup();
            group1.Set(new MDEntryType(MDEntryType.OPENING_PRICE));
            tickerRequest.AddGroup(group1);

            QuickFix.FIX44.MarketDataRequest.NoMDEntryTypesGroup group2 = new QuickFix.FIX44.MarketDataRequest.NoMDEntryTypesGroup();
            group2.Set(new MDEntryType(MDEntryType.CLOSING_PRICE));
            tickerRequest.AddGroup(group2);

            QuickFix.FIX44.MarketDataRequest.NoMDEntryTypesGroup group3 = new QuickFix.FIX44.MarketDataRequest.NoMDEntryTypesGroup();
            group3.Set(new MDEntryType(MDEntryType.TRADING_SESSION_HIGH_PRICE));
            tickerRequest.AddGroup(group3);

            QuickFix.FIX44.MarketDataRequest.NoMDEntryTypesGroup group4 = new QuickFix.FIX44.MarketDataRequest.NoMDEntryTypesGroup();
            group4.Set(new MDEntryType(MDEntryType.TRADING_SESSION_LOW_PRICE));
            tickerRequest.AddGroup(group4);

            QuickFix.FIX44.MarketDataRequest.NoMDEntryTypesGroup group5 = new QuickFix.FIX44.MarketDataRequest.NoMDEntryTypesGroup();
            group5.Set(new MDEntryType(MDEntryType.TRADING_SESSION_VWAP_PRICE));
            tickerRequest.AddGroup(group5);

            QuickFix.FIX44.MarketDataRequest.NoMDEntryTypesGroup group6 = new QuickFix.FIX44.MarketDataRequest.NoMDEntryTypesGroup();
            group6.Set(new MDEntryType(MDEntryType.TRADE_VOLUME));
            tickerRequest.AddGroup(group6);

            return(tickerRequest);
        }
Exemple #14
0
        public static Message CreateOrderBookRequest(int depth = 0)
        {
            QuickFix.FIX44.MarketDataRequest orderBookRequest = new QuickFix.FIX44.MarketDataRequest();
            QuickFix.FIX44.MarketDataRequest.NoRelatedSymGroup noRelatedSym = new QuickFix.FIX44.MarketDataRequest.NoRelatedSymGroup();
            noRelatedSym.Set(TradeSymbol);
            orderBookRequest.AddGroup(noRelatedSym);

            orderBookRequest.Set(new MDReqID(GetFreeID));
            orderBookRequest.Set(new SubscriptionRequestType(SubscriptionRequestType.SNAPSHOT_PLUS_UPDATES));
            orderBookRequest.Set(new MDUpdateType(MDUpdateType.INCREMENTAL_REFRESH));
            orderBookRequest.Set(new MarketDepth(depth));   // 0 means full book

            QuickFix.FIX44.MarketDataRequest.NoMDEntryTypesGroup bid = new QuickFix.FIX44.MarketDataRequest.NoMDEntryTypesGroup();
            bid.Set(new MDEntryType(MDEntryType.BID));
            orderBookRequest.AddGroup(bid);

            QuickFix.FIX44.MarketDataRequest.NoMDEntryTypesGroup offer = new QuickFix.FIX44.MarketDataRequest.NoMDEntryTypesGroup();
            offer.Set(new MDEntryType(MDEntryType.OFFER));
            orderBookRequest.AddGroup(offer);

            return(orderBookRequest);
        }
Exemple #15
0
        /**
         * 订单数据
         * @return
         */
        public static Message createOrderBookRequest()
        {
            QuickFix.FIX44.MarketDataRequest orderBookRequest = new QuickFix.FIX44.MarketDataRequest();
            QuickFix.FIX44.MarketDataRequest.NoRelatedSymGroup noRelatedSym = new QuickFix.FIX44.MarketDataRequest.NoRelatedSymGroup();
            noRelatedSym.Set(new Symbol("BTC/CNY"));
            orderBookRequest.AddGroup(noRelatedSym);

            orderBookRequest.Set(new MDReqID("123"));
            orderBookRequest.Set(new SubscriptionRequestType('1'));
            orderBookRequest.Set(new MDUpdateType(1));//0全部  。1增量
            orderBookRequest.Set(new MarketDepth(0));

            QuickFix.FIX44.MarketDataRequest.NoMDEntryTypesGroup group1 = new QuickFix.FIX44.MarketDataRequest.NoMDEntryTypesGroup();
            group1.Set(new MDEntryType('0'));
            orderBookRequest.AddGroup(group1);

            QuickFix.FIX44.MarketDataRequest.NoMDEntryTypesGroup group2 = new QuickFix.FIX44.MarketDataRequest.NoMDEntryTypesGroup();
            group2.Set(new MDEntryType('1'));
            orderBookRequest.AddGroup(group2);

            return(orderBookRequest);
        }
        /// <summary>
        /// Creates a FIX4.4 MarketDataRequest message.
        /// </summary>
        /// <param name="id"></param>
        /// <param name="security"></param>
        /// <param name="subscriptionType"></param>
        /// <param name="depth"></param>
        /// <returns></returns>
        public QuickFix.FIX44.MarketDataRequest MarketDataRequest(string id, Security security, char subscriptionType, int depth)
        {
            QuickFix.FIX44.MarketDataRequest marketDataRequest = new QuickFix.FIX44.MarketDataRequest();

            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);

            QuickFix.Fields.NoMDEntryTypes noMdEntryType = new QuickFix.Fields.NoMDEntryTypes(2);
            marketDataRequest.SetField(noMdEntryType);

            QuickFix.Fields.Symbol symbol = new QuickFix.Fields.Symbol(security.Symbol);
            QuickFix.FIX44.MarketDataRequest.NoRelatedSymGroup relatedSymbols = new QuickFix.FIX44.MarketDataRequest.NoRelatedSymGroup();
            relatedSymbols.SetField(symbol);
            marketDataRequest.AddGroup(relatedSymbols);

            QuickFix.FIX44.MarketDataRequest.NoMDEntryTypesGroup mdEntryTypes = new QuickFix.FIX44.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);
        }
Exemple #17
0
        private QuickFix.FIX44.MarketDataRequest QueryMarketDataRequest44()
        {
            MDReqID mdReqID = new MDReqID("MARKETDATAID");
            SubscriptionRequestType subType = new SubscriptionRequestType(SubscriptionRequestType.SNAPSHOT);
            MarketDepth marketDepth = new MarketDepth(0);

            QuickFix.FIX44.MarketDataRequest.NoMDEntryTypesGroup marketDataEntryGroup = new QuickFix.FIX44.MarketDataRequest.NoMDEntryTypesGroup();
            marketDataEntryGroup.Set(new MDEntryType(MDEntryType.BID));

            QuickFix.FIX44.MarketDataRequest.NoRelatedSymGroup symbolGroup = new QuickFix.FIX44.MarketDataRequest.NoRelatedSymGroup();
            symbolGroup.Set(new Symbol("LNUX"));

            QuickFix.FIX44.MarketDataRequest message = new QuickFix.FIX44.MarketDataRequest(mdReqID, subType, marketDepth);
            message.AddGroup(marketDataEntryGroup);
            message.AddGroup(symbolGroup);

            return message;
        }
Exemple #18
0
        public void RepeatingGroup_DelimiterFieldFirst()
        {
            QuickFix.FIX44.MarketDataRequest msg = new QuickFix.FIX44.MarketDataRequest();
            msg.MDReqID = new MDReqID("fooMdReqID");
            msg.SubscriptionRequestType = new SubscriptionRequestType('1');
            msg.MarketDepth = new MarketDepth(0);

            QuickFix.FIX44.MarketDataRequest.NoMDEntryTypesGroup entryTypesGroup = new QuickFix.FIX44.MarketDataRequest.NoMDEntryTypesGroup();
            entryTypesGroup.MDEntryType = new MDEntryType('0');
            msg.AddGroup(entryTypesGroup);
            entryTypesGroup.MDEntryType = new MDEntryType('1');
            msg.AddGroup(entryTypesGroup);

            QuickFix.FIX44.MarketDataRequest.NoRelatedSymGroup symGroup = new QuickFix.FIX44.MarketDataRequest.NoRelatedSymGroup();
            symGroup.Symbol = new Symbol("FOO1");
            symGroup.SecurityID = new SecurityID("secid1");
            msg.AddGroup(symGroup);
            symGroup.Symbol = new Symbol("FOO2");
            symGroup.SecurityID = new SecurityID("secid2");
            msg.AddGroup(symGroup);

            string msgString = msg.ToString();
            string expected = String.Join(Message.SOH, new string[] { "146=2", "55=FOO1", "48=secid1", "55=FOO2", "48=secid2" });

            StringAssert.Contains(expected, msgString);
        }
Exemple #19
0
        /**
          * 订单数据
          * @return
          */
        public static Message createOrderBookRequest()
        {
            QuickFix.FIX44.MarketDataRequest orderBookRequest = new QuickFix.FIX44.MarketDataRequest();
            QuickFix.FIX44.MarketDataRequest.NoRelatedSymGroup noRelatedSym = new QuickFix.FIX44.MarketDataRequest.NoRelatedSymGroup();
            noRelatedSym.Set(new Symbol("BTC/CNY"));
            orderBookRequest.AddGroup(noRelatedSym);

            orderBookRequest.Set(new MDReqID("123"));
            orderBookRequest.Set(new SubscriptionRequestType('1'));
            orderBookRequest.Set(new MDUpdateType(1));//0全部  。1增量
            orderBookRequest.Set(new MarketDepth(0));

            QuickFix.FIX44.MarketDataRequest.NoMDEntryTypesGroup group1 = new QuickFix.FIX44.MarketDataRequest.NoMDEntryTypesGroup();
            group1.Set(new MDEntryType('0'));
            orderBookRequest.AddGroup(group1);

            QuickFix.FIX44.MarketDataRequest.NoMDEntryTypesGroup group2 = new QuickFix.FIX44.MarketDataRequest.NoMDEntryTypesGroup();
            group2.Set(new MDEntryType('1'));
            orderBookRequest.AddGroup(group2);

            return orderBookRequest;
        }
Exemple #20
0
        public void RepeatingGroup_FieldOrder()
        {
            QuickFix.FIX44.MarketDataRequest msg = new QuickFix.FIX44.MarketDataRequest();
            msg.MDReqID = new MDReqID("fooMdReqID");
            msg.SubscriptionRequestType = new SubscriptionRequestType('1');
            msg.MarketDepth = new MarketDepth(0);

            // this group is irrelevant to the test, but it's required in the message
            QuickFix.FIX44.MarketDataRequest.NoMDEntryTypesGroup entryTypesGroup = new QuickFix.FIX44.MarketDataRequest.NoMDEntryTypesGroup();
            entryTypesGroup.MDEntryType = new MDEntryType('0');
            msg.AddGroup(entryTypesGroup);
            entryTypesGroup.MDEntryType = new MDEntryType('1');
            msg.AddGroup(entryTypesGroup);

            QuickFix.FIX44.MarketDataRequest.NoRelatedSymGroup symGroup = new QuickFix.FIX44.MarketDataRequest.NoRelatedSymGroup();
            // spec order of fields is 55,65,48,22
            symGroup.Symbol = new Symbol("FOO1");
            symGroup.SymbolSfx = new SymbolSfx("sfx1");
            symGroup.SecurityID = new SecurityID("secid1");
            symGroup.SecurityIDSource = new SecurityIDSource("src1");
            msg.AddGroup(symGroup);
            symGroup.Symbol = new Symbol("FOO2");
            symGroup.SymbolSfx = new SymbolSfx("sfx2");
            symGroup.SecurityID = new SecurityID("secid2");
            symGroup.SecurityIDSource = new SecurityIDSource("src2");
            msg.AddGroup(symGroup);

            string msgString = msg.ToString();
            string expected = String.Join(Message.SOH, new string[] { "146=2",
                "55=FOO1", "65=sfx1", "48=secid1", "22=src1",
                "55=FOO2", "65=sfx2", "48=secid2", "22=src2",
            });

            StringAssert.Contains(expected, msgString);
        }