bbgo/pkg/backtest/simplepricematching_callbacks.go

38 lines
979 B
Go
Raw Normal View History

// Code generated by "callbackgen -type SimplePriceMatching"; DO NOT EDIT.
package backtest
import (
"git.qtrade.icu/lychiyu/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)
}
}