I have got the following errors. Plese feel to comment how to resolve the errors.
1. The type 'QCAlgorithm' is not defined
2. No abstract or interface member was found that corresponds to this overrideoverride BasicTemplateAlgorithm.Initialize : unit -> 'a
Full name: AlgorithmTrading.BasicTemplateAlgorithm.Initialize
//
// QCU Hello World Example with F# - Basic Template
// Create a basic template to load the QC API.
//
#r @"./packages/QuantConnect.Lean.2.2.0/lib/net45/QuantConnect.Algorithm.dll"
#r @"./packages/QuantConnect.Lean.2.2.0/lib/net45/QuantConnect.Indicators.dll"
#r @"./packages/QuantConnect.Lean.2.2.0/lib/net45/QuantConnect.Common.dll"
#r @"./packages/QuantConnect.Lean.2.2.0/lib/net45/QuantConnect.Logging.dll"
#r @"./packages/QuantConnect.Lean.2.2.0/lib/net45/QuantConnect.Configuration.dll"
open QuantConnect.Data
type BasicTemplateAlgorithm() =
//Reuse all the base class of QCAlgorithm
inherit QCAlgorithm()
//Implement core methods:
override this.Initialize() =
this.SetCash(100000)
this.SetStartDate(2013, 10, 7)
this.SetEndDate(2013, 10, 11)
this.AddEquity("SPY", Resolution.Second) |> ignore
//TradeBars Data Event
member this.OnData(bar:TradeBars) =
if not this.Portfolio.Invested then
this.SetHoldings(this.Symbol("SPY"), 1)
else
()
Alexandre Catarino
I ran the code above without the lines that start with # and it completed without any exception. Please clone the project below and give it a try.
Nelson Mok
There are no exception If it ran on the quantconnect's cloud server. However, I ran the code on a standalone notebook(macbook) with vscode and it throws exception.
Alexandre Catarino
Maybe there is something wrong with your installation.
Please follow the spinup instructions for OS-X.
Also, make sure that QuantConnect.Algorithm.FSharp project is built along the others.
Nelson Mok
I did. However, I was following the setup procedure for Linux and generated two executable files QuantConnect.Lean.Launcher.exe" and QuantConnect.ToolBox.exe; respectively. Finally, it generated a file "log.txt". Is it possible to edit the trading algorithm on the brower (same as algorithm lab)?
Jared Broad
Hi Nelson; for local LEAN you should edit the algorithm in Visual Studio or your favourite IDE. There's no way to edit it locally in the local GUI environment. The executable you run is Launcher.exe. You also need to configure LEAN to load the F# algorithm DLL and make sure the Fsharp libraries are installed (and supported on your OS). FSharp doesn't build by default so make sure to reenable the FSharp project.
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Nelson Mok
Hi Jared, I installed "QuantConnect.Lean 2.2.0" with nuget (mono nuget.exe install QuantConnect.Lean -OutputDirectory packages, vsual studio code on osx) successfully. May I ask a question; 1. Where should I put my trading-algorithm? Should I put the file in a sub-directory under lean? 2. "The executable you run is Launcher.exe". What does it mean? Does it mean that my trading-algorithm file is compiled as a object file and linked into an executable output file (Launcher.exe)
Jared Broad
You should download it here: github.com/QuantConnect/Lean and build it. In your IDE you'll see a project "QuantConnect.FSharp" with a few example algorithms inside it. You'll need to download and compile the whole engine.
See the getting started guide. It takes about 30 seconds. https://www.quantconnect.com/lean/docs#topic14.html
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Nelson Mok
Thank you.
Nelson Mok
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!