コード例 #1
0
        static Protocal.OrderData CreateOrderData()
        {
            var orderData = new Protocal.OrderData()
            {
                Id          = Guid.NewGuid(),
                IsOpen      = true,
                IsBuy       = true,
                SetPrice    = "0.9123",
                Lot         = 3,
                LotBalance  = 3,
                TradeOption = iExchange.Common.TradeOption.Better,
            };

            return(orderData);
        }
コード例 #2
0
 private bool IsOrderPriceOutOfDate(Account owner, Protocal.TransactionData tranData, Protocal.OrderData orderNode, SystemParameter systemParameter)
 {
     if (orderNode.PriceIsQuote != null && !orderNode.PriceIsQuote.Value)
     {
         DateTime  timestamp  = orderNode.PriceTimestamp.Value;
         var       instrument = owner.GetOrCreateInstrument(tranData.InstrumentId);
         var       submitor   = Settings.Setting.Default.GetCustomer(tranData.SubmitorId);
         Quotation quotation  = instrument.GetQuotation(submitor);
         if (quotation != null)
         {
             TimeSpan diff = (quotation.Timestamp - timestamp);
             if (diff >= systemParameter.MaxPriceDelayForSpotOrder)
             {
                 string message = string.Format("Pirce is out of date, instrument id = {0}, last price timestamp = {1}, setprice timestamp = {2}, diff = {3}{4}{5}", tranData.InstrumentId, quotation.Timestamp, timestamp, diff, Environment.NewLine, tranData.ToString());
                 Logger.Warn(message);
                 return(true);
             }
         }
     }
     return(false);
 }