2021-05-26 17:07:38 +00:00
|
|
|
// Code generated by "callbackgen -type Stream -interface"; DO NOT EDIT.
|
|
|
|
|
|
|
|
package okex
|
|
|
|
|
2021-05-27 17:14:11 +00:00
|
|
|
import (
|
|
|
|
"github.com/c9s/bbgo/pkg/exchange/okex/okexapi"
|
|
|
|
)
|
2021-05-26 17:07:38 +00:00
|
|
|
|
2024-01-02 15:18:57 +00:00
|
|
|
func (s *Stream) OnKLineEvent(cb func(candle KLineEvent)) {
|
|
|
|
s.kLineEventCallbacks = append(s.kLineEventCallbacks, cb)
|
2021-05-26 17:07:38 +00:00
|
|
|
}
|
|
|
|
|
2024-01-02 15:18:57 +00:00
|
|
|
func (s *Stream) EmitKLineEvent(candle KLineEvent) {
|
|
|
|
for _, cb := range s.kLineEventCallbacks {
|
2021-05-27 10:35:34 +00:00
|
|
|
cb(candle)
|
2021-05-26 17:07:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-01-01 18:37:33 +00:00
|
|
|
func (s *Stream) OnBookEvent(cb func(book BookEvent)) {
|
|
|
|
s.bookEventCallbacks = append(s.bookEventCallbacks, cb)
|
2021-05-27 08:01:15 +00:00
|
|
|
}
|
|
|
|
|
2022-01-01 18:37:33 +00:00
|
|
|
func (s *Stream) EmitBookEvent(book BookEvent) {
|
|
|
|
for _, cb := range s.bookEventCallbacks {
|
2021-05-27 10:35:34 +00:00
|
|
|
cb(book)
|
2021-05-27 08:01:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-01-01 18:37:33 +00:00
|
|
|
func (s *Stream) OnAccountEvent(cb func(account okexapi.Account)) {
|
|
|
|
s.accountEventCallbacks = append(s.accountEventCallbacks, cb)
|
2021-05-27 17:14:11 +00:00
|
|
|
}
|
|
|
|
|
2022-01-01 18:37:33 +00:00
|
|
|
func (s *Stream) EmitAccountEvent(account okexapi.Account) {
|
|
|
|
for _, cb := range s.accountEventCallbacks {
|
2021-05-27 17:14:11 +00:00
|
|
|
cb(account)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-01-01 18:37:33 +00:00
|
|
|
func (s *Stream) OnOrderDetailsEvent(cb func(orderDetails []okexapi.OrderDetails)) {
|
|
|
|
s.orderDetailsEventCallbacks = append(s.orderDetailsEventCallbacks, cb)
|
2021-05-27 18:21:35 +00:00
|
|
|
}
|
|
|
|
|
2022-01-01 18:37:33 +00:00
|
|
|
func (s *Stream) EmitOrderDetailsEvent(orderDetails []okexapi.OrderDetails) {
|
|
|
|
for _, cb := range s.orderDetailsEventCallbacks {
|
2021-05-27 18:21:35 +00:00
|
|
|
cb(orderDetails)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-01-08 07:05:32 +00:00
|
|
|
func (s *Stream) OnMarketTradeEvent(cb func(tradeDetail []MarketTradeEvent)) {
|
|
|
|
s.marketTradeEventCallbacks = append(s.marketTradeEventCallbacks, cb)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *Stream) EmitMarketTradeEvent(tradeDetail []MarketTradeEvent) {
|
|
|
|
for _, cb := range s.marketTradeEventCallbacks {
|
|
|
|
cb(tradeDetail)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-05-26 17:07:38 +00:00
|
|
|
type StreamEventHub interface {
|
2024-01-02 15:18:57 +00:00
|
|
|
OnKLineEvent(cb func(candle KLineEvent))
|
2021-05-27 08:01:15 +00:00
|
|
|
|
2022-01-01 18:37:33 +00:00
|
|
|
OnBookEvent(cb func(book BookEvent))
|
2021-05-27 08:01:15 +00:00
|
|
|
|
2022-01-01 18:37:33 +00:00
|
|
|
OnAccountEvent(cb func(account okexapi.Account))
|
2021-05-27 18:21:35 +00:00
|
|
|
|
2022-01-01 18:37:33 +00:00
|
|
|
OnOrderDetailsEvent(cb func(orderDetails []okexapi.OrderDetails))
|
2024-01-08 07:05:32 +00:00
|
|
|
|
|
|
|
OnMarketTradeEvent(cb func(tradeDetail []MarketTradeEvent))
|
2021-05-26 17:07:38 +00:00
|
|
|
}
|