Example #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);
                }
            }
Example #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);
     }
 }
Example #3
0
 internal override bool ShouldAddInstrumentDayOpenCloseHistory(InstrumentDayOpenCloseHistory item, DateTime tradeDay)
 {
     return(item.RealValueDate == null || item.RealValueDate.Value > tradeDay);
 }
Example #4
0
 internal abstract bool ShouldAddInstrumentDayOpenCloseHistory(InstrumentDayOpenCloseHistory item, DateTime tradeDay);
Example #5
0
 protected virtual bool ShouldAddOrderDayHistoryToPL(Order order, OrderDayHistory orderDayHistory, InstrumentDayOpenCloseHistory instrumentDayOpenCloseHistory, DateTime tradeDay)
 {
     return(order.Id == orderDayHistory.OrderID && orderDayHistory.TradeDay == instrumentDayOpenCloseHistory.TradeDay && orderDayHistory.LotBalance > 0);
 }
Example #6
0
 protected override bool ShouldAddOrderDayHistoryToPL(Order order, OrderDayHistory orderDayHistory, InstrumentDayOpenCloseHistory instrumentDayOpenCloseHistory, DateTime tradeDay)
 {
     return(base.ShouldAddOrderDayHistoryToPL(order, orderDayHistory, instrumentDayOpenCloseHistory, tradeDay) && orderDayHistory.TradeDay < tradeDay);
 }