decred / dcrdex

The Decred Decentralized Exchange (DEX), powered by atomic-swaps.
Other
178 stars 86 forks source link

mm oracle errors #2831

Open buck54321 opened 2 weeks ago

buck54321 commented 2 weeks ago

We need to rethink the way the mmbot gets market data from "oracles". Currently, we're using https://api.coinpaprika.com/v1/coins/%s/markets to get information about markets for an asset pair. But the data is not great and/or we're not filtering it properly, because we end up with a ton of errors.

2024-06-20 14:16:44.394 [ERR] MM[oracle]: Error getting spread from "https://www.binance.com/en/trade/USDC_USDT": HTTP error: "451 Unavailable For Legal Reasons" (code 451)
2024-06-20 14:16:44.770 [ERR] MM[oracle]: Error getting spread from "https://www.binance.com/en/trade/DCR_BTC": HTTP error: "400 Bad Request" (code 400)
2024-06-20 14:16:45.129 [ERR] MM[oracle]: Error getting spread from "https://hitbtc.com/USDT-to-USDC": HTTP error: "400 Bad Request" (code 400)
2024-06-20 14:16:50.027 [ERR] MM[oracle]: Error getting spread from "https://pro.coinbase.com/trade/USDT-USDC": HTTP error: "404 Not Found" (code 404)
2024-06-20 14:16:50.594 [ERR] MM[oracle]: Error getting spread from "https://exmo.com/trade/USDC_USDT": slug not in response****

We only use these oracles in the basic-mm bot, and we fall back to a rate derived from fiat exchange rates.

martonp commented 4 days ago

2854 Fixes all of the errors above other than the DCR_BTC one from Binance, which happens only if you are querying from a US IP.