feat: persist skipped ledger fills
Co-authored-by: genichin <4282227+genichin@users.noreply.github.com>
This commit is contained in:
co-authored by
genichin
parent
df0258bc36
commit
76cde2edd0
@@ -0,0 +1,30 @@
|
||||
CREATE TABLE IF NOT EXISTS ledger_skip (
|
||||
skip_key TEXT PRIMARY KEY,
|
||||
instance_key TEXT NOT NULL,
|
||||
slot_id UUID NOT NULL,
|
||||
portfolio_id TEXT NULL,
|
||||
symbol TEXT NULL,
|
||||
order_id TEXT NULL,
|
||||
execution_id TEXT NULL,
|
||||
side TEXT NOT NULL CHECK (side IN ('buy', 'sell')),
|
||||
qty DOUBLE PRECISION NOT NULL,
|
||||
price DOUBLE PRECISION NOT NULL,
|
||||
executed_at TIMESTAMPTZ NOT NULL,
|
||||
order_venue TEXT NOT NULL,
|
||||
execution_venue TEXT NOT NULL,
|
||||
skip_reason TEXT NOT NULL,
|
||||
status TEXT NOT NULL CHECK (status IN ('unresolved', 'resolved')),
|
||||
resolution_reason TEXT NULL,
|
||||
resolved_at TIMESTAMPTZ NULL,
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
|
||||
updated_at TIMESTAMPTZ NOT NULL DEFAULT now()
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_ledger_skip_status_created
|
||||
ON ledger_skip (status, created_at);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_ledger_skip_instance_portfolio_created
|
||||
ON ledger_skip (instance_key, portfolio_id, created_at);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_ledger_skip_execution_id
|
||||
ON ledger_skip (execution_id);
|
||||
Reference in New Issue
Block a user