コード例 #1
0
ファイル: BrokerWrapperYF.cs プロジェクト: gyantal/SQLab
 public int ReqMktDataStream(Contract p_contract, bool p_snapshot = false, MktDataSubscription.MktDataArrivedFunc p_mktDataArrivedFunc = null)
 {
     switch (p_contract.Symbol)
     {
         case "VXX":
             return 4001;
         case "SVXY":
             return 4002;
         case "RUT":
             return 4003;
         case "UWM":
             return 4004;
         case "TWM":
             return 4005;
         default:
             return 3999;
     }
 }
コード例 #2
0
ファイル: BrokerWrapperIb.cs プロジェクト: gyantal/SQLab
        public virtual int ReqMktDataStream(Contract p_contract, bool p_snapshot = false, MktDataSubscription.MktDataArrivedFunc p_mktDataArrivedFunc = null)
        {
            int marketDataId = GetUniqueReqMktDataID;
            Utils.Logger.Debug($"ReqMktDataStream() { marketDataId} START");
            ClientSocket.reqMarketDataType(2);    // 2: streaming data (for realtime), 1: frozen (for historical prices)
            //mainClient.reqMktData(marketDataId, contractSPY, "221", false, null);
            ClientSocket.reqMktData(marketDataId, p_contract, null, p_snapshot, null);

            var mktDataSubscr = new MktDataSubscription()
            {
                Contract = p_contract,
                MarketDataId = marketDataId,
                MarketDataArrived = p_mktDataArrivedFunc
            };
            MktDataSubscriptions.TryAdd(marketDataId, mktDataSubscr);

            // RUT index data comes once ever 5 seconds
            if (!p_snapshot)    // only if it is a continous streaming
                mktDataSubscr.CheckDataIsAliveTimer = new System.Threading.Timer(new TimerCallback(MktDataIsAliveTimer_Elapsed), mktDataSubscr, TimeSpan.FromSeconds(15), TimeSpan.FromMilliseconds(-1.0));
            return marketDataId;
        }
コード例 #3
0
ファイル: BrokerWrapperTest.cs プロジェクト: gyantal/SQLab
 public int ReqMktDataStream(Contract p_contract, bool p_snapshot = false, MktDataSubscription.MktDataArrivedFunc p_mktDataArrivedFunc = null)
 {
     switch (p_contract.Symbol)
     {
         case "VXX":
             return 4001;
         default:
             return 4002;
     }
 }