Exemple #1
0
 internal void Generate(DateTime tradeDay)
 {
     try
     {
         DataSet      ds         = DBRepository.Default.GenerateTradeDay(tradeDay);
         DataRow      dr         = ds.Tables[0].Rows[0];
         TradeDayInfo newDayInfo = new TradeDayInfo(dr);
         Interlocked.Exchange(ref _tradeDayInfo, newDayInfo);
         this.LoadInstrumentDayOpenCloseHistoryRecords(ds.Tables[1]);
         this.ParseAndAddInstrumentCheckTime(ds);
         InstrumentBLL.InstrumentManager.Default.ResetDayCloseQuotationState();
     }
     catch (Exception ex)
     {
         Logger.Error(string.Format("GenerateTradeDay tradeDay = {0}", tradeDay), ex);
     }
 }
Exemple #2
0
        internal static decimal CalculateInstalmentInterest(TradeDayInfo data, PhysicalOrder physicalOrder, out decimal interestRate, out decimal remainsAmount)
        {
            decimal result = 0m;

            interestRate  = 0m;
            remainsAmount = 0m;
            if (data.Instrument.Category == InstrumentCategory.Physical)
            {
                remainsAmount = physicalOrder.PhysicalOriginValueBalance - Math.Abs(physicalOrder.PaidPledgeBalance);
                if (physicalOrder.Instalment != null)
                {
                    interestRate = CalculateInstalmentInterestRate(physicalOrder, data.Settings);
                    if (physicalOrder.InterestValueDate <= data.TradeDay)
                    {
                        result = remainsAmount * (interestRate / data.Instrument.InterestYearDays) * data.Settings.InterestMultiple;
                    }
                }
            }
            return(result);
        }