コード例 #1
0
        internal static decimal CalculateNecessary(Order order, Quotation quotation, DateTime?tradeDay)
        {
            MarginFormula marginFormula = order.Owner.SettingInstrument().MarginFormula;
            Price         price         = order.ExecutePrice;

            if (marginFormula.MarketPriceInvolved())
            {
                price = order.IsBuy ? quotation.BuyPrice : quotation.SellPrice;
            }
            return(NecessaryCalculator.CalculateNecessary(order, price, order.LotBalance, tradeDay));
        }
コード例 #2
0
        internal static decimal CalculateNecessary(Order order, Price price, decimal lot, DateTime?tradeDay)
        {
            MarginFormula marginFormula = order.Owner.SettingInstrument().MarginFormula;
            CurrencyRate  currencyRate  = order.Owner.CurrencyRate(null);
            decimal       contractSize  = order.Owner.ContractSize(tradeDay);

            if (price == null)
            {
                price = order.ExecutePrice;
                if (marginFormula.MarketPriceInvolved())
                {
                    price = order.GetLivePriceForCalculateNecessary();
                }
            }
            return(CalculateNecessary(order, marginFormula, lot, contractSize, price, currencyRate));
        }