Documentation ¶
Index ¶
- func ByBitSymbolToTopic(symbol string) string
- func GetBinanceParser(rawData []byte) (any, error)
- func InitLogger(logger *logrus.Logger, config *configs.LogConfig) (err error)
- func NewPublisherMap(publishers []configs.PublisherConfig) map[string]*shm.Publisher
- func NewSubscribeMap(subscribes []string) map[string][]string
- func NewSubscribeMap2(subscribes map[string]*instrument, category string) map[string][]string
- func NewSubscriberMap(publishers []configs.PublisherConfig) map[string]*shm.Subscriber
- func SymbolToTopic(symbol string) string
- func WaitForClose(log *logrus.Logger, ctx context.Context)
- func WithBinanceMessageHandler(wsCfg *configs.WsClientConfig, logger *logrus.Logger) func([]byte)
- func WithBybitMessageHandler(wsCfg *configs.WsClientConfig, logger *logrus.Logger, ...) func([]byte)
- func WithErrorHandler(logger *logrus.Logger) func(error)
- func WithOrderBookHandler(logger *logrus.Logger, writer IWriter) func([]byte)
- func WithTickerHandler(logger *logrus.Logger, writer IWriter) func([]byte)
- func WithTradeHandler(logger *logrus.Logger, writer IWriter) func([]byte)
- type IQuoteEngine
- type IWriter
- type IWsAgent
- type MsgHandle
- type QuoteEngine
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ByBitSymbolToTopic ¶
將 bybit 的 symbol的綴詞 轉換成 topic,如果不符合任何規則,則回傳原本的 symbol
func GetBinanceParser ¶
func NewPublisherMap ¶
func NewPublisherMap(publishers []configs.PublisherConfig) map[string]*shm.Publisher
func NewSubscribeMap ¶
func NewSubscribeMap2 ¶
func NewSubscriberMap ¶
func NewSubscriberMap(publishers []configs.PublisherConfig) map[string]*shm.Subscriber
func SymbolToTopic ¶
func WithBinanceMessageHandler ¶
func WithBinanceMessageHandler(wsCfg *configs.WsClientConfig, logger *logrus.Logger) func([]byte)
life time is infinity
func WithBybitMessageHandler ¶
func WithBybitMessageHandler(wsCfg *configs.WsClientConfig, logger *logrus.Logger, pub_map map[string]*shm.Publisher) func([]byte)
給定 WsClientConfig 和 logger 生成一個 bybit 的 message handler 的 closure,
func WithErrorHandler ¶
func WithOrderBookHandler ¶
Types ¶
type IQuoteEngine ¶
type IQuoteEngine interface {
Luanch()
}
func NewQuoteEngine ¶
func NewQuoteEngine(cfg *configs.WsClientConfig, logger *logrus.Logger) (engine IQuoteEngine)
type MsgHandle ¶
func GetBinancePubMap(rawData []byte) (map[string]*shm.Publisher, error) { v := fastjson.MustParseBytes(rawData) topic := string(v.GetStringBytes("e")) tradeExp := regexp.MustCompile(`Trade`) switch { case tradeExp.MatchString(topic): return data_stream.ToNormalTradeData(rawData) default: return nil, fmt.Errorf("topic %s not found", topic) } }
type QuoteEngine ¶
type QuoteEngine[WS any] struct { Logger *logrus.Logger Ws map[string]*WS Api *bybit_http.ByBitClient DoneSignal chan struct{} SubscribeMap map[string][]string }
func (*QuoteEngine[WS]) GetInstruments ¶
func (qe *QuoteEngine[WS]) GetInstruments() map[string]*instrument
Click to show internal directories.
Click to hide internal directories.