turtle_quant_1.data_processing.adapters.gcs_storage_adapter¶
turtle_quant_1.data_processing.adapters.gcs_storage_adapter
¶
Google Cloud Storage implementation for data storage.
GCSDataStorageAdapter
¶
Bases: BaseDataStorageAdapter
Google Cloud Storage implementation for data storage.
Initialize the GCS data storage.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
bucket_name
|
Optional[str]
|
Name of the GCS bucket. If None, reads from GCS_BUCKET_NAME env var. |
None
|
project_id
|
Optional[str]
|
GCP project ID. If None, reads from GCP_PROJECT_ID env var. |
None
|
Source code in src/turtle_quant_1/data_processing/adapters/gcs_storage_adapter.py
delete_ohlcv_data
¶
Delete data from GCS.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
symbol
|
str
|
The symbol to delete data for. |
required |
freq
|
CandleUnit
|
The frequency of the data to delete. |
CANDLE_UNIT
|
Source code in src/turtle_quant_1/data_processing/adapters/gcs_storage_adapter.py
load_ohlcv_data
¶
load_ohlcv_data(
symbol: str,
start_date: Optional[datetime] = None,
end_date: Optional[datetime] = None,
freq: CandleUnit = CANDLE_UNIT,
) -> DataFrame
Load OHLCV data from GCS.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
symbol
|
str
|
The symbol to load data for. |
required |
start_date
|
Optional[datetime]
|
Start date for the data. If None, returns all data. |
None
|
end_date
|
Optional[datetime]
|
End date for the data. If None, returns all data. |
None
|
freq
|
CandleUnit
|
The frequency of the data. |
CANDLE_UNIT
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
DataFrame with columns: datetime, open, high, low, close, volume. |
Source code in src/turtle_quant_1/data_processing/adapters/gcs_storage_adapter.py
save_ohlcv_data
¶
Save OHLCV data to GCS.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
symbol
|
str
|
The symbol the data belongs to. |
required |
data
|
DataFrame
|
DataFrame with OHLCV data. |
required |