bbgo_origin/pkg/backtest/simplepricematching_callbacks.go
2020-11-10 14:18:04 +08:00

38 lines
971 B
Go

// 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)
}
}
func (m *SimplePriceMatching) OnBalanceUpdate(cb func(balances types.BalanceMap)) {
m.balanceUpdateCallbacks = append(m.balanceUpdateCallbacks, cb)
}
func (m *SimplePriceMatching) EmitBalanceUpdate(balances types.BalanceMap) {
for _, cb := range m.balanceUpdateCallbacks {
cb(balances)
}
}