Symbol & data refactoring for Nautilus
This commit is contained in:
@@ -37,14 +37,14 @@ Historical OHLC (Open, High, Low, Close, Volume) candle data for all periods in
|
||||
```sql
|
||||
-- Query 1-hour candles for specific ticker and time range
|
||||
SELECT * FROM trading.ohlc
|
||||
WHERE ticker = 'BINANCE:BTC/USDT'
|
||||
WHERE ticker = 'BTC/USDT.BINANCE'
|
||||
AND period_seconds = 3600
|
||||
AND timestamp BETWEEN 1735689600000000 AND 1736294399000000
|
||||
ORDER BY timestamp;
|
||||
|
||||
-- Query most recent 1-minute candles
|
||||
SELECT * FROM trading.ohlc
|
||||
WHERE ticker = 'BINANCE:BTC/USDT'
|
||||
WHERE ticker = 'BTC/USDT.BINANCE'
|
||||
AND period_seconds = 60
|
||||
AND timestamp > (UNIX_MICROS(CURRENT_TIMESTAMP()) - 3600000000)
|
||||
ORDER BY timestamp DESC
|
||||
@@ -53,7 +53,7 @@ LIMIT 60;
|
||||
-- Query all periods for a ticker
|
||||
SELECT period_seconds, COUNT(*) as candle_count
|
||||
FROM trading.ohlc
|
||||
WHERE ticker = 'BINANCE:BTC/USDT'
|
||||
WHERE ticker = 'BTC/USDT.BINANCE'
|
||||
GROUP BY period_seconds;
|
||||
```
|
||||
|
||||
@@ -124,7 +124,7 @@ table = catalog.load_table("trading.ohlc")
|
||||
# Query with filters
|
||||
df = table.scan(
|
||||
row_filter=(
|
||||
(col("ticker") == "BINANCE:BTC/USDT") &
|
||||
(col("ticker") == "BTC/USDT.BINANCE") &
|
||||
(col("period_seconds") == 3600) &
|
||||
(col("timestamp") >= 1735689600000000)
|
||||
)
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
CREATE TABLE IF NOT EXISTS trading.ohlc (
|
||||
-- Natural key fields (uniqueness enforced by Flink upsert logic)
|
||||
ticker STRING NOT NULL COMMENT 'Market identifier (e.g., BINANCE:BTC/USDT)',
|
||||
ticker STRING NOT NULL COMMENT 'Market identifier (e.g., BTC/USDT.BINANCE)',
|
||||
period_seconds INT NOT NULL COMMENT 'OHLC period in seconds (60, 300, 900, 3600, 14400, 86400, 604800, etc.)',
|
||||
timestamp BIGINT NOT NULL COMMENT 'Candle timestamp in microseconds since epoch',
|
||||
|
||||
|
||||
Reference in New Issue
Block a user