Research/BasicCSharpQuantBookTemplate.ipynb
// We need to load assemblies at the start in their own cell
#load "../Initialize.csx"
#load "../QuantConnect.csx"
using QuantConnect;
using QuantConnect.Data;
using QuantConnect.Research;
using QuantConnect.Algorithm;
var qb = new QuantBook();
// Selecting asset data
var spy = qb.AddEquity("SPY");
var eur = qb.AddForex("EURUSD");
var btc = qb.AddCrypto("BTCUSD");
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.
// 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()))