Ejemplo n.º 1
0
        public static double CalculatePriceBid(SymbolInfo symbol)
        {
            FinancialCalculator financialCalculator = FdkStatic.Calculator;
            double?rateK = financialCalculator.CalculateAssetRate(1, symbol.SettlementCurrency, "USD");

            if (!rateK.HasValue)
            {
                return(double.NaN);
            }
            return(rateK.Value);
        }
Ejemplo n.º 2
0
        public static double CalculatePipsValue(SymbolInfo symbol)
        {
            FinancialCalculator financialCalculator = FdkStatic.Calculator;
            int    decimals     = symbol.Precision;
            double contractSize = symbol.ContractMultiplier;
            double?rateK        = financialCalculator.CalculateAssetRate(1, symbol.SettlementCurrency, "USD");

            if (!rateK.HasValue)
            {
                throw new InvalidOperationException(
                          string.Format("No rate for currency pair: {0}/USD", symbol.SettlementCurrency));
            }
            double formula = Math.Pow(10, -decimals) * contractSize * rateK.Value;

            return(formula);
        }