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

mm: balance accounting is broken in some way #3133

Open
norwnd opened this issue Jan 1, 2025 · 9 comments
Open

mm: balance accounting is broken in some way #3133

norwnd opened this issue Jan 1, 2025 · 9 comments

Comments

@norwnd
Copy link
Contributor

norwnd commented Jan 1, 2025

I've noticed the balance accounting for MM bot sometimes shows negative value for Available balance on "Market Maker Settings" page

image

and if I try to run the bot the following mirroring error shows up in logs (note screenshot and this log line are from different bot-runs hence those negative values are different):

2025-01-01 09:07:03.630 [DBG] WEB: failed to unmarshal JSON request: json: cannot unmarshal number -350901503 into Go struct field BotBalanceAllocation.config.alloc.dex of type uint64
2025-01-01 09:07:03.630 [DBG] WEB: raw request: {"config":{"baseID":966001,"quoteID":966004,"host":"dex.decred.org:7232","alloc":{"dex":{"966":193490918775,"966001":-350901503,"966004":155390},"cex":{"966001":0,"966004":0}}}}
2025-01-01 09:07:03.630 [ERR] WEB: failed to read form
2025-01-01 09:07:03.631 [TRC] MUX: "POST http://127.0.0.1:3333/api/startmarketmakingbot HTTP/1.1" from 127.0.0.1:49509 - 400 74B in 476.375µs

this happens when I have DCR-USDC bot running and I navigate to USDC-USDT bot - so both bots use USDC and hence somehow interfere with each other.

@dev-warrior777
Copy link
Contributor

May I ask ..

  • Is this only for USDC or any coin, or maybe any EVM coin?
  • Should they not (interfere) keep track of total balance of the funding wallet?

I am running DCR-USDT and USDC-USDT mm bots and I see no negative values yet on the Market Maker Settings page when I try to create a third bot for DCR-USDC and I am close to using all the funds in the funding wallets.

Anyway I will leave the 2 bots running overnight and look tomorrow

@dev-warrior777
Copy link
Contributor

dev-warrior777 commented Jan 15, 2025

What I do see often on the running MM page is:

Profit | -0.00%

.. although sadly I never made profit so am unable to drill down on that although I suspect it may perhaps be a formatting issue in the JS.

@dev-warrior777
Copy link
Contributor

Note: I am running on master as updated today 333e9f6

@dev-warrior777
Copy link
Contributor

I am running DCR-USDT and USDC-USDT mm bots and I see no negative values yet on the Market Maker Settings page when I try to create a third bot for DCR-USDC and I am close to using all the funds in the funding wallets.

Anyway I will leave the 2 bots running overnight and look tomorrow

What I see with running 2 bots when looking to make a third bot for USDC-USDT:

Market Maker Settings:

image
image

@norwnd
Copy link
Contributor Author

norwnd commented Jan 16, 2025

What I see with running 2 bots when looking to make a third bot for USDC-USDT

That looks similar to what I saw,

I don't know if it is limited to EVM-based assets or if MM bot keeps track of balances on his own and doesn't account for something.

@dev-warrior777
Copy link
Contributor

"I don't know if it is limited to EVM-based assets or ..."

I think we can assume any coin for now since we reproduced on 2 already .. thanks.

@dev-warrior777
Copy link
Contributor

and if I try to run the bot the following mirroring error shows up in logs

Do you have the full log or at least the core lines leading up to the above trace? Unfortunately the errors captured at the web-server level are very general.

@norwnd
Copy link
Contributor Author

norwnd commented Jan 18, 2025

Unfortunately the errors captured at the web-server level are very general.

Exactly, I don't see anything relevant to this issue in my own logs (so not sharing - also since it'd be hard to anonymize those)

@norwnd
Copy link
Contributor Author

norwnd commented Jan 20, 2025

Different from the issue described above (but possibly related in some way),

(cc @martonp) today I'm observing a bunch of "negative dex balance" MM bot errors with BTC-DCR market:

2025-01-20 20:58:46.031 [ERR] MM[MM-dex.decred.org:7232-42-0]: negative dex balance for btc: -289870
2025-01-20 20:58:46.031 [ERR] MM[MM-dex.decred.org:7232-42-0]: negative dex balance for btc: -289870
2025-01-20 20:58:46.031 [ERR] MM[MM-dex.decred.org:7232-42-0]: negative dex balance for btc: -289870
2025-01-20 20:58:46.032 [ERR] MM[MM-dex.decred.org:7232-42-0]: negative dex balance for btc: -289870
2025-01-20 20:58:46.032 [ERR] MM[MM-dex.decred.org:7232-42-0]: negative dex balance for btc: -289870

and it doesn't seem to affect bot operations in any noticeable way,

after stopping & starting bot again via UI the error appears again in logs (but negative value reported is somewhat different):

2025-01-20 22:22:15.432 [ERR] MM[MM-dex.decred.org:7232-42-0]: negative dex balance for btc: -273623
2025-01-20 22:22:15.432 [ERR] MM[MM-dex.decred.org:7232-42-0]: negative dex balance for btc: -273623
2025-01-20 22:22:15.432 [ERR] MM[MM-dex.decred.org:7232-42-0]: negative dex balance for btc: -273623
2025-01-20 22:22:15.432 [ERR] MM[MM-dex.decred.org:7232-42-0]: negative dex balance for btc: -273623
2025-01-20 22:22:15.432 [ERR] MM[MM-dex.decred.org:7232-42-0]: negative dex balance for btc: -273623

what's curious is it seems that same value shows as "profit" (with positive sign):

Image

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

No branches or pull requests

2 participants