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

Update model samples to new definition spec #59

Merged
merged 2 commits into from
Jan 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
10 changes: 0 additions & 10 deletions .spice/models/gas_fees/model.yml

This file was deleted.

28 changes: 0 additions & 28 deletions .spice/models/uniswap_v3_eth_usdt/model.yml

This file was deleted.

29 changes: 0 additions & 29 deletions .spice/models/uniswap_v3_wbtc_eth/model.yml

This file was deleted.

38 changes: 38 additions & 0 deletions models/gas_fees/model.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
family: gas_fees
name: v2
type: xgb_gasfees

epochs: 10

training:
sql: |
WITH counts AS (
SELECT block_number, count(1) as "count" FROM eth.transactions GROUP BY block_number
)
SELECT
number as "ts",
CAST(b.base_fee_per_gas / 1000000000.0 AS DOUBLE) as "y",
CAST(c."count" AS DOUBLE) as "covariate"
FROM eth.blocks b
INNER JOIN counts c ON b.number = c.block_number
WHERE b.base_fee_per_gas IS NOT NULL
ORDER BY block_number DESC
LIMIT 500

inferencing:
sql: |
SELECT
number as "ts",
CAST(base_fee_per_gas / 1000000000.0 AS DOUBLE) as "y",
CAST(transaction_count AS DOUBLE) as "y2"
FROM eth.recent_blocks
WHERE base_fee_per_gas IS NOT NULL
ORDER BY ts DESC
LIMIT 35

lookback_size: 30
forecast_size: 1

metadata:
firecache: true
covariate: true
35 changes: 35 additions & 0 deletions models/uniswap_v3_eth_usdt/model.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
family: tf_uniswapv3_eth_usdt
name: v0.0.1
type: tf_uniswapv3_eth_usdt_aggregated

epochs: 10

training:
sql: |
SELECT
block_timestamp as ts,
CASE
WHEN cast(amount1 as double) = 0 THEN NULL
ELSE abs(cast(amount1 as double)/ POWER(10, 6) / NULLIF(abs(cast(amount0 as double)/ POWER(10, 18)), 0))
END as y
FROM eth.uniswap_v3.event_swaps
WHERE address = '0x11b815efb8f581194ae79006d24e0d814b7697f6'
ORDER BY block_number desc
LIMIT 1000

inferencing:
sql: |
SELECT
block_timestamp as ts,
CASE
WHEN cast(amount1 as double) = 0 THEN NULL
ELSE abs(cast(amount1 as double)/ POWER(10, 6) / NULLIF(abs(cast(amount0 as double)/ POWER(10, 18)), 0))
END as y
FROM eth.uniswap_v3.recent_event_swaps
WHERE address = '0x11b815efb8f581194ae79006d24e0d814b7697f6'
ORDER BY block_number desc
lookback_size: 50
forecast_size: 1

metadata:
aggregate: true
36 changes: 36 additions & 0 deletions models/uniswap_v3_wbtc_eth/model.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
family: tf_uniswapv3_wbtc_eth
name: v0.0.1
type: tf_uniswapv3_wbtc_eth_aggregated

epochs: 10

training:
sql: |
SELECT
block_timestamp as ts,
CASE
WHEN abs(cast(amount0 as double) * POWER(10, 8)) = 0 THEN NULL
ELSE abs(cast(amount1 as double)/ POWER(10, 18) / NULLIF(abs(cast(amount0 as double)/ POWER(10, 8)), 0))
END as y
FROM eth.uniswap_v3.event_swaps
WHERE address = '0x4585fe77225b41b697c938b018e2ac67ac5a20c0'
ORDER BY block_number desc
LIMIT 1000

inferencing:
sql: |
SELECT
block_timestamp as ts,
CASE
WHEN abs(cast(amount0 as double) * POWER(10, 8)) = 0 THEN NULL
ELSE abs(cast(amount1 as double)/ POWER(10, 18) / NULLIF(abs(cast(amount0 as double)/ POWER(10, 8)), 0))
END as y
FROM eth.uniswap_v3.event_swaps
WHERE address = '0x4585fe77225b41b697c938b018e2ac67ac5a20c0'
ORDER BY block_number desc
LIMIT 100
lookback_size: 50
forecast_size: 1

metadata:
aggregate: true
Loading