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: dynamic minimum quantity #130

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ghost
Copy link

@ghost ghost commented Jan 5, 2021

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.

@ghost ghost force-pushed the feat/dynamic-minimum-quantity branch from 7b2228e to 0cf6ef5 Compare January 6, 2021 14:33
@ghost ghost marked this pull request as ready for review January 6, 2021 14:34
@ghost ghost changed the title wip: dynamic minimum quantity feat: dynamic minimum quantity Jan 6, 2021
@ghost ghost requested a review from raladev January 6, 2021 14:39
Copy link
Contributor

@raladev raladev left a comment

Choose a reason for hiding this comment

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

  • 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.

@ghost
Copy link
Author

ghost commented Jan 7, 2021

* [ ]  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

@raladev
Copy link
Contributor

raladev commented Jan 7, 2021

* [ ]  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
Copy link
Contributor

raladev commented Jan 7, 2021

  • got err during CEX order placement, looks like it connected with min qty (because of 2 digit)
2021-01-07 04:01:45.4545 [Centralized] info: Swap success. Accumulated ETH quantity: 0.0012
2021-01-07 04:01:45.4545 [Centralized] trace: New price: 0.032066
2021-01-07 04:01:45.4545 [OpenDEX] trace: Replacing ETH/BTC buy order with id arby-ETH/BTC-buy-order, quantity 0.36923458 and price 0.03158501
2021-01-07 04:01:45.4545 [OpenDEX] trace: Replacing ETH/BTC sell order with id arby-ETH/BTC-sell-order, quantity 0.60085861 and price 0.03254699
2021-01-07 04:01:45.4545 [Centralized] info: Starting centralized exchange ETH/BTC market sell order (quantity: 0.0012)
2021-01-07 04:01:45.4545 [OpenDEX] trace: Order arby-ETH/BTC-buy-order created
2021-01-07 04:01:45.4545 [Centralized] trace: New price: 0.032065
2021-01-07 04:01:46.4646 [Centralized] trace: New price: 0.032064
2021-01-07 04:01:46.4646 [OpenDEX] trace: Order arby-ETH/BTC-sell-order created
2021-01-07 04:01:46.4646 [Centralized] warn: Failed to execute CEX order: InvalidOrder: binance {"code":-1013,"msg":"Filter failure: MIN_NOTIONAL"}. Retrying in 1000ms
2021-01-07 04:01:46.4646 [Centralized] trace: New price: 0.032063
2021-01-07 04:01:46.4646 [Centralized] trace: New price: 0.032058
2021-01-07 04:01:46.4646 [Centralized] trace: New price: 0.032059
2021-01-07 04:01:46.4646 [Centralized] trace: New price: 0.032058
2021-01-07 04:01:47.4747 [Centralized] trace: New price: 0.032057
2021-01-07 04:01:47.4747 [Centralized] trace: New price: 0.032055
2021-01-07 04:01:47.4747 [Centralized] trace: New price: 0.032056
2021-01-07 04:01:47.4747 [Centralized] warn: Failed to execute CEX order: InvalidOrder: binance {"code":-1013,"msg":"Filter failure: MIN_NOTIONAL"}. Retrying in 1000ms
2021-01-07 04:01:47.4747 [Centralized] trace: New price: 0.032055
2021-01-07 04:01:47.4747 [Centralized] trace: New price: 0.032056
2021-01-07 04:01:47.4747 [Centralized] trace: New price: 0.032055
2021-01-07 04:01:47.4747 [Centralized] trace: New price: 0.032056
2021-01-07 04:01:48.4848 [Centralized] trace: New price: 0.032057
2021-01-07 04:01:48.4848 [Centralized] trace: New price: 0.032058
2021-01-07 04:01:48.4848 [Centralized] warn: Failed to execute CEX order: InvalidOrder: binance {"code":-1013,"msg":"Filter failure: MIN_NOTIONAL"}. Retrying in 1000ms
2021-01-07 04:01:48.4848 [Centralized] trace: New price: 0.03206
2021-01-07 04:01:49.4949 [Centralized] trace: New price: 0.032062
2021-01-07 04:01:49.4949 [Centralized] trace: New price: 0.03206

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.

1 participant