Research Environment

Initialization

Introduction

Before you request and manipulate historical data in the Research Environment, you should set the notebook dates, add data subscriptions, and set the time zone.

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 SetStartDateset_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 SetEndDateset_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 AddEquityadd_equity or AddForexadd_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 AddDataadd_data method. For a full example, see Alternative Data.

Custom Data

To add custom data to your notebooks, call the AddDataadd_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 DateTimedatetime 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 Timetime properties of these objects are based on the notebook time zone, but the EndTimeend_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 SetTimeZoneset_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)

You can also see our Videos. You can also get in touch with us via Discord.

Did you find this page helpful?

Contribute to the documentation: