Beispiel #1
0
            private void AddCommon(InstrumentDayOpenCloseHistory model)
            {
                Dictionary <DateTime, InstrumentDayOpenCloseHistory> historys;

                if (!_perInstrumentDict.TryGetValue(model.InstrumentID, out historys))
                {
                    historys = new Dictionary <DateTime, InstrumentDayOpenCloseHistory>();
                    _perInstrumentDict.Add(model.InstrumentID, historys);
                }
                if (!historys.ContainsKey(model.TradeDay))
                {
                    historys.Add(model.TradeDay, model);
                }
            }
Beispiel #2
0
 internal void Add(Guid id, DateTime tradeDay, DateTime?dayOpenTime, DateTime?dayCloseTime, DateTime?valueDate, DateTime?realValueDate)
 {
     lock (_mutex)
     {
         var model = new InstrumentDayOpenCloseHistory()
         {
             InstrumentID  = id,
             TradeDay      = tradeDay,
             DayOpenTime   = dayOpenTime,
             DayCloseTime  = dayCloseTime,
             ValueDate     = valueDate,
             RealValueDate = realValueDate
         };
         this.AddCommon(model);
     }
 }
 internal override bool ShouldAddInstrumentDayOpenCloseHistory(InstrumentDayOpenCloseHistory item, DateTime tradeDay)
 {
     return(item.RealValueDate == null || item.RealValueDate.Value > tradeDay);
 }
 internal abstract bool ShouldAddInstrumentDayOpenCloseHistory(InstrumentDayOpenCloseHistory item, DateTime tradeDay);
 protected virtual bool ShouldAddOrderDayHistoryToPL(Order order, OrderDayHistory orderDayHistory, InstrumentDayOpenCloseHistory instrumentDayOpenCloseHistory, DateTime tradeDay)
 {
     return(order.Id == orderDayHistory.OrderID && orderDayHistory.TradeDay == instrumentDayOpenCloseHistory.TradeDay && orderDayHistory.LotBalance > 0);
 }
 protected override bool ShouldAddOrderDayHistoryToPL(Order order, OrderDayHistory orderDayHistory, InstrumentDayOpenCloseHistory instrumentDayOpenCloseHistory, DateTime tradeDay)
 {
     return(base.ShouldAddOrderDayHistoryToPL(order, orderDayHistory, instrumentDayOpenCloseHistory, tradeDay) && orderDayHistory.TradeDay < tradeDay);
 }