FlipsideCrypto / near-models

Data models for the NEAR blockchain, originally built by the MetricsDAO community.
https://flipsidecrypto.github.io/near-models/
MIT License
16 stars 12 forks source link

Table: Prices #78

Closed forgxyz closed 2 years ago

forgxyz commented 2 years ago

Construct a prices table with the following schema:

The sources will be: coingecko and cmc price feeds, the priceoracle on NEAR, and eventually, dex swaps.

We will get a token and symbol from the API price feeds, while the token_contract will come from the price oracle and dex swaps. So, a label table or seed will be necessary to link these together.

forgxyz commented 2 years ago
Methods called in priceoracle.near METHOD_NAME COUNT(DISTINCT TX_HASH)
report_prices 2743869
oracle_call 93219
18
claim_near 10
add_asset 8
add_oracle 3
update_owner_id 1
forgxyz commented 2 years ago

Oracle ✅ API Swaps

forgxyz commented 2 years ago

Next step in this is to derive prices from on-chain swaps via the ez_dex_swaps table (use this as the silver table is not decimal adjusted). Example is in this query from flipside user Pinehearst https://app.flipsidecrypto.com/velocity/queries/4abada21-93b9-4b90-aeb1-cbe7231d364c

The schema will fit the current prices table, so that is the information we will need to derive from the swap.