private void DoResetByClosePrice(AccountClass.Instrument instrument, DateTime tradeDay, List <TradingDailyQuotation> closeQuotations, TradeDayInfo tradeDayInfo)
        {
            var settingInstrument = Settings.Setting.Default.GetInstrument(instrument.Id, tradeDay);
            var resetItem         = instrument.GetResetItem(tradeDay);

            if (resetItem != null)
            {
                Logger.InfoFormat("DoResetByClosePrice modifyClosePrice lastResetItem instrumentId = {0}, tradeDay = {1}, resetBalance = {2}", instrument.Id, tradeDay, resetItem.ResetBalance);
                _account.AddBalance(settingInstrument.CurrencyId, -resetItem.ResetBalance, tradeDayInfo.Settings.ResetTime);
            }
            var quotation = _instrumentDayClosePriceFactory.GetQuotation(settingInstrument, closeQuotations);

            if (quotation == null)
            {
                this.PrintErrorInfo(instrument, tradeDay, closeQuotations);
            }
            this.DoResetPerTradeDay(instrument, tradeDayInfo, quotation);
        }
        private static InstrumentResetItem CreateInstrumentResetItem(DateTime tradeDay, AccountClass.Instrument instrument, Dictionary <Guid, OrderResetResult> resetResultDict, Price buyPrice, Price sellPrice)
        {
            var result = instrument.GetResetItem(tradeDay);

            if (result == null)
            {
                result = new InstrumentResetItem(tradeDay, instrument.Owner.Id, instrument.Id);
            }
            else
            {
                result.Clear();
            }
            foreach (var eachResetResult in resetResultDict.Values)
            {
                result.FloatingPL          += eachResetResult.FloatPL.Interest + eachResetResult.FloatPL.Storage + eachResetResult.TradePLFloat;
                result.Necessary           += eachResetResult.Margin;
                result.InterestPLNotValued += eachResetResult.NotValuedPL.Interest;
                result.StoragePLNotValued  += eachResetResult.NotValuedPL.Storage;
                result.TradePLNotValued    += eachResetResult.TradePLNotValued;
            }
            result.BuyPrice  = buyPrice;
            result.SellPrice = sellPrice;
            return(result);
        }