Skip to content

Commit 235cd9a

Browse files
committed
Add storage path instructions
1 parent 38179eb commit 235cd9a

File tree

1 file changed

+18
-20
lines changed

1 file changed

+18
-20
lines changed

docusaurus/docs/Data/download.md

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -32,24 +32,29 @@ def download(
3232
) -> Union[pandas.DataFrame, polars.DataFrame]
3333
```
3434

35-
| Parameter | Type | Description |
36-
| -------------- | ------ | -------------------------------------------------------------------------------- |
37-
| `symbol` | `str` | The symbol (e.g., `"BTC/USDT"`) for which data is downloaded. |
38-
| `market` | `str` | (Optional) The market to download data from (e.g., `"binance"`). |
39-
| `date` | `str` | (Optional) Specific date to retrieve data for. |
40-
| `time_frame` | `str` | The time frame for data (e.g., `"1d"`, `"1h"`). |
41-
| `data_type` | `str` | Type of data to retrieve: `"ohlcv"` (default) or `"ticker"`. |
42-
| `start_date` | `str` | (Optional) Start of the date range to retrieve data. |
43-
| `end_date` | `str` | (Optional) End of the date range. |
44-
| `window_size` | `int` | Number of records to retrieve (default: 200). |
45-
| `pandas` | `bool` | If `True`, returns a `pandas.DataFrame`; otherwise returns a `polars.DataFrame`. |
46-
| `save` | `bool` | If `True`, saves the downloaded data to disk. |
47-
| `storage_path` | `str` | (Optional) Path to store the data when `save=True`. |
35+
| Parameter | Type | Description |
36+
| -------------- | ------ |--------------------------------------------------------------------------------------------------------|
37+
| `symbol` | `str` | The symbol (e.g., `"BTC/USDT"`) for which data is downloaded. |
38+
| `market` | `str` | (Optional) The market to download data from (e.g., `"binance"`). |
39+
| `date` | `str` | (Optional) Specific date to retrieve data for. |
40+
| `time_frame` | `str` | The time frame for data (e.g., `"1d"`, `"1h"`). |
41+
| `data_type` | `str` | Type of data to retrieve: `"ohlcv"` (default) or `"ticker"`. |
42+
| `start_date` | `str` | (Optional) Start of the date range to retrieve data. |
43+
| `end_date` | `str` | (Optional) End of the date range. |
44+
| `window_size` | `int` | Number of records to retrieve (default: 200). |
45+
| `pandas` | `bool` | If `True`, returns a `pandas.DataFrame`; otherwise returns a `polars.DataFrame`. |
46+
| `save` | `bool` | If `True`, saves the downloaded data to disk. |
47+
| `storage_path` | `str` | (Optional) Path to store the data when save=True. Also used to load from disk if data already exists. |
4848

4949

5050
## Returns
5151
The function returns a DataFrame (pandas or polars) containing the requested market data, ready for analysis, visualization, or model training.
5252

53+
## How It Works with storage_path
54+
When a storage_path is provided, the function first checks if the requested data already exists at the specified path. If the file is found and readable, the function loads it directly from disk, avoiding unnecessary network calls. If not, it downloads the data and saves it to the path (if save=True).
55+
56+
This makes repeated experiments much faster and reduces API usage and rate-limiting issues.
57+
5358
## Why It's Useful?
5459
This function streamlines the process of acquiring market data by:
5560
* Automatically selecting the correct data provider
@@ -78,10 +83,3 @@ This enables quick preparation of time-series datasets for supervised learning t
7883
```python
7984
download("SOL/USDT", market="binance", time_frame="1d", save=True, storage_path="./data/")
8085
```
81-
82-
## Internals
83-
The function relies on the following components: ogopa
84-
* ConfigurationService and MarketCredentialService to determine available providers and credentials.
85-
* DataProviderService to abstract away direct API calls.
86-
* dateutil.parser for robust datetime parsing.
87-
* Default providers registered via get_default_data_providers() and get_default_ohlcv_data_providers().

0 commit comments

Comments
 (0)