'pool' entity in DEX queries
mettinger opened this issue · comments
I have not been able to successfully query Uniswap or Sushi using the 'pool' entity. I always get the empty list as return value from the query. Do you have an example of how to properly do this form of query for DEXs?
You need to specify the pool id, for example, this should work for uniswap v2
list_swaps_dai_weth = uniswap.get_data_from_date_range(start_date_amm, end_date_amm, "swap", pool='0xa478c2975ab1ea89e8196811f51a7b7ade33eb11')
I was referring to 'pool' as an entity, not as a keyword. For example:
uniswap.supported_entities()
returns ['swap', 'pool']
Specifically here is what I mean:
uniswap.get_data_from_date_range(start_date_amm, end_date_amm, "pool", pool='')
returns []
and
uniswap.get_data_from_date_range(start_date_amm, end_date_amm, "pool", pool='0xa478c2975ab1ea89e8196811f51a7b7ade33eb11')
results in the error:
KeyError Traceback (most recent call last)
<ipython-input-76-1536d355d2d6> in <module>
----> 1 uniswap.get_data_from_date_range(start_date_amm, end_date_amm, "pool", pool='0xa478c2975ab1ea89e8196811f51a7b7ade33eb11')
~\anaconda3\lib\site-packages\deficrawler\dex.py in get_data_from_date_range(self, from_date, to_date, entity, pool)
34 if(pool != ''):
35 pool_filter = {
---> 36 self.mappings_file['entities'][entity]['query']['params']['pool']: pool
37 }
38
KeyError: 'pool'
If you want to get the data related to the pools, you should use uniswap.get_all_pools()
This will return all the uniswap pools.
To get data related with liquidity providers in pools you can use mint
or burn
entities. Take a look to the tests here:
https://github.com/keyko-io/defi-crawler-py/blob/main/tests/int/test_mint.py
Thank you for this information! Is there a simple way of getting the balances of the two tokens in a pool or pools at a specific time or specific block?
Not yet, I'll add some new fields to the pools, but not sure if query the historical liquidity will be supported.