Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Drift Parsed Logs Model #619

Merged
merged 2 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions models/staging/drift/__drift__sources.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ sources:
- name: raw_drift_trading_volume
- name: raw_drift_fill_price_by_market
- name: raw_drift_sell_fill_price_by_market
- name: raw_drift_parsed_logs

28 changes: 28 additions & 0 deletions models/staging/drift/fact_drift_parsed_logs.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{{ config(materialized="table") }}

SELECT
value:block_date::varchar AS block_date,
value:EstExternalFillCost::float AS est_external_fill_cost,
value:LiquidationVolume::float AS est_external_fill_cost,
value:OrderFillWithOpenbookV1::float AS order_fill_with_openbook_v1,
value:OrderFillWithPhoenix::float AS order_fill_with_phoenix,
value:OrderFilledWithAMM::float AS order_filled_with_amm,
value:OrderFilledWithAMMJit::float AS order_filled_with_amm_jit,
value:OrderFilledWithAMMJitLPSplit::float AS order_filled_with_amm_jit_lp_split,
value:OrderFilledWithLPJit::float AS order_filled_with_lp_jit,
value:OrderFilledWithMatch::float AS order_filled_with_match,
value:OrderFilledWithMatchJit::float AS order_filled_with_match_jit,
value:first_block_time::string AS first_block_time,
value:last_block_time::string AS last_block_time,
value:market_index::integer AS market_index,
value:market_type::integer AS market_type,
value:total_filler_reward::float AS total_filler_reward,
value:total_liquidatee_fee::float AS total_liquidatee_fee,
value:total_liquidator_rebate::float AS total_liquidator_rebate,
value:total_maker_rebate::float AS total_maker_rebate,
value:total_revenue::float AS total_revenue,
value:total_taker_fee::float AS total_taker_fee,
value:total_volume::float AS total_volume,
value:trade_count::integer AS trade_count
FROM {{ source("PROD_LANDING", "raw_drift_parsed_logs") }}
lateral flatten(input => parse_json(source_json))