Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BotCfg ¶
type BotCfg struct {
Base string `json:"base"` // Base is the base currency.
Quote string `json:"quote"` // Quote is the quote currency.
PercentChangeBuy float32 `json:"percentChangeBuy"` // PercentChangeBuy is the percent change at which the bot should buy.
PercentChangeSell float32 `json:"percentChangeSell"` // PercentChangeSell is the percent change at which the bot should sell.
TrailingStopLossMargin float32 `json:"trailingStopLossMargin"` // TrailingStopLossMargin is the percent change between the current price and last buy price, at which the bot will sell to limit losses.
StopEntryPrice float32 `json:"stopEntryPrice"` // StopEntryPrice is the entry price at which the bot should buy.
StopEntryPriceMargin float32 `json:"stopEntryPriceMargin"` // StopEntryPriceMargin is the minimum percent change between the current price and the stop entry price, at which the bot will buy.
AdjustTradingBalanceProfit bool `json:"adjustTradingBalanceProfit"` // AdjustTradingBalanceProfit adds profits to the trading balance.
AdjustTradingBalanceLoss bool `json:"adjustTradingBalanceLoss"` // AdjustTradingBalanceLoss subtracts losses from the trading balance.
StopAfterTx int `json:"stopAfterTx"` // StopAfterTx stops the bot after the specified number of transaction.
MaxPriceTimestampMs int `json:"maxPriceTimestampMs"` // MaxPriceTimestampMs is the maximum valid price timestamp in milliseconds.
TradingBalance float32 `json:"tradingBalance"` // TradingBalance is the bot's trading balance.
ServerBaseEndpoint string `json:"serverBaseEndpoint"` // ServerBaseEndpoint is the Binance API base endpoint.
WsServerBaseEndpoint string `json:"wsServerBaseEndpoint"` // WsServerBaseEndpoint is the Binance Websocket base endpoint.
StateFile string `json:"stateFile"` // StateFile stores the state of the bot.
LogDb bool `json:"logDb"` // LogDb makes the bot log transaction receipts to a database.
DbBackend DbBackend `json:"dbBackend"` // DbBackend is the database backend.
DbUrl string `json:"dbUrl"` // DbUrl is the database URL.
FirstTx Tx `json:"firstTx"` // FirstTx is the type of the first transaction.
SkipFirstTx bool `json:"skipFirstTx"` // SkipFirstTx skips the first transaction.
ApiKey string `json:"apiKey"` // ApiKey is the Binance API key.
SecretKey string `json:"secretKey"` // SecretKey is the Binance secret key.
LogLevel string `json:"logLevel"` // LogLevel is the log level.
}
BotCfg is the configuration for the bot.
type State ¶
type State struct {
Data *StateData // state data.
// contains filtered or unexported fields
}
State holds the state of the bot.
type StateData ¶
type StateData struct {
Symbol string `json:"symbol"` // Symbol is the trading pair symbol.
SymbolStepSize float32 `json:"stepSize"` // SymbolStepSize is the step size of the trading pair.
LastBuyPrice float32 `json:"lastBuyPrice"` // LastBuyPrice is the last buy price.
LastSellPrice float32 `json:"lastSellPrice"` // LastSellPrice is the last sell price.
TradingBalance float32 `json:"tradingBalance"` // TradingBalance is the bot's trading balance.
StopAfterTx int `json:"stopAfterTx"` // StopAfterTx stops the bot after the specified number of transaction.
LastTx Tx `json:"lastTx"` // LastTx is the last transaction type.
}
StateData holds the state data.
Click to show internal directories.
Click to hide internal directories.