ExchangeUnion / market-maker-bot

MM Bot for OpenDEX. Make profits via arbitrage between OpenDEX and a connected CEX account like Binance 🤖
GNU Affero General Public License v3.0
105 stars 20 forks source link

feat: dynamic minimum quantity #130

Open erkarl opened 3 years ago

erkarl commented 3 years ago

This PR adds support for dynamically calculating the minimum supported CEX order quantity. Previously, the limits were hardcoded. This was causing issues because the price increase made the hardcoded limits invalid.

erkarl commented 3 years ago
* [ ]  got convertation err
2021-01-06 06:24:38.3838 [OpenDEX] trace: Base asset balance 30 (maxinbound: 0, maxoutbound: 30) and quote asset balance 2.5 (maxinbound: 2.4499095, maxoutbound: 2.45).
2021-01-06 06:24:38.3838 [OpenDEX] trace: Replacing ETH/BTC buy order with id arby-ETH/BTC-buy-order, quantity 0.36923458 and price 0.03362593
2021-01-06 06:24:38.3838 [OpenDEX] trace: Replacing ETH/BTC sell order with id arby-ETH/BTC-sell-order, quantity 0.5643896 and price 0.03465007
2021-01-06 06:24:38.3838 [OpenDEX] trace: Creating ETH/BTC sell order with id arby-ETH/BTC-sell-order, quantity 0.5643896 and price 0.03465007
2021-01-06 06:24:38.3838 [OpenDEX] trace: Creating ETH/BTC buy order with id arby-ETH/BTC-buy-order, quantity 0.36923458 and price 0.03362593
2021-01-06 06:24:38.3838 [Centralized] info: Base asset balance 0.37296423 and quote asset balance 0.01946175
2021-01-06 06:24:39.3939 [OpenDEX] warn: 2 UNKNOWN: The number 38769630.9 cannot be converted to a BigInt because it is not an integer. Retrying in 5000ms.
2021-01-06 06:24:44.4444 [Centralized] trace: New price: 0.034105
2021-01-06 06:24:44.4444 [OpenDEX] trace: Base asset balance 30 (maxinbound: 0, maxoutbound: 30) and quote asset balance 2.5 (maxinbound: 2.4499095, maxoutbound: 2.45).
2021-01-06 06:24:44.4444 [Centralized] info: Base asset balance 0.37296423 and quote asset balance 0.01946175
2021-01-06 06:24:44.4444 [OpenDEX] trace: Replacing ETH/BTC buy order with id arby-ETH/BTC-buy-order, quantity 0.36923458 and price 0.033593425
2021-01-06 06:24:44.4444 [OpenDEX] trace: Replacing ETH/BTC sell order with id arby-ETH/BTC-sell-order, quantity 0.56493571 and price 0.034616575
2021-01-06 06:24:44.4444 [OpenDEX] trace: Creating ETH/BTC buy order with id arby-ETH/BTC-buy-order, quantity 0.36923458 and price 0.033593425
2021-01-06 06:24:44.4444 [OpenDEX] warn: 2 UNKNOWN: The number 38769630.9 cannot be converted to a BigInt because it is not an integer. Retrying in 5000ms.

This is an issue with xud and fixed in https://github.com/ExchangeUnion/xud/pull/2054

raladev commented 3 years ago
* [ ]  got convertation err
2021-01-06 06:24:38.3838 [OpenDEX] trace: Base asset balance 30 (maxinbound: 0, maxoutbound: 30) and quote asset balance 2.5 (maxinbound: 2.4499095, maxoutbound: 2.45).
2021-01-06 06:24:38.3838 [OpenDEX] trace: Replacing ETH/BTC buy order with id arby-ETH/BTC-buy-order, quantity 0.36923458 and price 0.03362593
2021-01-06 06:24:38.3838 [OpenDEX] trace: Replacing ETH/BTC sell order with id arby-ETH/BTC-sell-order, quantity 0.5643896 and price 0.03465007
2021-01-06 06:24:38.3838 [OpenDEX] trace: Creating ETH/BTC sell order with id arby-ETH/BTC-sell-order, quantity 0.5643896 and price 0.03465007
2021-01-06 06:24:38.3838 [OpenDEX] trace: Creating ETH/BTC buy order with id arby-ETH/BTC-buy-order, quantity 0.36923458 and price 0.03362593
2021-01-06 06:24:38.3838 [Centralized] info: Base asset balance 0.37296423 and quote asset balance 0.01946175
2021-01-06 06:24:39.3939 [OpenDEX] warn: 2 UNKNOWN: The number 38769630.9 cannot be converted to a BigInt because it is not an integer. Retrying in 5000ms.
2021-01-06 06:24:44.4444 [Centralized] trace: New price: 0.034105
2021-01-06 06:24:44.4444 [OpenDEX] trace: Base asset balance 30 (maxinbound: 0, maxoutbound: 30) and quote asset balance 2.5 (maxinbound: 2.4499095, maxoutbound: 2.45).
2021-01-06 06:24:44.4444 [Centralized] info: Base asset balance 0.37296423 and quote asset balance 0.01946175
2021-01-06 06:24:44.4444 [OpenDEX] trace: Replacing ETH/BTC buy order with id arby-ETH/BTC-buy-order, quantity 0.36923458 and price 0.033593425
2021-01-06 06:24:44.4444 [OpenDEX] trace: Replacing ETH/BTC sell order with id arby-ETH/BTC-sell-order, quantity 0.56493571 and price 0.034616575
2021-01-06 06:24:44.4444 [OpenDEX] trace: Creating ETH/BTC buy order with id arby-ETH/BTC-buy-order, quantity 0.36923458 and price 0.033593425
2021-01-06 06:24:44.4444 [OpenDEX] warn: 2 UNKNOWN: The number 38769630.9 cannot be converted to a BigInt because it is not an integer. Retrying in 5000ms.

This is an issue with xud and fixed in ExchangeUnion/xud#2054

got it, changed xud of master, to xud from the branch works fine with it.

raladev commented 3 years ago