Example #1
0
 /// <summary>
 /// Temporary convenience constructor
 /// </summary>
 protected Security(SubscriptionDataConfig config,
                    Cash quoteCurrency,
                    SymbolProperties symbolProperties,
                    SecurityExchange exchange,
                    SecurityCache cache,
                    ISecurityPortfolioModel portfolioModel,
                    IFillModel fillModel,
                    IFeeModel feeModel,
                    ISlippageModel slippageModel,
                    ISettlementModel settlementModel,
                    IVolatilityModel volatilityModel,
                    IBuyingPowerModel buyingPowerModel,
                    ISecurityDataFilter dataFilter,
                    IPriceVariationModel priceVariationModel
                    )
     : this(config.Symbol,
            quoteCurrency,
            symbolProperties,
            exchange,
            cache,
            portfolioModel,
            fillModel,
            feeModel,
            slippageModel,
            settlementModel,
            volatilityModel,
            buyingPowerModel,
            dataFilter,
            priceVariationModel
            )
 {
     SubscriptionsBag.Add(config);
     UpdateSubscriptionProperties();
 }
Example #2
0
 /// <summary>
 /// Temporary convenience constructor
 /// </summary>
 protected Security(SubscriptionDataConfig config,
                    Cash quoteCurrency,
                    SymbolProperties symbolProperties,
                    SecurityExchange exchange,
                    SecurityCache cache,
                    ISecurityPortfolioModel portfolioModel,
                    IFillModel fillModel,
                    IFeeModel feeModel,
                    ISlippageModel slippageModel,
                    ISettlementModel settlementModel,
                    IVolatilityModel volatilityModel,
                    ISecurityMarginModel marginModel,
                    ISecurityDataFilter dataFilter
                    )
     : this(config.Symbol,
            quoteCurrency,
            symbolProperties,
            exchange,
            cache,
            portfolioModel,
            fillModel,
            feeModel,
            slippageModel,
            settlementModel,
            volatilityModel,
            marginModel,
            dataFilter
            )
 {
     SubscriptionsBag.Add(config);
 }
Example #3
0
        /// <summary>
        /// Construct a new security vehicle based on the user options.
        /// </summary>
        protected Security(Symbol symbol,
                           Cash quoteCurrency,
                           SymbolProperties symbolProperties,
                           SecurityExchange exchange,
                           SecurityCache cache,
                           ISecurityPortfolioModel portfolioModel,
                           IFillModel fillModel,
                           IFeeModel feeModel,
                           ISlippageModel slippageModel,
                           ISettlementModel settlementModel,
                           IVolatilityModel volatilityModel,
                           IBuyingPowerModel buyingPowerModel,
                           ISecurityDataFilter dataFilter,
                           IPriceVariationModel priceVariationModel,
                           ICurrencyConverter currencyConverter,
                           IRegisteredSecurityDataTypesProvider registeredTypesProvider
                           )
        {
            if (symbolProperties == null)
            {
                throw new ArgumentNullException(nameof(symbolProperties), "Security requires a valid SymbolProperties instance.");
            }

            if (symbolProperties.QuoteCurrency != quoteCurrency.Symbol)
            {
                throw new ArgumentException("symbolProperties.QuoteCurrency must match the quoteCurrency.Symbol");
            }

            this._currencyConverter = currencyConverter;

            Symbol              = symbol;
            SubscriptionsBag    = new ConcurrentBag <SubscriptionDataConfig>();
            QuoteCurrency       = quoteCurrency;
            SymbolProperties    = symbolProperties;
            IsTradable          = true;
            Cache               = cache;
            Exchange            = exchange;
            DataFilter          = dataFilter;
            PriceVariationModel = priceVariationModel;
            PortfolioModel      = portfolioModel;
            BuyingPowerModel    = buyingPowerModel;
            FillModel           = fillModel;
            FeeModel            = feeModel;
            SlippageModel       = slippageModel;
            SettlementModel     = settlementModel;
            VolatilityModel     = volatilityModel;
            Holdings            = new SecurityHolding(this, currencyConverter);
            Data              = new DynamicSecurityData(registeredTypesProvider);
            Cache.DataStored += (sender, args) => Data.StoreData(args.DataType, args.Data);

            UpdateSubscriptionProperties();
        }
