Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -1,59 +1,59 @@
|
|
| 1 |
---
|
| 2 |
license: mit
|
| 3 |
-
|
| 4 |
-
- time-series-forecasting
|
| 5 |
-
tags:
|
| 6 |
-
- finance
|
| 7 |
-
- market-data
|
| 8 |
-
- order-book
|
| 9 |
-
- high-frequency
|
| 10 |
-
size_categories:
|
| 11 |
-
- 1M<n<10M
|
| 12 |
---
|
| 13 |
|
| 14 |
# LOBSTER Sample Data
|
| 15 |
|
| 16 |
-
|
| 17 |
|
| 18 |
-
|
| 19 |
|
| 20 |
-
|
| 21 |
|
| 22 |
-
- **AAPL**
|
| 23 |
-
- **
|
| 24 |
-
- **
|
| 25 |
-
- **
|
|
|
|
|
|
|
| 26 |
|
| 27 |
## File Structure
|
| 28 |
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
1. **Message file** (`*_message_*.csv`): Contains all order book events
|
| 32 |
- Columns: time, event_type, order_id, size, price, direction
|
| 33 |
-
-
|
| 34 |
|
| 35 |
-
2. **Orderbook file** (`*_orderbook_*.csv`):
|
| 36 |
- Columns: ask_price_1, ask_size_1, bid_price_1, bid_size_1, ... (up to N levels)
|
| 37 |
-
- Prices
|
| 38 |
|
| 39 |
## Usage
|
| 40 |
|
| 41 |
```python
|
| 42 |
from huggingface_hub import hf_hub_download
|
| 43 |
-
import
|
| 44 |
|
| 45 |
message_file = hf_hub_download(
|
| 46 |
-
repo_id="
|
| 47 |
filename="LOBSTER_SampleFile_AAPL_2012-06-21_50/AAPL_2012-06-21_34200000_37800000_message_50.csv",
|
| 48 |
repo_type="dataset"
|
| 49 |
)
|
| 50 |
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
|
|
|
|
|
|
|
|
|
| 59 |
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
license: mit
|
| 3 |
+
viewer: false
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
---
|
| 5 |
|
| 6 |
# LOBSTER Sample Data
|
| 7 |
|
| 8 |
+
Raw LOBSTER (Limit Order Book System) L3 order book data for June 21, 2012.
|
| 9 |
|
| 10 |
+
**Important:** These are raw CSV files without headers. They cannot be automatically loaded by HuggingFace viewers. Use the loading code below with custom schemas.
|
| 11 |
|
| 12 |
+
## Available Datasets
|
| 13 |
|
| 14 |
+
- **AAPL**: 1, 5, 10, 30, 50 levels
|
| 15 |
+
- **AMZN**: 1, 5, 10 levels
|
| 16 |
+
- **GOOG**: 1, 5, 10 levels
|
| 17 |
+
- **INTC**: 1, 5, 10 levels
|
| 18 |
+
- **MSFT**: 1, 5, 10, 30, 50 levels
|
| 19 |
+
- **SPY**: 30, 50 levels
|
| 20 |
|
| 21 |
## File Structure
|
| 22 |
|
| 23 |
+
1. **Message file** (`*_message_*.csv`): Order book events (6 columns, no header)
|
|
|
|
|
|
|
| 24 |
- Columns: time, event_type, order_id, size, price, direction
|
| 25 |
+
- Types: 1=New, 2=Cancel, 3=Delete, 4=Exec(Visible), 5=Exec(Hidden), 7=Halt
|
| 26 |
|
| 27 |
+
2. **Orderbook file** (`*_orderbook_*.csv`): Order book snapshots (4N columns, no header)
|
| 28 |
- Columns: ask_price_1, ask_size_1, bid_price_1, bid_size_1, ... (up to N levels)
|
| 29 |
+
- Prices in fixed-point (multiply by 10^-4)
|
| 30 |
|
| 31 |
## Usage
|
| 32 |
|
| 33 |
```python
|
| 34 |
from huggingface_hub import hf_hub_download
|
| 35 |
+
import polars as pl
|
| 36 |
|
| 37 |
message_file = hf_hub_download(
|
| 38 |
+
repo_id="totalorganfailure/lobster-data",
|
| 39 |
filename="LOBSTER_SampleFile_AAPL_2012-06-21_50/AAPL_2012-06-21_34200000_37800000_message_50.csv",
|
| 40 |
repo_type="dataset"
|
| 41 |
)
|
| 42 |
|
| 43 |
+
# Define schema for message file
|
| 44 |
+
MESSAGE_SCHEMA = {
|
| 45 |
+
"time": pl.Float64,
|
| 46 |
+
"type": pl.Int8,
|
| 47 |
+
"order_id": pl.Int64,
|
| 48 |
+
"size": pl.Int32,
|
| 49 |
+
"price": pl.Int64,
|
| 50 |
+
"direction": pl.Int8,
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
messages = pl.read_csv(message_file, has_header=False, schema=MESSAGE_SCHEMA)
|
| 54 |
```
|
| 55 |
+
|
| 56 |
+
## More Information
|
| 57 |
+
|
| 58 |
+
- https://lobsterdata.com/
|
| 59 |
+
- https://lobsterdata.com/info/DataSamples.php
|