BasicCSharpQuantBookTemplate


Welcome to The QuantConnect Research Page

Refer to this page for documentation https://www.quantconnect.com/docs#Introduction-to-Jupyter

Contribute to this template file https://github.com/QuantConnect/Lean/blob/master/Research/BasicCSharpQuantBookTemplate.ipynb

QuantBook Basics

Start QuantBook

  • Load "QuantConnect.csx" with all the basic imports
  • Create a QuantBook instance

In [ ]:
#load "QuantConnect.csx"
var qb = new QuantBook();

// Selecting asset data
var spy = qb.AddEquity("SPY");
var eur = qb.AddForex("EURUSD");
var btc = qb.AddCrypto("BTCUSD");
var fxv = qb.AddData<FxcmVolume>("EURUSD_Vol", Resolution.Hour);

Historical Data Requests

We can use the QuantConnect API to make Historical Data Requests. The data will be presented as multi-index pandas.DataFrame where the first index is the Symbol.

For more information, please follow the link.


In [ ]:
// Gets historical data from the subscribed assets, the last 360 datapoints with daily resolution
var h1 = qb.History(qb.Securities.Keys, 360, Resolution.Daily);
Console.WriteLine(string.Join(",", h1.SelectMany(slice => slice.Keys).Distinct()))