Example #4
0
        /// <summary>
        /// Construct a new security vehicle based on the user options.
        /// </summary>
        protected Security(Symbol symbol,
                           Cash quoteCurrency,
                           SymbolProperties symbolProperties,
                           SecurityExchange exchange,
                           SecurityCache cache,
                           ISecurityPortfolioModel portfolioModel,
                           IFillModel fillModel,
                           IFeeModel feeModel,
                           ISlippageModel slippageModel,
                           ISettlementModel settlementModel,
                           IVolatilityModel volatilityModel,
                           IBuyingPowerModel buyingPowerModel,
                           ISecurityDataFilter dataFilter,
                           IPriceVariationModel priceVariationModel
                           )
        {
            if (symbolProperties == null)
            {
                throw new ArgumentNullException("symbolProperties", "Security requires a valid SymbolProperties instance.");
            }

            if (symbolProperties.QuoteCurrency != quoteCurrency.Symbol)
            {
                throw new ArgumentException("symbolProperties.QuoteCurrency must match the quoteCurrency.Symbol");
            }

            Symbol              = symbol;
            SubscriptionsBag    = new ConcurrentBag <SubscriptionDataConfig>();
            QuoteCurrency       = quoteCurrency;
            SymbolProperties    = symbolProperties;
            IsTradable          = true;
            Cache               = cache;
            Exchange            = exchange;
            DataFilter          = dataFilter;
            PriceVariationModel = priceVariationModel;
            PortfolioModel      = portfolioModel;
            BuyingPowerModel    = buyingPowerModel;
            FillModel           = fillModel;
            FeeModel            = feeModel;
            SlippageModel       = slippageModel;
            SettlementModel     = settlementModel;
            VolatilityModel     = volatilityModel;
            Holdings            = new SecurityHolding(this);

            UpdateSubscriptionProperties();
        }
Example #5
0
 /// <summary>
 /// Creates instance of the Option class.
 /// </summary>
 /// <remarks>
 /// Allows for the forwarding of the security configuration to the
 /// base Security constructor
 /// </remarks>
 protected Option(Symbol symbol,
                  Cash quoteCurrency,
                  SymbolProperties symbolProperties,
                  SecurityExchange exchange,
                  SecurityCache cache,
                  ISecurityPortfolioModel portfolioModel,
                  IFillModel fillModel,
                  IFeeModel feeModel,
                  ISlippageModel slippageModel,
                  ISettlementModel settlementModel,
                  IVolatilityModel volatilityModel,
                  IBuyingPowerModel buyingPowerModel,
                  ISecurityDataFilter dataFilter,
                  IPriceVariationModel priceVariationModel,
                  ICurrencyConverter currencyConverter,
                  IRegisteredSecurityDataTypesProvider registeredTypesProvider,
                  Security underlying
                  ) : base(
         symbol,
         quoteCurrency,
         symbolProperties,
         exchange,
         cache,
         portfolioModel,
         fillModel,
         feeModel,
         slippageModel,
         settlementModel,
         volatilityModel,
         buyingPowerModel,
         dataFilter,
         priceVariationModel,
         currencyConverter,
         registeredTypesProvider
         )
 {
     ExerciseSettlement = SettlementType.PhysicalDelivery;
     SetDataNormalizationMode(DataNormalizationMode.Raw);
     OptionExerciseModel = new DefaultExerciseModel();
     PriceModel          = new CurrentPriceOptionPriceModel();
     Holdings            = new OptionHolding(this, currencyConverter);
     _symbolProperties   = (OptionSymbolProperties)symbolProperties;
     SetFilter(-1, 1, TimeSpan.Zero, TimeSpan.FromDays(35));
     Underlying = underlying;
 }
