コード例 #1
0
        public override void Initialize()
        {
            SetStartDate(2013, 10, 07);
            SetEndDate(2013, 10, 11);

            // even though we're using a framework algorithm, we can still add our securities
            // using the AddEquity/Forex/Crypto/ect methods and then pass them into a manual
            // universe selection model using Securities.Keys
            AddEquity("SPY");
            AddEquity("IBM");
            AddEquity("BAC");
            AddEquity("AIG");

            // define a manual universe of all the securities we manually registered
            UniverseSelection = new ManualUniverseSelectionModel(Securities.Keys);

            // define alpha model as a composite of the rsi and ema cross models
            Alpha = new CompositeAlphaModel(
                new RsiAlphaModel(),
                new EmaCrossAlphaModel()
                );

            // default models for the rest
            PortfolioConstruction = new EqualWeightingPortfolioConstructionModel();
            Execution             = new ImmediateExecutionModel();
            RiskManagement        = new NullRiskManagementModel();
        }
コード例 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="QCAlgorithmFramework"/> class
        /// </summary>
        public QCAlgorithmFramework()
        {
            _securityValuesProvider = new AlgorithmSecurityValuesProvider(this);

            // set model defaults
            Execution      = new ImmediateExecutionModel();
            RiskManagement = new NullRiskManagementModel();
        }
コード例 #3
0
        public override void Initialize()
        {
            SetStartDate(2013, 10, 07);
            SetEndDate(2013, 10, 11);

            var bac = AddEquity("BAC");
            var aig = AddEquity("AIG");

            UniverseSelection     = new ManualUniverseSelectionModel(Securities.Keys);
            Alpha                 = new PairsTradingAlphaModel(bac.Symbol, aig.Symbol);
            PortfolioConstruction = new EqualWeightingPortfolioConstructionModel();
            Execution             = new ImmediateExecutionModel();
            RiskManagement        = new NullRiskManagementModel();
        }
コード例 #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="QCAlgorithmFramework"/> class
        /// </summary>
        public QCAlgorithmFramework()
        {
            _securityValuesProvider = new AlgorithmSecurityValuesProvider(this);

            // set model defaults
            Execution      = new ImmediateExecutionModel();
            RiskManagement = new NullRiskManagementModel();

            // set generated and close times on all insights
            InsightsGenerated += (algorithm, data) =>
            {
                foreach (var insight in data.Insights)
                {
                    SetGeneratedAndClosedTimes(insight);
                }
            };
        }
コード例 #5
0
        /// <summary>
        /// Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.
        /// </summary>
        public override void Initialize()
        {
            // Set requested data resolution
            UniverseSettings.Resolution = Resolution.Minute;

            SetStartDate(2013, 10, 07);  //Set Start Date
            SetEndDate(2013, 10, 11);    //Set End Date
            SetCash(100000);             //Set Strategy Cash

            // Find more symbols here: http://quantconnect.com/data
            // Forex, CFD, Equities Resolutions: Tick, Second, Minute, Hour, Daily.
            // Futures Resolution: Tick, Second, Minute
            // Options Resolution: Minute Only.

            // set algorithm framework models
            PortfolioSelection = new ManualPortfolioSelectionModel(QuantConnect.Symbol.Create("SPY", SecurityType.Equity, Market.USA));
            Alpha = new ConstantAlphaModel(InsightType.Price, InsightDirection.Up, TimeSpan.FromMinutes(20), 0.025, null);
            PortfolioConstruction = new EqualWeightingPortfolioConstructionModel();
            Execution             = new ImmediateExecutionModel();
            RiskManagement        = new Algorithm.Framework.Risk.NullRiskManagementModel();
        }
コード例 #6
0
        /// <summary>
        /// Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.
        /// </summary>
        public override void Initialize()
        {
            // Set requested data resolution
            UniverseSettings.Resolution = Resolution.Minute;

            SetStartDate(2016, 10, 7);  //Set Start Date
            SetEndDate(2016, 10, 7);    //Set End Date
            SetCash(100000);            //Set Strategy Cash

            // Find more symbols here: http://quantconnect.com/data
            // Forex, CFD, Equities Resolutions: Tick, Second, Minute, Hour, Daily.
            // Futures Resolution: Tick, Second, Minute
            // Options Resolution: Minute Only.

            SetBrokerageModel(BrokerageName.GDAX, AccountType.Cash);

            // set algorithm framework models
            PortfolioSelection = new ManualPortfolioSelectionModel(QuantConnect.Symbol.Create("BTCUSD", SecurityType.Crypto, Market.GDAX));
            Alpha = new ConstantAlphaModel(AlphaType.Price, AlphaDirection.Up, TimeSpan.FromMinutes(20), 0.025, null);
            PortfolioConstruction = new SimplePortfolioConstructionModel();
            Execution             = new ImmediateExecutionModel();
            RiskManagement        = new Algorithm.Framework.Risk.NullRiskManagementModel();
        }
コード例 #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="QCAlgorithmFramework"/> class
 /// </summary>
 public QCAlgorithmFramework()
 {
     // set model defaults
     Execution      = new ImmediateExecutionModel();
     RiskManagement = new NullRiskManagementModel();
 }