clickhouse: commit exit-leg/reconstruction/maras DDLs + UV/violet DDLs (M1 vendor reconcile, upstream-first)
This commit is contained in:
26
prod/clickhouse/pink/04_create_position_state.sql
Normal file
26
prod/clickhouse/pink/04_create_position_state.sql
Normal file
@@ -0,0 +1,26 @@
|
||||
CREATE TABLE IF NOT EXISTS dolphin_pink.position_state
|
||||
(
|
||||
`ts` DateTime64(6, 'UTC'),
|
||||
`trade_id` String,
|
||||
`asset` LowCardinality(String),
|
||||
`direction` Int8,
|
||||
`entry_price` Float64,
|
||||
`quantity` Float64,
|
||||
`notional` Float64,
|
||||
`leverage` Float32,
|
||||
`bucket_id` Int32 DEFAULT -1,
|
||||
`entry_bar` Int32 DEFAULT 0,
|
||||
`status` LowCardinality(String),
|
||||
`exit_reason` LowCardinality(String) DEFAULT '',
|
||||
`pnl` Float64 DEFAULT 0,
|
||||
`bars_held` UInt16 DEFAULT 0,
|
||||
`market_state_bundle_json` String DEFAULT '',
|
||||
`tp_base_pct` Float32 DEFAULT 0,
|
||||
`tp_effective_pct` Float32 DEFAULT 0,
|
||||
`our_leverage` Float32 DEFAULT 0
|
||||
)
|
||||
ENGINE = ReplacingMergeTree(ts)
|
||||
PARTITION BY toYYYYMM(ts)
|
||||
ORDER BY (trade_id, ts)
|
||||
TTL toDateTime(ts) + toIntervalDay(180)
|
||||
SETTINGS index_granularity = 8192
|
||||
Reference in New Issue
Block a user