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

client/mm: Arb Market Maker #2530

Merged
merged 3 commits into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 3 additions & 10 deletions client/mm/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,6 @@ import (
"fmt"
)

// MarketMakingWithCEXConfig is the configuration for a market
// maker that places orders on both sides of the order book, but
// only if there is profitable counter-trade on the CEX
// order book.
type MarketMakingWithCEXConfig struct {
}

type BalanceType uint8

const (
Expand Down Expand Up @@ -49,9 +42,9 @@ type BotConfig struct {
QuoteBalance uint64 `json:"quoteBalance"`

// Only one of the following configs should be set
BasicMMConfig *BasicMarketMakingConfig `json:"basicMarketMakingConfig,omitempty"`
SimpleArbConfig *SimpleArbConfig `json:"simpleArbConfig,omitempty"`
MMWithCEXConfig *MarketMakingWithCEXConfig `json:"marketMakingWithCEXConfig,omitempty"`
BasicMMConfig *BasicMarketMakingConfig `json:"basicMarketMakingConfig,omitempty"`
SimpleArbConfig *SimpleArbConfig `json:"simpleArbConfig,omitempty"`
ArbMarketMakerConfig *ArbMarketMakerConfig `json:"arbMarketMakerConfig,omitempty"`

Disabled bool `json:"disabled"`
}
Expand Down
2 changes: 1 addition & 1 deletion client/mm/libxc/binance.go
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ func (bnc *binance) requestInto(req *http.Request, thing interface{}) error {
return nil
}
// TODO: use buffered reader
reader := io.LimitReader(resp.Body, 1<<20)
reader := io.LimitReader(resp.Body, 1<<22)
r, err := io.ReadAll(reader)
if err != nil {
return err
Expand Down
16 changes: 14 additions & 2 deletions client/mm/mm.go
Original file line number Diff line number Diff line change
Expand Up @@ -980,14 +980,26 @@ func (m *MarketMaker) Run(ctx context.Context, pw []byte, alternateConfigPath *s
wg.Add(1)
go func(cfg *BotConfig) {
defer wg.Done()
logger := m.log.SubLogger(fmt.Sprintf("Arbitrage-%s-%d-%d", cfg.Host, cfg.BaseAsset, cfg.QuoteAsset))
logger := m.log.SubLogger(fmt.Sprintf("SimpleArbitrage-%s-%d-%d", cfg.Host, cfg.BaseAsset, cfg.QuoteAsset))
cex, err := getConnectedCEX(cfg.SimpleArbConfig.CEXName)
if err != nil {
logger.Errorf("failed to connect to CEX: %v", err)
logger.Errorf("Failed to connect to CEX: %v", err)
return
}
RunSimpleArbBot(m.ctx, cfg, m.core, cex, logger)
}(cfg)
case cfg.ArbMarketMakerConfig != nil:
wg.Add(1)
go func(cfg *BotConfig) {
defer wg.Done()
logger := m.log.SubLogger(fmt.Sprintf("ArbMarketMaker-%s-%d-%d", cfg.Host, cfg.BaseAsset, cfg.QuoteAsset))
cex, err := getConnectedCEX(cfg.ArbMarketMakerConfig.CEXName)
if err != nil {
logger.Errorf("Failed to connect to CEX: %v", err)
return
}
RunArbMarketMaker(m.ctx, cfg, m.core, cex, logger)
}(cfg)
default:
m.log.Errorf("No bot config provided. Skipping %s-%d-%d", cfg.Host, cfg.BaseAsset, cfg.QuoteAsset)
}
Expand Down
Loading
Loading