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

feat: dYdX CMC Research #557

Merged
merged 10 commits into from
Jul 1, 2024
Merged

feat: dYdX CMC Research #557

merged 10 commits into from
Jul 1, 2024

Conversation

davidterpay
Copy link
Contributor

No description provided.

Copy link

codecov bot commented Jun 27, 2024

Codecov Report

Attention: Patch coverage is 47.14286% with 37 lines in your changes missing coverage. Please review.

Project coverage is 56.54%. Comparing base (bf810ed) to head (b4d4e17).

Files Patch % Lines
providers/apis/dydx/multi_market_map_fetcher.go 19.44% 28 Missing and 1 partial ⚠️
scripts/genesis.go 0.00% 5 Missing ⚠️
providers/apis/dydx/research_api_handler.go 92.30% 1 Missing and 1 partial ⚠️
providers/factories/oracle/marketmap.go 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #557      +/-   ##
==========================================
- Coverage   56.63%   56.54%   -0.10%     
==========================================
  Files         246      246              
  Lines       12459    12506      +47     
==========================================
+ Hits         7056     7071      +15     
- Misses       4705     4735      +30     
- Partials      698      700       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@davidterpay davidterpay marked this pull request as ready for review June 28, 2024 15:58
@@ -49,6 +50,7 @@ var ProviderMapping = map[string]string{
"Raydium": raydium.Name,
"UniswapV3-Ethereum": uniswapv3.ProviderNames[constants.ETHEREUM],
"UniswapV3-Base": uniswapv3.ProviderNames[constants.BASE],
coinmarketcap.Name: coinmarketcap.Name,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs to be added here since the existing logic inherits this class. Once we migrate to v6 we should move this logic directly into the research provider.

@davidterpay davidterpay marked this pull request as draft June 28, 2024 16:02
@davidterpay davidterpay marked this pull request as ready for review June 28, 2024 20:30
Copy link
Contributor

@nivasan1 nivasan1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comments

// iterate over all entries in the research json + unmarshal it's market-params
resp := dydxtypes.QueryAllMarketParamsResponse{}
for _, market := range research {
if market.CMCID < 0 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this limit us (even the normal research-json provider) to ignore any market that does not have a cmc-id?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch, should also check that its cmc

// if the fetcher is only for CoinMarketCap markets, filter out all non-CMC markets
if f.isCMCOnly {
for ticker, market := range dydxMainnetMarketMap.Markets {
market.Ticker.MinProviderCount = 1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need to do this? Is this meant to over-ride all markets that exist on mainnet, but not in research-json?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will only over-ride if its meant to be a CMC provider only. so research json would still have the correct min provider count.

cmcProvider mmtypes.ProviderConfig
)

for _, provider := range market.ProviderConfigs {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When would a mainnet market ever have the CMC provider?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it wouldn't which is why we just cross reference with what is in our constants. the markets being added rn via the frontend should have CMC IDs.

cmcMarket, ok := marketmaps.CoinMarketCapMarketMap.Markets[ticker]
if !ok {
f.logger.Info("did not find CMC market for ticker", zap.String("ticker", ticker))
delete(dydxMainnetMarketMap.Markets, ticker)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this mean we can create invalid market-maps? I.e we remove an adjust by

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

technically yes, but all of the important adjust bys are in the constants dir. this is a temp fix till we fully move to marketmap generation.

@davidterpay davidterpay merged commit 31ab5f8 into main Jul 1, 2024
14 of 16 checks passed
@davidterpay davidterpay deleted the terpay/dydx-research-cmc branch July 1, 2024 17:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants