Example #1
0
        /// <summary>
        /// Constructor for the forex security
        /// </summary>
        /// <param name="symbol">The security's symbol</param>
        /// <param name="exchangeHours">Defines the hours this exchange is open</param>
        /// <param name="quoteCurrency">The cash object that represent the quote currency</param>
        /// <param name="symbolProperties">The symbol properties for this security</param>
        /// <param name="currencyConverter">Currency converter used to convert <see cref="CashAmount"/>
        /// instances into units of the account currency</param>
        /// <param name="registeredTypes">Provides all data types registered in the algorithm</param>
        public Forex(Symbol symbol,
                     SecurityExchangeHours exchangeHours,
                     Cash quoteCurrency,
                     SymbolProperties symbolProperties,
                     ICurrencyConverter currencyConverter,
                     IRegisteredSecurityDataTypesProvider registeredTypes)
            : base(symbol,
                   quoteCurrency,
                   symbolProperties,
                   new ForexExchange(exchangeHours),
                   new ForexCache(),
                   new SecurityPortfolioModel(),
                   new ImmediateFillModel(),
                   new InteractiveBrokersFeeModel(),
                   new ConstantSlippageModel(0),
                   new ImmediateSettlementModel(),
                   Securities.VolatilityModel.Null,
                   new SecurityMarginModel(50m),
                   new ForexDataFilter(),
                   new SecurityPriceVariationModel(),
                   currencyConverter,
                   registeredTypes
                   )
        {
            Holdings = new ForexHolding(this, currencyConverter);

            // decompose the symbol into each currency pair
            string baseCurrencySymbol, quoteCurrencySymbol;

            DecomposeCurrencyPair(symbol.Value, out baseCurrencySymbol, out quoteCurrencySymbol);
            BaseCurrencySymbol = baseCurrencySymbol;
        }
Example #2
0
        /// <summary>
        /// Constructor for the forex security
        /// </summary>
        /// <param name="exchangeHours">Defines the hours this exchange is open</param>
        /// <param name="quoteCurrency">The cash object that represent the quote currency</param>
        /// <param name="config">The subscription configuration for this security</param>
        /// <param name="symbolProperties">The symbol properties for this security</param>
        public Forex(SecurityExchangeHours exchangeHours, Cash quoteCurrency, SubscriptionDataConfig config, SymbolProperties symbolProperties)
            : base(config,
                   quoteCurrency,
                   symbolProperties,
                   new ForexExchange(exchangeHours),
                   new ForexCache(),
                   new SecurityPortfolioModel(),
                   new ImmediateFillModel(),
                   new InteractiveBrokersFeeModel(),
                   new ConstantSlippageModel(0),
                   new ImmediateSettlementModel(),
                   Securities.VolatilityModel.Null,
                   new SecurityMarginModel(50m),
                   new ForexDataFilter(),
                   new SecurityPriceVariationModel()
                   )
        {
            Holdings = new ForexHolding(this);

            // decompose the symbol into each currency pair
            string baseCurrencySymbol, quoteCurrencySymbol;

            DecomposeCurrencyPair(config.Symbol.Value, out baseCurrencySymbol, out quoteCurrencySymbol);
            BaseCurrencySymbol = baseCurrencySymbol;
        }
Example #3
0
 /********************************************************
 * CLASS VARIABLES
 *********************************************************/
 /********************************************************
 * CONSTRUCTOR/DELEGATE DEFINITIONS
 *********************************************************/
 /// <summary>
 /// Constructor for the forex security
 /// </summary>
 public Forex(string symbol, Resolution resolution, bool fillDataForward, decimal leverage, bool extendedMarketHours, bool isDynamicallyLoadedData = false)
     : base(symbol, SecurityType.Forex, resolution, fillDataForward, leverage, extendedMarketHours, isDynamicallyLoadedData)
 {
     //Holdings for new Vehicle:
     Cache = new ForexCache();
     Holdings = new ForexHolding(symbol, this.Model);
     Exchange = new ForexExchange();
     Model = new ForexTransactionModel();
 }
Example #4
0
        /********************************************************
         * CLASS VARIABLES
         *********************************************************/


        /********************************************************
         * CONSTRUCTOR/DELEGATE DEFINITIONS
         *********************************************************/
        /// <summary>
        /// Constructor for the forex security
        /// </summary>
        public Forex(string symbol, Resolution resolution, bool fillDataForward, decimal leverage, bool extendedMarketHours, bool isDynamicallyLoadedData = false) :
            base(symbol, SecurityType.Forex, resolution, fillDataForward, leverage, extendedMarketHours, isDynamicallyLoadedData)
        {
            //Holdings for new Vehicle:
            Cache    = new ForexCache();
            Holdings = new ForexHolding(symbol, this.Model);
            Exchange = new ForexExchange();
            Model    = new ForexTransactionModel();
        }
Example #5
0
        /********************************************************
         * CLASS VARIABLES
         *********************************************************/


        /********************************************************
         * CONSTRUCTOR/DELEGATE DEFINITIONS
         *********************************************************/
        /// <summary>
        /// Constructor for the forex security
        /// </summary>
        public Forex(string symbol, SubscriptionDataConfig config, decimal leverage, bool isDynamicallyLoadedData = false)
            : base(symbol, config, leverage, isDynamicallyLoadedData)
        {
            //Holdings for new Vehicle:
            Cache    = new ForexCache();
            Holdings = new ForexHolding(symbol, leverage, this.Model);
            Exchange = new ForexExchange();
            Model    = new ForexTransactionModel();
        }
Example #6
0
        /// <summary>
        /// Constructor for the forex security
        /// </summary>
        /// <param name="quoteCurrency">The cash object that represent the quote currency</param>
        /// <param name="config">The subscription configuration for this security</param>
        /// <param name="leverage">The leverage used for this security</param>
        /// <param name="isDynamicallyLoadedData">True for custom data, false otherwise</param>
        public Forex(Cash quoteCurrency, SubscriptionDataConfig config, decimal leverage, bool isDynamicallyLoadedData = false)
            : base(config, leverage, isDynamicallyLoadedData)
        {
            QuoteCurrency = quoteCurrency;
            //Holdings for new Vehicle:
            Cache = new ForexCache();
            Exchange = new ForexExchange();
            DataFilter = new ForexDataFilter();
            TransactionModel = new ForexTransactionModel();
            PortfolioModel = new ForexPortfolioModel();
            MarginModel = new ForexMarginModel(leverage);
            Holdings = new ForexHolding(this, TransactionModel, MarginModel);

            // decompose the symbol into each currency pair
            string baseCurrencySymbol, quoteCurrencySymbol;
            DecomposeCurrencyPair(config.Symbol, out baseCurrencySymbol, out quoteCurrencySymbol);
            BaseCurrencySymbol = baseCurrencySymbol;
            QuoteCurrencySymbol = quoteCurrencySymbol;
        }
Example #7
0
        /********************************************************
         * CLASS VARIABLES
         *********************************************************/

        /********************************************************
         * CONSTRUCTOR/DELEGATE DEFINITIONS
         *********************************************************/
        /// <summary>
        /// Constructor for the forex security
        /// </summary>
        /// <param name="quoteCurrency">The cash object that represent the quote currency</param>
        /// <param name="config">The subscription configuration for this security</param>
        /// <param name="leverage">The leverage used for this security</param>
        /// <param name="isDynamicallyLoadedData">True for custom data, false otherwise</param>
        public Forex(Cash quoteCurrency, SubscriptionDataConfig config, decimal leverage, bool isDynamicallyLoadedData = false)
            : base(config, leverage, isDynamicallyLoadedData)
        {
            QuoteCurrency = quoteCurrency;
            //Holdings for new Vehicle:
            Cache            = new ForexCache();
            Exchange         = new ForexExchange();
            DataFilter       = new ForexDataFilter();
            TransactionModel = new ForexTransactionModel();
            PortfolioModel   = new ForexPortfolioModel();
            MarginModel      = new ForexMarginModel(leverage);
            Holdings         = new ForexHolding(this, TransactionModel, MarginModel);

            // decompose the symbol into each currency pair
            string baseCurrencySymbol, quoteCurrencySymbol;

            DecomposeCurrencyPair(config.Symbol, out baseCurrencySymbol, out quoteCurrencySymbol);
            BaseCurrencySymbol  = baseCurrencySymbol;
            QuoteCurrencySymbol = quoteCurrencySymbol;
        }
Example #8
0
File: Forex.cs Project: skyfyl/Lean
        /// <summary>
        /// Constructor for the forex security
        /// </summary>
        /// <param name="exchangeHours">Defines the hours this exchange is open</param>
        /// <param name="quoteCurrency">The cash object that represent the quote currency</param>
        /// <param name="config">The subscription configuration for this security</param>
        /// <param name="leverage">The leverage used for this security</param>
        public Forex(SecurityExchangeHours exchangeHours, Cash quoteCurrency, SubscriptionDataConfig config, decimal leverage)
            : base(exchangeHours, config, leverage)
        {
            QuoteCurrency = quoteCurrency;
            //Holdings for new Vehicle:
            Cache = new ForexCache();
            Exchange = new ForexExchange(exchangeHours); 
            DataFilter = new ForexDataFilter();
            TransactionModel = new ForexTransactionModel();
            PortfolioModel = new ForexPortfolioModel();
            MarginModel = new ForexMarginModel(leverage);
            SettlementModel = new ImmediateSettlementModel();
            Holdings = new ForexHolding(this);

            // decompose the symbol into each currency pair
            string baseCurrencySymbol, quoteCurrencySymbol;
            DecomposeCurrencyPair(config.Symbol.Value, out baseCurrencySymbol, out quoteCurrencySymbol);
            BaseCurrencySymbol = baseCurrencySymbol;
            QuoteCurrencySymbol = quoteCurrencySymbol;
        }
Example #9
0
        /// <summary>
        /// Constructor for the forex security
        /// </summary>
        /// <param name="exchangeHours">Defines the hours this exchange is open</param>
        /// <param name="quoteCurrency">The cash object that represent the quote currency</param>
        /// <param name="config">The subscription configuration for this security</param>
        /// <param name="leverage">The leverage used for this security</param>
        public Forex(SecurityExchangeHours exchangeHours, Cash quoteCurrency, SubscriptionDataConfig config, decimal leverage)
            : base(exchangeHours, config, leverage)
        {
            QuoteCurrency = quoteCurrency;
            //Holdings for new Vehicle:
            Cache            = new ForexCache();
            Exchange         = new ForexExchange(exchangeHours);
            DataFilter       = new ForexDataFilter();
            TransactionModel = new ForexTransactionModel();
            PortfolioModel   = new ForexPortfolioModel();
            MarginModel      = new ForexMarginModel(leverage);
            Holdings         = new ForexHolding(this);

            // decompose the symbol into each currency pair
            string baseCurrencySymbol, quoteCurrencySymbol;

            DecomposeCurrencyPair(config.Symbol.Value, out baseCurrencySymbol, out quoteCurrencySymbol);
            BaseCurrencySymbol  = baseCurrencySymbol;
            QuoteCurrencySymbol = quoteCurrencySymbol;
        }
Example #10
0
File: Forex.cs Project: neosb/Lean
        /// <summary>
        /// Constructor for the forex security
        /// </summary>
        /// <param name="exchangeHours">Defines the hours this exchange is open</param>
        /// <param name="quoteCurrency">The cash object that represent the quote currency</param>
        /// <param name="config">The subscription configuration for this security</param>
        /// <param name="symbolProperties">The symbol properties for this security</param>
        public Forex(SecurityExchangeHours exchangeHours, Cash quoteCurrency, SubscriptionDataConfig config, SymbolProperties symbolProperties)
            : base(config,
                quoteCurrency,
                symbolProperties,
                new ForexExchange(exchangeHours),
                new ForexCache(),
                new SecurityPortfolioModel(),
                new ImmediateFillModel(),
                new InteractiveBrokersFeeModel(),
                new SpreadSlippageModel(),
                new ImmediateSettlementModel(),
                new SecurityMarginModel(50m),
                new ForexDataFilter()
                )
        {
            Holdings = new ForexHolding(this);

            // decompose the symbol into each currency pair
            string baseCurrencySymbol, quoteCurrencySymbol;
            DecomposeCurrencyPair(config.Symbol.Value, out baseCurrencySymbol, out quoteCurrencySymbol);
            BaseCurrencySymbol = baseCurrencySymbol;
        }
Example #11
0
File: Forex.cs Project: cs0amc/Lean
        /// <summary>
        /// Constructor for the forex security
        /// </summary>
        /// <param name="exchangeHours">Defines the hours this exchange is open</param>
        /// <param name="quoteCurrency">The cash object that represent the quote currency</param>
        /// <param name="config">The subscription configuration for this security</param>
        public Forex(SecurityExchangeHours exchangeHours, Cash quoteCurrency, SubscriptionDataConfig config)
            : base(config,
                   new ForexExchange(exchangeHours),
                   new ForexCache(),
                   new ForexPortfolioModel(),
                   new ImmediateFillModel(),
                   new InteractiveBrokersFeeModel(),
                   new SpreadSlippageModel(),
                   new ImmediateSettlementModel(),
                   new ForexMarginModel(50m),
                   new ForexDataFilter()
                   )
        {
            QuoteCurrency = quoteCurrency;
            Holdings      = new ForexHolding(this);

            // decompose the symbol into each currency pair
            string baseCurrencySymbol, quoteCurrencySymbol;

            DecomposeCurrencyPair(config.Symbol.Value, out baseCurrencySymbol, out quoteCurrencySymbol);
            BaseCurrencySymbol  = baseCurrencySymbol;
            QuoteCurrencySymbol = quoteCurrencySymbol;
        }