turtle_quant_1.strategies.helpers.data_units¶
turtle_quant_1.strategies.helpers.data_units
¶
DataUnitConverter
¶
convert_to_15m_data
classmethod
¶
Convert 5M OHLCV data to 15-minute bars.
convert_to_1d_data
classmethod
¶
Convert 5M OHLCV data to daily bars.
The indices of the original DataFrame will be retained, i.e. the row number of a day will be the row number of the last timestamp of the day, so the row numbers will not be contiguous.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
symbol
|
str
|
The symbol of the data. |
required |
data
|
DataFrame
|
The data to convert. |
required |
Returns:
| Type | Description |
|---|---|
DataFrame
|
The converted data. |
Source code in src/turtle_quant_1/strategies/helpers/data_units.py
convert_to_1h_data
classmethod
¶
Convert 5M OHLCV data to 1-hour bars.
convert_to_1w_data
classmethod
¶
Convert 5M OHLCV data to weekly bars (week ending on Friday).
The indices of the original DataFrame will be retained, i.e. the row number of a week will be the row number of the last timestamp of the week, so the row numbers will not be contiguous.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
symbol
|
str
|
The symbol of the data. |
required |
data
|
DataFrame
|
The data to convert. |
required |
Returns:
| Type | Description |
|---|---|
DataFrame
|
The converted data. |
Source code in src/turtle_quant_1/strategies/helpers/data_units.py
convert_to_2h_data
classmethod
¶
Convert 5M OHLCV data to 2-hour bars.
convert_to_30m_data
classmethod
¶
Convert 5M OHLCV data to 30-minute bars.
convert_to_4h_data
classmethod
¶
Convert 5M OHLCV data to 4-hour bars.
preload_global_instance_cache
classmethod
¶
NOTE: Used for backtesting only.