Skip to content

Commit

Permalink
Add polymarket trump and kamala metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
akan72 committed Aug 20, 2024
1 parent 3c7f452 commit 5fca851
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 0 deletions.
18 changes: 18 additions & 0 deletions models/projects/polymarket/core/ez_polymarket_metrics.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{{
config(
materialized="table",
snowflake_warehouse="POLYMARKET",
database="polymarket",
schema="core",
alias="ez_metrics",
)
}}

SELECT
date,
'polymarket' AS app,
'DeFi' AS category,
"'21742633143463906290569050155826241533067272736897614950488156847949938836455'" AS trump_prediction_market_100k_buy_order_price,
"'21271000291843361249209065706097167029083067325856089903026951915683588703117'" AS kamala_prediction_market_100k_buy_order_price
FROM {{ ref("fact_polymarket_prediction_markets") }}
PIVOT(SUM(PREDICTION_MARKET_100K_BUY_ORDER_PRICE) FOR market IN (ANY ORDER BY market))
7 changes: 7 additions & 0 deletions models/staging/polymarket/__polymarket__sources.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
sources:
- name: PROD_LANDING
schema: PROD_LANDING
database: LANDING_DATABASE
tables:
- name: raw_polymarket_fill_price_by_market

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

SELECT
DATEADD('DAY', -1, DATE_TRUNC('DAY', extraction_date)::date) AS date,
value:market::varchar as market,
AVG(value:average_fill_price) as prediction_market_100k_buy_order_price
FROM {{ source("PROD_LANDING", "raw_polymarket_fill_price_by_market") }},
lateral flatten(input => parse_json(source_json))
GROUP BY
1, 2

0 comments on commit 5fca851

Please sign in to comment.