Documentation ¶
Index ¶
Constants ¶
const ID = "skeleton"
ID is the unique strategy ID, it needs to be in all lower case For example, grid strategy uses "grid"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type State ¶
type State struct {
Counter int `json:"counter,omitempty"`
}
State is a struct contains the information that we want to keep in the persistence layer, for example, redis or json file.
type Strategy ¶
type Strategy struct { Symbol string `json:"symbol"` // State is a state of your strategy // When BBGO shuts down, everything in the memory will be dropped // If you need to store something and restore this information back, // Simply define the "persistence" tag State *State `persistence:"state"` }
Strategy is a struct that contains the settings of your strategy. These settings will be loaded from the BBGO YAML config file "bbgo.yaml" automatically.
func (*Strategy) InstanceID ¶
InstanceID returns the identity of the current instance of this strategy. You may have multiple instance of a strategy, with different symbols and settings. This value will be used for persistence layer to separate the storage.
Run:
redis-cli KEYS "*"
And you will see how this instance ID is used in redis.
func (*Strategy) Run ¶
func (s *Strategy) Run(ctx context.Context, orderExecutor bbgo.OrderExecutor, session *bbgo.ExchangeSession) error
This strategy simply spent all available quote currency to buy the symbol whenever kline gets closed
func (*Strategy) Subscribe ¶
func (s *Strategy) Subscribe(session *bbgo.ExchangeSession)
Subscribe method subscribes specific market data from the given session. Before BBGO is connected to the exchange, we need to collect what we want to subscribe. Here the strategy needs kline data, so it adds the kline subscription.