qbtrade/pkg/backtest/simplepricematching_callbacks.go

38 lines
982 B
Go
Raw Normal View History

2024-06-27 14:42:38 +00:00
// Code generated by "callbackgen -type SimplePriceMatching"; DO NOT EDIT.
package backtest
import (
"git.qtrade.icu/lychiyu/qbtrade/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)
}
}