public void EvaluatesInAccountCurrency(decimal conversionRate) { var security = new Security( SecurityExchangeHours.AlwaysOpen(TimeZones.NewYork), new SubscriptionDataConfig(typeof(TradeBar), Symbols.SPY, Resolution.Minute, TimeZones.NewYork, TimeZones.NewYork, true, true, false), new Cash(Currencies.USD, 0, conversionRate), SymbolProperties.GetDefault(Currencies.USD), ErrorCurrencyConverter.Instance, RegisteredSecurityDataTypesProvider.Null, new SecurityCache() ); var price = 25; security.SetMarketPrice(new Tick { Value = price }); var benchmark = new SecurityBenchmark(security); Assert.AreEqual(price * conversionRate, benchmark.Evaluate(DateTime.Now)); }
/// <summary> /// Get the benchmark for this model /// </summary> /// <param name="securities">SecurityService to create the security with if needed</param> /// <returns>The benchmark for this brokerage</returns> public override IBenchmark GetBenchmark(SecurityManager securities) { var symbol = Symbol.Create("BTCUSD", SecurityType.Crypto, Market.Bitfinex); return(SecurityBenchmark.CreateInstance(securities, symbol)); }
/// <summary> /// Get the benchmark for this model /// </summary> /// <param name="securities">SecurityService to create the security with if needed</param> /// <returns>The benchmark for this brokerage</returns> public override IBenchmark GetBenchmark(SecurityManager securities) { var symbol = Symbol.Create("EURUSD", SecurityType.Forex, Market.FXCM); return(SecurityBenchmark.CreateInstance(securities, symbol)); }
/// <summary> /// Get the benchmark for this model /// </summary> /// <param name="securities">SecurityService to create the security with if needed</param> /// <returns>The benchmark for this brokerage</returns> public override IBenchmark GetBenchmark(SecurityManager securities) { var symbol = Symbol.Create("NIFTYBEES", SecurityType.Equity, Market.India); return(SecurityBenchmark.CreateInstance(securities, symbol)); }
/// <summary> /// Get the benchmark for this model /// </summary> /// <param name="securities">SecurityService to create the security with if needed</param> /// <returns>The benchmark for this brokerage</returns> public virtual IBenchmark GetBenchmark(SecurityManager securities) { var symbol = Symbol.Create("SPY", SecurityType.Equity, Market.USA); return(SecurityBenchmark.CreateInstance(securities, symbol)); }