bbgo_origin/pkg/backtest/simplepricematching_callbacks.go

38 lines
971 B
Go
Raw Permalink Normal View History

// Code generated by "callbackgen -type SimplePriceMatching"; DO NOT EDIT.
package backtest
import (
"github.com/c9s/bbgo/pkg/types"
)
func (m *SimplePriceMatching) OnTradeUpdate(cb func(trade types.Trade)) {
m.tradeUpdateCallbacks = append(m.tradeUpdateCallbacks, cb)
}
func (m *SimplePriceMatching) EmitTradeUpdate(trade types.Trade) {
for _, cb := range m.tradeUpdateCallbacks {
cb(trade)
}
}
func (m *SimplePriceMatching) OnOrderUpdate(cb func(order types.Order)) {
m.orderUpdateCallbacks = append(m.orderUpdateCallbacks, cb)
}
func (m *SimplePriceMatching) EmitOrderUpdate(order types.Order) {
for _, cb := range m.orderUpdateCallbacks {
cb(order)
}
}
2020-11-10 06:18:04 +00:00
func (m *SimplePriceMatching) OnBalanceUpdate(cb func(balances types.BalanceMap)) {
m.balanceUpdateCallbacks = append(m.balanceUpdateCallbacks, cb)
}
2020-11-10 06:18:04 +00:00
func (m *SimplePriceMatching) EmitBalanceUpdate(balances types.BalanceMap) {
for _, cb := range m.balanceUpdateCallbacks {
cb(balances)
}
}