Research Environment
Initialization
Set Dates
The start date of your QuantBook
determines the latest date of data you get from history requests. By default, the start date is the current day. To change the start date, call the SetStartDate
set_start_date
method.
qb.set_start_date(2022, 1, 1);
qb.set_start_date(2022, 1, 1)
The end date of your QuantBook
should be greater than the end date. By default, the start date is the current day. To change the end date, call the SetEndDate
set_end_date
method.
qb.set_end_date(2022, 8, 15);
qb.set_end_date(2022, 8, 15)
Add Data
You can subscribe to asset, fundamental, alternative, and custom data. The Dataset Market provides 400TB of data that you can easily import into your notebooks.
Asset Data
To subscribe to asset data, call one of the asset subscription methods like AddEquity
add_equity
or AddForex
add_forex
. Each asset class has its own method to create subscriptions. For more information about how to create subscriptions for each asset class, see the Create Subscriptions section of an asset class in the Datasets chapter.
qb.AddEquity("AAPL"); // Add Apple 1 minute bars (minute by default) qb.AddForex("EURUSD", Resolution.Second); // Add EURUSD 1 second bars
qb.add_equity("SPY") # Add Apple 1 minute bars (minute by default) qb.add_forex("EURUSD", Resolution.SECOND) # Add EURUSD 1 second bars
Alternative Data
To add alternative datasets to your notebooks, call the AddData
add_data
method. For a full example, see Alternative Data.
Custom Data
To add custom data to your notebooks, call the AddData
add_data
method. For more information about custom data, see Custom Data.
Limitations
There is no official limit to how much data you can add to your notebooks, but there are practical resource limitations. Each security subscription requires about 5MB of RAM, so larger machines let you request more data. For more information about our cloud nodes, see Research Nodes.
Set Time Zone
The notebook time zone determines which time zone the DateTime
datetime
objects are in when you make a history request based on a defined period of time. When your history request returns a DataFrame
, the timestamps in the DataFrame
are based on the data time zone. When your history request returns a TradeBars
, QuoteBars
, Ticks
, or Slice
object, the Time
time
properties of these objects are based on the notebook time zone, but the EndTime
end_time
properties of the individual TradeBar
, QuoteBar
, and Tick
objects are based on the data time zone.
The default time zone is Eastern Time (ET), which is UTC-4 in summer and UTC-5 in winter. To set a different time zone, call the SetTimeZone
set_time_zone
method. This method accepts either a string following the IANA Time Zone database convention or a NodaTime.DateTimeZone object. If you pass a string, the method converts it to a NodaTime.DateTimeZone
object. The TimeZones
class provides the following helper attributes to create NodaTime.DateTimeZone
objects:
qb.SetTimeZone("Europe/London"); qb.SetTimeZone(NodaTime.DateTimeZone.Utc); qb.SetTimeZone(TimeZones.Chicago);
qb.set_time_zone("Europe/London") qb.set_time_zone(TimeZones.CHICAGO)