コード例 #1
0
ファイル: Form1.cs プロジェクト: prid77/TickZoomPublic
        private void App_Shown(object sender, EventArgs e)
        {
            int iMaxWait = 2500; //Wait for another instance to finish unloading if there was one
            int dwStart  = Environment.TickCount;

            while (true)
            {
                Application.DoEvents();
                if (Environment.TickCount > dwStart + iMaxWait)
                {
                    break;
                }
            }
            if (mbt == null)
            {
                try
                {
                    StubReceiver receiver = new StubReceiver();
                    mbt = new MbtInterface();
                    mbt.Start(receiver);
                    SymbolInfo        symbol = Factory.Symbol.LookupSymbol("MSFT");
                    StartSymbolDetail detail = new StartSymbolDetail();
                    detail.LastTime = new TimeStamp(DateTime.Now);
                    mbt.StartSymbol(receiver, symbol, detail);
                }
                catch (Exception problem)
                {
                    log.Notice(problem.Message, problem);
                }
                timer1.Enabled = true;
            }
        }
コード例 #2
0
ファイル: MBTInterface.cs プロジェクト: prid77/TickZoomPublic
 public void StartSymbol(Receiver receiver, SymbolInfo symbol, StartSymbolDetail detail)
 {
     if (debug)
     {
         log.Debug("StartSymbol " + symbol + ", " + detail.LastTime);
     }
     receiver.OnEvent(symbol, (int)EventType.StartRealTime, null);
     instrumentReaders.AddDepth(symbol);
 }
コード例 #3
0
 public void StartSymbol(Receiver receiver, SymbolInfo symbol, StartSymbolDetail detail)
 {
     log.Info("StartSymbol( " + symbol + ")");
     if (this.receiver != receiver)
     {
         throw new ApplicationException("Invalid receiver. Only one receiver allowed for " + this.GetType().Name);
     }
     // This adds a new order handler.
     TryAddSymbol(symbol);
     OnStartSymbol(symbol);
 }
コード例 #4
0
        public void StartSymbol(Receiver receiver, SymbolInfo symbol, object eventDetail)
        {
            StartSymbolDetail detail = (StartSymbolDetail)eventDetail;

            if (!symbol.Equals(Symbol))
            {
                throw new ApplicationException("Mismatching symbol.");
            }
            if (detail.LastTime != StartTime)
            {
                throw new ApplicationException("Mismatching start time. Expected: " + StartTime + " but was " + detail.LastTime);
            }
        }
コード例 #5
0
        public void Login()
        {
            Factory.Provider.StartSockets();

            client.Agent.SendEvent(new EventItem(this, EventType.Connect));

            var startSymbol = new StartSymbolDetail(TimeStamp.MinValue);

            MSFT = Factory.Symbol.LookupSymbol("MSFT");

            client.Agent.SendEvent(new EventItem(this, MSFT, EventType.StartSymbol, startSymbol));
            //market.Agent.SendEvent(new EventItem(this, EventType.Connect));
        }
コード例 #6
0
        public void StartSymbol(Receiver receiver, SymbolInfo symbol, StartSymbolDetail detail)
        {
            if (debug)
            {
                log.Debug("StartSymbol " + symbol + ", " + detail.LastTime);
            }
//            Equity equity = new Equity(symbol.Symbol);
//			Contract contract = new Contract(symbol.Symbol,"SMART",SecurityType.Stock,"USD");
//            Contract contract = new Contract(symbol.Symbol,"GLOBEX",SecurityType.Future,"USD","201006");
            Contract      contract = SymbolToContract(symbol);
            SymbolHandler handler  = GetSymbolHandler(symbol, receiver);

//            tickerid.Add((int)symbol.BinaryIdentifier);
//            client.RequestMarketData((int)symbol.BinaryIdentifier, contract, null, false, false);
            client.RequestMarketData((int)symbol.BinaryIdentifier, contract, null, false, false);
            receiver.OnEvent(symbol, (int)EventType.StartRealTime, null);
        }