Beispiel #1
0
        public Mantle.Fix44.MarketDataRequest MarketDataRequest(string symbol, MarketDataType type)
        {
            var res = new Mantle.Fix44.MarketDataRequest();

            res = new Mantle.Fix44.MarketDataRequest()
            {
                StandardHeader = StandardHeader()
            };
            var instrument = new Mantle.Fix44.Instrument();

            instrument.Symbol.Value = symbol;
            res.RelatedSym.Add(instrument);
            // It's important for huobi that MDReqID has symbol as its prefix. Otherwise they'll
            // silently ignore our request. This is undocumented.
            res.MDReqID.Value = symbol + Guid.NewGuid().ToString();
            // '0' - snapshot only
            // '1' - snapshot followed by incremental refresh
            res.SubscriptionRequestType.Value = '1';
            if (_cfg.Extensions == Extensions.OkCoin && type == MarketDataType.Order)
            {
                // OkCoin sends incremental refresh for the first 20 rows only, which isn't enough for us.
                // We have to periodically request the full snapshot instead.
                res.SubscriptionRequestType.Value = '0';
            }
            res.MarketDepth.Value  = 0;
            res.MDUpdateType.Value = 1;
            switch (type)
            {
            case MarketDataType.Order:
                // Bids.
                res.MDEntryTypes.Add(new Mantle.Fix44.MDEntryType()
                {
                    Value = '0'
                });
                // Asks.
                res.MDEntryTypes.Add(new Mantle.Fix44.MDEntryType()
                {
                    Value = '1'
                });
                break;

            case MarketDataType.Trade:
                // Live trades.
                res.MDEntryTypes.Add(new Mantle.Fix44.MDEntryType()
                {
                    Value = '2'
                });
                break;
            }
            return(res);
        }
Beispiel #2
0
 public Mantle.Fix44.MarketDataRequest MarketDataRequest(string symbol, MarketDataType type)
 {
     var res = new Mantle.Fix44.MarketDataRequest();
     res = new Mantle.Fix44.MarketDataRequest() { StandardHeader = StandardHeader() };
     var instrument = new Mantle.Fix44.Instrument();
     instrument.Symbol.Value = symbol;
     res.RelatedSym.Add(instrument);
     // It's important for huobi that MDReqID has symbol as its prefix. Otherwise they'll
     // silently ignore our request. This is undocumented.
     res.MDReqID.Value = symbol + Guid.NewGuid().ToString();
     // '0' - snapshot only
     // '1' - snapshot followed by incremental refresh
     res.SubscriptionRequestType.Value = '1';
     if (_cfg.Extensions == Extensions.OkCoin && type == MarketDataType.Order)
     {
         // OkCoin sends incremental refresh for the first 20 rows only, which isn't enough for us.
         // We have to periodically request the full snapshot instead.
         res.SubscriptionRequestType.Value = '0';
     }
     res.MarketDepth.Value = 0;
     res.MDUpdateType.Value = 1;
     switch (type)
     {
         case MarketDataType.Order:
             // Bids.
             res.MDEntryTypes.Add(new Mantle.Fix44.MDEntryType() { Value = '0' });
             // Asks.
             res.MDEntryTypes.Add(new Mantle.Fix44.MDEntryType() { Value = '1' });
             break;
         case MarketDataType.Trade:
             // Live trades.
             res.MDEntryTypes.Add(new Mantle.Fix44.MDEntryType() { Value = '2' });
             break;
     }
     return res;
 }