/// <summary> /// Updates the models for the specified security. If the <see cref="DefaultBrokerageModel"/> is specified, /// then no update is performed. /// </summary> /// <param name="algorithm">The algorithm instance</param> /// <param name="model">The brokerage model</param> /// <param name="security">The security to be updated</param> public static void UpdateModel(this IAlgorithm algorithm, IBrokerageModel model, Security security) { if (model.GetType() == typeof(DefaultBrokerageModel)) { // if we're using the default don't do anything return; } security.TransactionModel = model.GetTransactionModel(security); security.SettlementModel = model.GetSettlementModel(security, algorithm.AccountType); }
/// <summary> /// Sets the transaction and settlement models in the algorithm based on the selected brokerage properties. /// If the <see cref="DefaultBrokerageModel"/> is specified, then no update is performed. /// </summary> /// <param name="algorithm">The algorithm instance</param> /// <param name="model">The brokerage model</param> public static void UpdateModels(this IAlgorithm algorithm, IBrokerageModel model) { if (model.GetType() == typeof (DefaultBrokerageModel)) { // if we're using the default don't do anything return; } foreach (var security in algorithm.Securities.Values) { algorithm.UpdateModel(model, security); } }
/// <summary> /// Sets the transaction and settlement models in the algorithm based on the selected brokerage properties /// </summary> public static void UpdateModels(IAlgorithm algorithm, IBrokerageModel model) { if (model.GetType() == typeof (DefaultBrokerageModel)) { // if we're using the default don't do anything return; } foreach (var security in algorithm.Securities.Values) { security.TransactionModel = model.GetTransactionModel(security); security.SettlementModel = model.GetSettlementModel(security, algorithm.AccountType); } }
/// <summary> /// Sets the brokerage model used to resolve transaction models, settlement models, /// and brokerage specified ordering behaviors. /// </summary> /// <param name="brokerageModel">The brokerage model used to emulate the real /// brokerage</param> public void SetBrokerageModel(IBrokerageModel brokerageModel) => _baseAlgorithm.SetBrokerageModel(brokerageModel);
/// <summary> /// Initializes a new instance of the <see cref="CustomSecurityInitializer"/> class /// with the specified normalization mode /// </summary> /// <param name="brokerageModel">The brokerage model used to get fill/fee/slippage/settlement models</param> /// <param name="dataNormalizationMode">The desired data normalization mode</param> public CustomSecurityInitializer(IBrokerageModel brokerageModel, DataNormalizationMode dataNormalizationMode) : base(brokerageModel) { _dataNormalizationMode = dataNormalizationMode; }
/// <summary> /// Initializes a new instance of the <see cref="BrokerageModelSecurityInitializer"/> class /// for the specified algorithm /// </summary> /// <param name="brokerageModel">The brokerage model used to initialize the security models</param> /// <param name="securitySeeder">An <see cref="ISecuritySeeder"/> used to seed the initial price of the security</param> public BrokerageModelSecurityInitializer(IBrokerageModel brokerageModel, ISecuritySeeder securitySeeder) { _brokerageModel = brokerageModel; _securitySeeder = securitySeeder; }
/// <summary> /// Checks the current <see cref="SubscriptionDataConfig"/> and adds new necessary currency pair feeds to provide real time conversion data /// </summary> public void EnsureCurrencySubscriptionDataConfigs(SecurityChanges securityChanges, IBrokerageModel brokerageModel) { _ensureCurrencyDataFeeds = false; // remove any 'to be added' if the security has already been added _toBeAddedCurrencySubscriptionDataConfigs.RemoveWhere( config => securityChanges.AddedSecurities.Any(x => x.Symbol == config.Symbol)); var newConfigs = _cashBook.EnsureCurrencyDataFeeds( _securityManager, _subscriptionManager, brokerageModel.DefaultMarkets, securityChanges, _securityService, _defaultResolution); foreach (var config in newConfigs) { _toBeAddedCurrencySubscriptionDataConfigs.Add(config); } _pendingSubscriptionDataConfigs = _toBeAddedCurrencySubscriptionDataConfigs.Any(); }
/// <summary> /// Initializes a new instance of the <see cref="BrokerageModelSecurityInitializer"/> class /// for the specified algorithm /// </summary> /// <param name="brokerageModel">The brokerage model used to initialize the security models</param> public BrokerageModelSecurityInitializer(IBrokerageModel brokerageModel) { _brokerageModel = brokerageModel; }
public void SetBrokerageModel(IBrokerageModel brokerageModel) { Algo.SetBrokerageModel(brokerageModel); }
/// <summary> /// <see cref = "BrokerageModelPythonWrapper"/> constructor. /// Wraps the <see cref = "IBrokerageModel"/> object. /// </summary> /// <param name="brokegeModel"><see cref = "IBrokerageModel"/> object to be wrapped</param> public BrokerageModelPythonWrapper(IBrokerageModel brokegeModel) { _brokerageModel = brokegeModel; }
public BrokerageModelSecurityInitializer(IBrokerageModel brokerageModel) { _brokerageModel = brokerageModel; }