overlay-market / overlay-risk

Risk metrics for various data streams
MIT License
13 stars 4 forks source link

Fixed token names and added check for min 30 days #11

Closed deepsp94 closed 3 years ago

mikeyrf commented 3 years ago

Testing on this. When I try to run brownie run influx_metrics locally on the branch, I get an error even though there's at least 30 days of data in ovl_sushi:

id Sushiswap: UNI / WETH
Fetching prices for Sushiswap: UNI / WETH ...
Number of days between latest and first data point: 29 days 23:24:57
This pair has less than 30 days of data, therefore it is not being ingested to ovl_metrics_test

which has to do with period size (how frequently the cron fetches from price cumulative in influx_sushi) - we'll always receive < 30d of data from the query.

Easy way to resolve is to change bool condition in L211 to be

if data_days < timedelta(days = params['points'] - 1):
   print(f"This pair has less than {params['points']-1} days of data, therefore it is not being ingested to {config['bucket']}")
   continue # Go to next iteration of loop (ie, next quote) if condition is not satisfied

Committed these changes to the branch and seems to be working great