feat(staging): add candles cache + v2 slippage
This commit is contained in:
@@ -97,9 +97,12 @@ async function main() {
|
||||
const dlobStatsLatestTable = { schema: 'public', name: 'dlob_stats_latest' };
|
||||
const dlobDepthBpsLatestTable = { schema: 'public', name: 'dlob_depth_bps_latest' };
|
||||
const dlobSlippageLatestTable = { schema: 'public', name: 'dlob_slippage_latest' };
|
||||
const dlobSlippageLatestV2Table = { schema: 'public', name: 'dlob_slippage_latest_v2' };
|
||||
const candlesCacheTable = { schema: 'public', name: 'drift_candles_cache' };
|
||||
const dlobStatsTsTable = { schema: 'public', name: 'dlob_stats_ts' };
|
||||
const dlobDepthBpsTsTable = { schema: 'public', name: 'dlob_depth_bps_ts' };
|
||||
const dlobSlippageTsTable = { schema: 'public', name: 'dlob_slippage_ts' };
|
||||
const dlobSlippageTsV2Table = { schema: 'public', name: 'dlob_slippage_ts_v2' };
|
||||
const baseCandlesFn = { schema: 'public', name: 'get_drift_candles' };
|
||||
const candlesReturnTable = { schema: 'public', name: 'drift_candles' };
|
||||
|
||||
@@ -169,6 +172,21 @@ async function main() {
|
||||
await ensureTickTable(t);
|
||||
}
|
||||
|
||||
// Cached candles table (precomputed by worker; public read).
|
||||
await ensurePublicSelectTable(candlesCacheTable, [
|
||||
'bucket',
|
||||
'bucket_seconds',
|
||||
'symbol',
|
||||
'source',
|
||||
'open',
|
||||
'high',
|
||||
'low',
|
||||
'close',
|
||||
'oracle_close',
|
||||
'ticks',
|
||||
'updated_at',
|
||||
]);
|
||||
|
||||
const ensureDlobTable = async (table, columns) => {
|
||||
await metadataIgnore({ type: 'pg_untrack_table', args: { source, table } });
|
||||
await metadata({ type: 'pg_track_table', args: { source, table } });
|
||||
@@ -321,6 +339,28 @@ async function main() {
|
||||
'updated_at',
|
||||
]);
|
||||
|
||||
await ensurePublicSelectTable(dlobSlippageLatestV2Table, [
|
||||
'market_name',
|
||||
'side',
|
||||
'size_usd',
|
||||
'market_type',
|
||||
'market_index',
|
||||
'ts',
|
||||
'slot',
|
||||
'mid_price',
|
||||
'best_bid_price',
|
||||
'best_ask_price',
|
||||
'vwap_price',
|
||||
'worst_price',
|
||||
'filled_usd',
|
||||
'filled_base',
|
||||
'impact_bps',
|
||||
'levels_consumed',
|
||||
'fill_pct',
|
||||
'raw',
|
||||
'updated_at',
|
||||
]);
|
||||
|
||||
await ensurePublicSelectTable(dlobStatsTsTable, [
|
||||
'ts',
|
||||
'id',
|
||||
@@ -386,6 +426,27 @@ async function main() {
|
||||
'raw',
|
||||
]);
|
||||
|
||||
await ensurePublicSelectTable(dlobSlippageTsV2Table, [
|
||||
'ts',
|
||||
'id',
|
||||
'market_name',
|
||||
'side',
|
||||
'size_usd',
|
||||
'market_type',
|
||||
'market_index',
|
||||
'source_ts',
|
||||
'slot',
|
||||
'mid_price',
|
||||
'vwap_price',
|
||||
'worst_price',
|
||||
'filled_usd',
|
||||
'filled_base',
|
||||
'impact_bps',
|
||||
'levels_consumed',
|
||||
'fill_pct',
|
||||
'raw',
|
||||
]);
|
||||
|
||||
// Return table type for candle functions (needed for Hasura to track the function).
|
||||
await metadataIgnore({ type: 'pg_track_table', args: { source, table: candlesReturnTable } });
|
||||
|
||||
|
||||
Reference in New Issue
Block a user