Example #6
0
        /// <summary>
        /// Construct a new security vehicle based on the user options.
        /// </summary>
        protected Security(SubscriptionDataConfig config,
                           Cash quoteCurrency,
                           SymbolProperties symbolProperties,
                           SecurityExchange exchange,
                           SecurityCache cache,
                           ISecurityPortfolioModel portfolioModel,
                           IFillModel fillModel,
                           IFeeModel feeModel,
                           ISlippageModel slippageModel,
                           ISettlementModel settlementModel,
                           IVolatilityModel volatilityModel,
                           ISecurityMarginModel marginModel,
                           ISecurityDataFilter dataFilter
                           )
        {
            if (symbolProperties == null)
            {
                throw new ArgumentNullException("symbolProperties", "Security requires a valid SymbolProperties instance.");
            }

            if (symbolProperties.QuoteCurrency != quoteCurrency.Symbol)
            {
                throw new ArgumentException("symbolProperties.QuoteCurrency must match the quoteCurrency.Symbol");
            }

            _config          = config;
            QuoteCurrency    = quoteCurrency;
            SymbolProperties = symbolProperties;
            IsTradable       = !config.IsInternalFeed;
            Cache            = cache;
            Exchange         = exchange;
            DataFilter       = dataFilter;
            PortfolioModel   = portfolioModel;
            MarginModel      = marginModel;
            FillModel        = fillModel;
            FeeModel         = feeModel;
            SlippageModel    = slippageModel;
            SettlementModel  = settlementModel;
            VolatilityModel  = volatilityModel;
            Holdings         = new SecurityHolding(this);
        }
Example #7
0
 /// <summary>
 /// Sets the volatility model
 /// </summary>
 /// <param name="volatilityModel">Model that represents a volatility model</param>
 public void SetVolatilityModel(IVolatilityModel volatilityModel)
 {
     VolatilityModel = volatilityModel;
 }
Example #8
0
 /// <summary>
 /// Temporary convenience constructor
 /// </summary>
 protected Security(SubscriptionDataConfig config,
     Cash quoteCurrency,
     SymbolProperties symbolProperties,
     SecurityExchange exchange,
     SecurityCache cache,
     ISecurityPortfolioModel portfolioModel,
     IFillModel fillModel,
     IFeeModel feeModel,
     ISlippageModel slippageModel,
     ISettlementModel settlementModel,
     IVolatilityModel volatilityModel,
     ISecurityMarginModel marginModel,
     ISecurityDataFilter dataFilter
     )
     : this(config.Symbol,
         quoteCurrency,
         symbolProperties,
         exchange,
         cache,
         portfolioModel,
         fillModel,
         feeModel,
         slippageModel,
         settlementModel,
         volatilityModel,
         marginModel,
         dataFilter
         )
 {
     SubscriptionsBag.Add(config);
 }
Example #9
0
        /// <summary>
        /// Construct a new security vehicle based on the user options.
        /// </summary>
        protected Security(Symbol symbol,
            Cash quoteCurrency,
            SymbolProperties symbolProperties,
            SecurityExchange exchange,
            SecurityCache cache,
            ISecurityPortfolioModel portfolioModel,
            IFillModel fillModel,
            IFeeModel feeModel,
            ISlippageModel slippageModel,
            ISettlementModel settlementModel,
            IVolatilityModel volatilityModel,
            ISecurityMarginModel marginModel,
            ISecurityDataFilter dataFilter
            )
        {

            if (symbolProperties == null)
            {
                throw new ArgumentNullException("symbolProperties", "Security requires a valid SymbolProperties instance.");
            }

            if (symbolProperties.QuoteCurrency != quoteCurrency.Symbol)
            {
                throw new ArgumentException("symbolProperties.QuoteCurrency must match the quoteCurrency.Symbol");
            }

            _symbol = symbol;
            SubscriptionsBag = new ConcurrentBag<SubscriptionDataConfig>();
            QuoteCurrency = quoteCurrency;
            SymbolProperties = symbolProperties;
            IsTradable = true;
            Cache = cache;
            Exchange = exchange;
            DataFilter = dataFilter;
            PortfolioModel = portfolioModel;
            MarginModel = marginModel;
            FillModel = fillModel;
            FeeModel = feeModel;
            SlippageModel = slippageModel;
            SettlementModel = settlementModel;
            VolatilityModel = volatilityModel;
            Holdings = new SecurityHolding(this);
        }