Пример #1
0
        private void TicksReponseHandler(TicksResponse tick)
        {
            string timestamp = tick.timeStamp.OriginalValue.ToString(this.fmtpattern);

            if (this.writer == null)
            {
                this.writer = new StreamWriter(filename + ".csv");
                writer.WriteLine("symbol,timestamp,last,last_size,total_volume,bid,ask,tick_id,basis,trade_market_center,trace_conditions");
            }
            writer.WriteLine($"{tick.symbol},{timestamp},{tick.last},{tick.lastSize},{tick.totalVolume},{tick.bid},{tick.ask},{tick.tickID},{tick.basis},{tick.tradeMarketCenter},{tick.tradeConditions}");
        }
Пример #2
0
        private void TicksReponseHandler(TicksResponse tick)
        {
            insertTicks.Parameters["symbol"].Value              = tick.symbol;
            insertTicks.Parameters["time_stamp"].Value          = tick.timeStamp.UtcValue;
            insertTicks.Parameters["last"].Value                = tick.last;
            insertTicks.Parameters["last_size"].Value           = tick.lastSize;
            insertTicks.Parameters["total_volume"].Value        = tick.totalVolume;
            insertTicks.Parameters["bid"].Value                 = tick.bid;
            insertTicks.Parameters["ask"].Value                 = tick.ask;
            insertTicks.Parameters["tick_id"].Value             = tick.tickID;
            insertTicks.Parameters["basis"].Value               = tick.basis;
            insertTicks.Parameters["trade_market_center"].Value = tick.tradeMarketCenter;
            insertTicks.Parameters["trade_conditions"].Value    = tick.tradeConditions;

            insertTicks.ExecuteNonQuery();
        }
 private void OnTicksResponse(TicksResponse response)
 {
     foreach (var tick in response.Ticks)
     {
         SendOutMessage(new ExecutionMessage
         {
             TradeId    = tick.TradeNo,
             ServerTime = tick.TradeTime.ApplyTimeZone(TimeHelper.Moscow),
             SecurityId = new SecurityId {
                 Native = tick.SecId
             },
             TradePrice    = tick.Price,
             Volume        = tick.Quantity,
             OriginSide    = tick.BuySell.FromTransaq(),
             OpenInterest  = tick.OpenInterest,
             ExecutionType = ExecutionTypes.Tick,
         });
     }
 }