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 SetStartDate method.

qb.SetStartDate(2022, 1, 1);
qb.SetStartDate(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 method.

qb.SetEndDate(2022, 8, 15);
qb.SetEndDate(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 or AddForex. 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.AddEquity("SPY")  # Add Apple 1 minute bars (minute by default)
qb.AddForex("EURUSD", Resolution.Second) # Add EURUSD 1 second bars

Alternative Data

To add alternative datasets to your notebooks, call the AddData method. For a full example, see Alternative Data.

Custom Data

To add custom data to your notebooks, call the AddData 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 Time properties of these objects are based on the notebook time zone, but the EndTime 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 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.SetTimeZone("Europe/London")
qb.SetTimeZone(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: