-
Notifications
You must be signed in to change notification settings - Fork 1.4k
add columns to polymarket models #9107
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
base: main
Are you sure you want to change the base?
Conversation
PR SummaryIntroduces TVL, open positions, and user balance change models while enriching market/trade data (link slug, parsed times, asset IDs, price modifier) and converting positions to incremental with pricing.
Written by Cursor Bugbot for commit 9592bca. Configure here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment @cursor review or bugbot run to trigger another review on this PR
...ily_spellbook/models/_projects/polymarket/polygon/polymarket_polygon_market_prices_daily.sql
Outdated
Show resolved
Hide resolved
...ects/daily_spellbook/models/_projects/polymarket/polygon/polymarket_polygon_protocol_tvl.sql
Outdated
Show resolved
Hide resolved
...ts/daily_spellbook/models/_projects/polymarket/polygon/polymarket_polygon_open_positions.sql
Outdated
Show resolved
Hide resolved
|
@cursor review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment @cursor review or bugbot run to trigger another review on this PR
...ects/daily_spellbook/models/_projects/polymarket/polygon/polymarket_polygon_protocol_tvl.sql
Outdated
Show resolved
Hide resolved
|
@cursor review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment @cursor review or bugbot run to trigger another review on this PR
...ects/daily_spellbook/models/_projects/polymarket/polygon/polymarket_polygon_protocol_tvl.sql
Outdated
Show resolved
Hide resolved
...ts/daily_spellbook/models/_projects/polymarket/polygon/polymarket_polygon_open_positions.sql
Outdated
Show resolved
Hide resolved
|
@cursor review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅ Bugbot reviewed your changes and found no bugs!
Comment @cursor review or bugbot run to trigger another review on this PR
…values and optimise open positions
…spellbook into polymarket_table_fixes
|
@cursor review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment @cursor review or bugbot run to trigger another review on this PR
...ts/daily_spellbook/models/_projects/polymarket/polygon/polymarket_polygon_open_positions.sql
Show resolved
Hide resolved
...ts/daily_spellbook/models/_projects/polymarket/polygon/polymarket_polygon_market_details.sql
Show resolved
Hide resolved
|
https://github.com/cursor review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment @cursor review or bugbot run to trigger another review on this PR
| SELECT *, | ||
| CASE WHEN outcome = '50/50' THEN 0.5 | ||
| WHEN LOWER(token_outcome) = outcome THEN 1 | ||
| ELSE 0 END AS price_modifier |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Unresolved markets incorrectly get zero price modifier
The price_modifier calculation returns 0 for markets with outcome = 'unresolved' because neither the '50/50' check nor LOWER(token_outcome) = outcome matches when outcome is 'unresolved'. This differs from the existing behavior in polymarket_polygon_market_prices_daily.sql which preserves the original market price (ELSE ff.price) for unresolved markets. When used in polymarket_polygon_positions.sql, markets past their end time but not yet resolved will incorrectly show positions as worthless (price = 0) instead of using the last traded price.
added columns to existing tables (needed for much more efficient queries) and created 3 tables: