Skip to content

Commit

Permalink
Binance Withdrawals
Browse files Browse the repository at this point in the history
  • Loading branch information
martonp committed Oct 6, 2023
1 parent f389639 commit 26fe003
Show file tree
Hide file tree
Showing 7 changed files with 1,405 additions and 167 deletions.
31 changes: 24 additions & 7 deletions client/mm/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,18 @@ type CEXConfig struct {
// The balance fields are the initial amounts that will be reserved to use for
// this bot. As the bot trades, the amounts reserved for it will be updated.
type BotConfig struct {
Host string `json:"host"`
BaseAsset uint32 `json:"baseAsset"`
QuoteAsset uint32 `json:"quoteAsset"`

BaseBalanceType BalanceType `json:"baseBalanceType"`
BaseBalance uint64 `json:"baseBalance"`

Host string `json:"host"`
BaseAsset uint32 `json:"baseAsset"`
QuoteAsset uint32 `json:"quoteAsset"`
BaseBalanceType BalanceType `json:"baseBalanceType"`
BaseBalance uint64 `json:"baseBalance"`
QuoteBalanceType BalanceType `json:"quoteBalanceType"`
QuoteBalance uint64 `json:"quoteBalance"`
// CEX balance types are only applicable for arb bots.
CEXBaseBalanceType BalanceType `json:"cexBaseBalanceType"`
CEXBaseBalance uint64 `json:"cexBaseBalance"`
CEXQuoteBalanceType BalanceType `json:"cexQuoteBalanceType"`
CEXQuoteBalance uint64 `json:"cexQuoteBalance"`

// Only one of the following configs should be set
BasicMMConfig *BasicMarketMakingConfig `json:"basicMarketMakingConfig,omitempty"`
Expand All @@ -63,6 +66,20 @@ func (c *BotConfig) requiresPriceOracle() bool {
return false
}

func (c *BotConfig) requiresCEX() bool {
return c.SimpleArbConfig != nil || c.MMWithCEXConfig != nil
}

func (c *BotConfig) cexName() string {
switch {
case c.SimpleArbConfig != nil:
return c.SimpleArbConfig.CEXName
case c.MMWithCEXConfig != nil:
return ""
}
return ""
}

func dexMarketID(host string, base, quote uint32) string {
return fmt.Sprintf("%s-%d-%d", host, base, quote)
}
Loading

0 comments on commit 26fe003

Please sign in to comment.