Пример #1
0
        private void api_LevelOneStreaming(object sender, Axtdaactx.ITDAAPICommEvents_OnL1QuoteEvent e)
        {
            DateTime DT = new DateTime(1970, 1, 1);
            //Axtdaactx.AxTDAL1Quote quote = (Axtdaactx.AxTDAL1Quote)e.quote;

            //if (args.FunctionType != AmeritradeBrokerAPI.RequestState.AsyncType.LevelOneStreaming) return;
            Tick t = new TickImpl();

            /*  don't understand the time format provided here
             * int date = 0;
             * int ttime = 0;
             * if (int.TryParse(args.oLevelOneData[0].quotedate, out date))
             *  t.date = date;
             * if (int.TryParse(args.oLevelOneData[0].quotetime, out ttime))
             *  t.time = ttime;
             */
            t.date   = Util.ToTLDate(DateTime.Now);
            t.time   = Util.DT2FT(DateTime.Now);
            t.symbol = e.quote.Symbol;
            t.bid    = Convert.ToDecimal(e.quote.Bid);
            t.ask    = Convert.ToDecimal(e.quote.Ask);
            t.ex     = e.quote.Exchange.ToString();
            t.trade  = Convert.ToDecimal(e.quote.Last);
            t.size   = Convert.ToInt32(e.quote.LastSize) * 100;
            t.bs     = Convert.ToInt32(e.quote.BidSize);
            t.os     = Convert.ToInt32(e.quote.AskSize);
            tl.newTick(t);

            //debug(t.symbol + " " + t.ltrade + "\n");
        }
Пример #2
0
        private void api_LevelOneStreaming(object sender, Axtdaactx.ITDAAPICommEvents_OnL1QuoteEvent e)
        {
            DateTime DT = new DateTime(1970, 1, 1);
            //Axtdaactx.AxTDAL1Quote quote = (Axtdaactx.AxTDAL1Quote)e.quote;

            Tick t = new TickImpl();

            t.date   = Util.ToTLDate(DateTime.Now);
            t.time   = Util.DT2FT(DateTime.Now);
            t.symbol = e.quote.Symbol;
            t.bid    = Convert.ToDecimal(e.quote.Bid);
            t.ask    = Convert.ToDecimal(e.quote.Ask);
            t.ex     = e.quote.Exchange.ToString();
            t.trade  = Convert.ToDecimal(e.quote.Last);
            t.size   = !isidx(e.quote.Symbol) ? Convert.ToInt32(e.quote.LastSize) * 100 : -1;
            t.bs     = Convert.ToInt32(e.quote.BidSize);
            t.os     = Convert.ToInt32(e.quote.AskSize);
            tl.newTick(t);
        }