Documentation ¶
Overview ¶
Package trader provides an API for building trading bots. A bot receives prices and execute orders with a broker. Child packages offer specific bot implementations.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrInvalidConfig = errors.New("invalid bot config")
ErrInvalidConfig is returned by MakeFromConfig.
Functions ¶
This section is empty.
Types ¶
type Bot ¶
type Bot interface { // Warmup the indicators used by the bot with historical data prior to active trading. // The amount of price data required is typically equivalent to the longest lookback. Warmup(context.Context, []market.Kline) error // Sets the dealer to be used for order execution. SetDealer(broker.Dealer) // Receive gives the bot the next market price and evaluates the algo, // potentially generating new broker orders. market.Receiver // Clean-up the bot before close down, e.g. close open positions. Close(context.Context) error }
Bot is the primary interface for a trading algo.
type MakeFromConfig ¶
MakeFromConfig is a factory for building a tailored bot from a given config. Used by the optimize package to mint new bots for backtesting.
type Predicter ¶
type Predicter interface { market.Receiver // Predict gives a confidence score between -1 (short) and +1 (long) that a // bot uses to generate buy and sell signals. Predict() float64 // Valid indicates readiness for prediction. Valid() bool }
Predicter is used by a bot to indicate price direction. Child packages provide specific prediction implementations.
Click to show internal directories.
Click to hide internal directories.