-
Notifications
You must be signed in to change notification settings - Fork 149
mm: Market Making RPC fixes #3492
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
base: master
Are you sure you want to change the base?
Conversation
martonp
commented
Jan 24, 2026
- Allow starting / stopping all bots in config file
- Make stopping async so that RPC command doesn't time out
- Update UI to support new async bot stopping
- Export RPC config
- Allow starting / stopping all bots in config file - Make stopping async so that RPC command doesn't time out - Update UI to support new async bot stopping - Export RPC config
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trying to start bots with the config on simnet. Command should be like this?
./bwctl -p abc --simnet startmmbot /home/joe/.dexc/simnet/mm_cfg.json
Gives me an error and seems to panic.
panic
2026/01/26 15:58:42 http: panic serving 127.0.0.1:47534: runtime error: slice bounds out of range [-1:]
goroutine 12292 [running]:
net/http.(*conn).serve.func1()
/usr/lib/go/src/net/http/server.go:1943 +0xd3
panic({0x1d37720?, 0xc0009d0e58?})
/usr/lib/go/src/runtime/panic.go:783 +0x132
github.com/go-chi/chi/v5/middleware.prettyStack.decorateFuncCallLine({}, {0xc00287a195, 0x1f}, 0x1, 0x6)
/home/joe/go/pkg/mod/github.com/go-chi/chi/v5@v5.0.1/middleware/recoverer.go:130 +0x525
github.com/go-chi/chi/v5/middleware.prettyStack.decorateLine({}, {0xc00287a195?, 0xe76?}, 0x1, 0x6)
/home/joe/go/pkg/mod/github.com/go-chi/chi/v5@v5.0.1/middleware/recoverer.go:106 +0x154
github.com/go-chi/chi/v5/middleware.prettyStack.parse({}, {0xc00284f000, 0xe76, 0xc00286aeb0?}, {0x1b431c0, 0x3967600})
/home/joe/go/pkg/mod/github.com/go-chi/chi/v5@v5.0.1/middleware/recoverer.go:89 +0x40a
github.com/go-chi/chi/v5/middleware.PrintPrettyStack({0x1b431c0, 0x3967600})
/home/joe/go/pkg/mod/github.com/go-chi/chi/v5@v5.0.1/middleware/recoverer.go:46 +0x3b
github.com/go-chi/chi/v5/middleware.Recoverer.func1.1()
/home/joe/go/pkg/mod/github.com/go-chi/chi/v5@v5.0.1/middleware/recoverer.go:30 +0xed
panic({0x1b431c0?, 0x3967600?})
/usr/lib/go/src/runtime/panic.go:783 +0x132
decred.org/dcrdex/client/mm.(*MarketMaker).balancesSufficient(0x22?, 0x0, 0x80344a22?, 0x4?, 0xc01e69e138?)
/home/joe/git/dcrdex/client/mm/mm.go:734 +0x95
decred.org/dcrdex/client/mm.(*MarketMaker).startBot(0xc00064d1e0, 0xc00511dcb0, 0xc002af2b40, 0x0, {0xc000c48588, 0x3, 0x3})
/home/joe/git/dcrdex/client/mm/mm.go:949 +0x7f
decred.org/dcrdex/client/mm.(*MarketMaker).StartBot(0xc00064d1e0, 0xc00511dcb0, 0xc00511dbd8, {0xc000c48588, 0x3, 0x3}, 0x1)
/home/joe/git/dcrdex/client/mm/mm.go:944 +0x6d6
decred.org/dcrdex/client/mm.(*MarketMaker).StartBots(0xc00064d1e0, 0xc00511dbd8, {0xc000c48588, 0x3, 0x3})
/home/joe/git/dcrdex/client/mm/mm.go:1060 +0x23c
decred.org/dcrdex/client/rpcserver.handleStartBot(0xc00046e630, 0x40?)
/home/joe/git/dcrdex/client/rpcserver/handlers.go:923 +0x199
decred.org/dcrdex/client/rpcserver.(*RPCServer).handleRequest(0xc00046e630, 0xc00069cb40)
/home/joe/git/dcrdex/client/rpcserver/rpcserver.go:351 +0x274
decred.org/dcrdex/client/rpcserver.(*RPCServer).parseHTTPRequest(0xc00284a800?, {0x2aa3e90, 0xc000260ff0}, 0xc00069cb40)
/home/joe/git/dcrdex/client/rpcserver/rpcserver.go:357 +0x2f
decred.org/dcrdex/client/rpcserver.(*RPCServer).handleJSON(0xc00046e630, {0x2aa3e90, 0xc000260ff0}, 0xc002840640)
/home/joe/git/dcrdex/client/rpcserver/rpcserver.go:196 +0x27e
net/http.HandlerFunc.ServeHTTP(0x1b93120?, {0x2aa3e90?, 0xc000260ff0?}, 0xc00053e3a5?)
/usr/lib/go/src/net/http/server.go:2322 +0x29
github.com/go-chi/chi/v5.(*Mux).routeHTTP(0xc0002ac720, {0x2aa3e90, 0xc000260ff0}, 0xc002840640)
/home/joe/go/pkg/mod/github.com/go-chi/chi/v5@v5.0.1/mux.go:437 +0x1f2
net/http.HandlerFunc.ServeHTTP(0xc0020c1de0?, {0x2aa3e90?, 0xc000260ff0?}, 0xc003c39950?)
/usr/lib/go/src/net/http/server.go:2322 +0x29
decred.org/dcrdex/client/rpcserver.(*RPCServer).authMiddleware-fm.(*RPCServer).authMiddleware.func1({0x2aa3e90, 0xc000260ff0}, 0xc002840640)
/home/joe/git/dcrdex/client/rpcserver/rpcserver.go:387 +0x1bb
net/http.HandlerFunc.ServeHTTP(0xc002840640?, {0x2aa3e90?, 0xc000260ff0?}, 0xc001fdb790?)
/usr/lib/go/src/net/http/server.go:2322 +0x29
github.com/go-chi/chi/v5/middleware.RealIP.func1({0x2aa3e90, 0xc000260ff0}, 0xc002840640)
/home/joe/go/pkg/mod/github.com/go-chi/chi/v5@v5.0.1/middleware/realip.go:34 +0x95
net/http.HandlerFunc.ServeHTTP(0x7f6f9325b5c0?, {0x2aa3e90?, 0xc000260ff0?}, 0xc002840640?)
/usr/lib/go/src/net/http/server.go:2322 +0x29
github.com/go-chi/chi/v5/middleware.Recoverer.func1({0x2aa3e90?, 0xc000260ff0?}, 0x3969001?)
/home/joe/go/pkg/mod/github.com/go-chi/chi/v5@v5.0.1/middleware/recoverer.go:37 +0x6c
net/http.HandlerFunc.ServeHTTP(0x2aa61b0?, {0x2aa3e90?, 0xc000260ff0?}, 0x39690f0?)
/usr/lib/go/src/net/http/server.go:2322 +0x29
github.com/go-chi/chi/v5.(*Mux).ServeHTTP(0xc0002ac720, {0x2aa3e90, 0xc000260ff0}, 0xc00276e500)
/home/joe/go/pkg/mod/github.com/go-chi/chi/v5@v5.0.1/mux.go:88 +0x2ee
net/http.serverHandler.ServeHTTP({0x2aa08a0?}, {0x2aa3e90?, 0xc000260ff0?}, 0x1?)
/usr/lib/go/src/net/http/server.go:3340 +0x8e
net/http.(*conn).serve(0xc001fb6cf0, {0x2aa6178, 0xc000894330})
/usr/lib/go/src/net/http/server.go:2109 +0x665
created by net/http.(*Server).Serve in goroutine 67
/usr/lib/go/src/net/http/server.go:3493 +0x485
Bot cfg was created by starting the bot via ui.
bot config
{
"botConfigs": [
{
"host": "127.0.0.1:17273",
"baseID": 42,
"quoteID": 60,
"baseWalletOptions": {
"multisplit": "true"
},
"quoteWalletOptions": {},
"cexName": "",
"cexBaseID": 42,
"cexQuoteID": 60,
"uiConfig": {
"allocation": {
"dex": {
"42": 12002962740,
"60": 1199190972
},
"cex": {}
},
"quickBalance": {
"buysBuffer": 0,
"sellsBuffer": 0,
"buyFeeReserve": 0,
"sellFeeReserve": 0,
"bridgeFeeReserve": 1,
"slippageBuffer": 5
},
"usingQuickBalance": true,
"internalTransfers": true,
"baseMinTransfer": 0,
"quoteMinTransfer": 0,
"cexRebalance": false
},
"rpcConfig": null,
"lotSize": 1000000000,
"basicMarketMakingConfig": {
"gapStrategy": "percent-plus",
"sellPlacements": [
{
"lots": 3,
"gapFactor": 0.02
},
{
"lots": 3,
"gapFactor": 0.025
},
{
"lots": 3,
"gapFactor": 0.03
},
{
"lots": 3,
"gapFactor": 0.035
}
],
"buyPlacements": [
{
"lots": 3,
"gapFactor": 0.02
},
{
"lots": 3,
"gapFactor": 0.025
},
{
"lots": 3,
"gapFactor": 0.03
},
{
"lots": 3,
"gapFactor": 0.035
}
],
"driftTolerance": 0.002
}
}
],
"cexConfigs": []
}
|
probably because you have the UI config set, and not the rpc config. they are separate things for some reason. i already had mentioned it would be nice to have a single config. but until that point, this rpc method needs to return an error when the rpc config is unset/incomplete, not panic. |
|
I've deprecated the RPCConfig. Maybe we could just remove it. |
|
removing it would be fine by me. what about the UIConfig? is there anything in there that couldn't be put into the Alloc and AutoRebalance fields? (i'd hope not, or those same settings would be unavailable via rpc) |
|
my current understanding of the UIConfig is that, in addition to actual settings that affect the bot's behavior (these should be moved to the Alloc/AutoRebalance fields), it also includes some GUI state to populate the settings page when it is opened. I'd be ok with leaving those in the UI config (and perhaps even leaving it as a json.RawMessage) as long as it only contains extra state to present in the UI without actually affecting the bot's behavior. |
The way it is currently, nothing in the |