QuantConnect / lean-cli

CLI for running the LEAN engine locally and in the cloud
https://www.lean.io/cli
Apache License 2.0
191 stars 100 forks source link

Add missing modules in create-project.py #395

Closed Marinovsky closed 6 months ago

Marinovsky commented 6 months ago

The modules added were the ones missing from AlgorithmImports.py. Finally, in order to test it was working as expected, the following project was created (using lean cli) and runned in the QC Cloud (see https://www.quantconnect.com/terminal/clone/-/b7f53d2e3947ccea1cd74de843d72435/clone-of%3A-fat-light-brown-fly):

namespace QuantConnect.Algorithm.CSharp
{
    public class TestProject : QCAlgorithm
    {

        public override void Initialize()
        {
            // Locally Lean installs free sample data, to download more data please visit https://www.quantconnect.com/docs/v2/lean-cli/datasets/downloading-data
            SetStartDate(2013, 10, 7); // Set Start Date
            SetEndDate(2013, 10, 11); // Set Start Date
            SetCash(100000);             //Set Strategy Cash

            var security = AddEquity("SPY", Resolution.Minute);
            var apiResult = new Api.Api();
            var pythonResult = new PythonConsolidator();
            var statisticsResult = new Statistics.Statistics();
            var engineResults = Lean.Engine.Initializer.GetSystemHandlers();
            var configurationResult = new CommandLineOption("", McMaster.Extensions.CommandLineUtils.CommandOptionType.SingleValue);
            var dataAuxiliaryResult = new ZipEntryName();
            var dataShortableResult = new NullShortableProvider();
            var ordersTimeInForcesResult = new GoodTilDateTimeInForce(Time);
            var securitiesPositionsResult = new Position(security.Symbol, 1, 1);
            var ordersOptionExerciseResult = new DefaultExerciseModel();
            var securitiesVolatilityResult = new BaseVolatilityModel();
            var dataCustomIconicTypesResult = new LinkedData();
            var securitiesCryptoFutureResult = new CryptoFutureExchange("bybit");
            var signalExportsResult = new SignalExportManager(this);
        }

        /// OnData event is the primary entry point for your algorithm. Each new data point will be pumped in here.
        /// Slice object keyed by symbol containing the stock data
        public override void OnData(Slice data)
        {
            if (!Portfolio.Invested)
            {
                SetHoldings("SPY", 1);
                Debug("Purchased Stock");
            }
        }

    }
}