types: modify Positions to FuturesPositions

This commit is contained in:
austin362667 2021-12-30 21:44:29 +08:00
parent 5cc768031e
commit 3d63032f7d
2 changed files with 14 additions and 14 deletions

View File

@ -124,23 +124,23 @@ func (stream *StandardStream) EmitBookSnapshot(book SliceOrderBook) {
} }
} }
func (stream *StandardStream) OnPositionUpdate(cb func(position PositionMap)) { func (stream *StandardStream) OnFuturesPositionUpdate(cb func(futuresPositions FuturesPositionMap)) {
stream.PositionUpdateCallbacks = append(stream.PositionUpdateCallbacks, cb) stream.FuturesPositionUpdateCallbacks = append(stream.FuturesPositionUpdateCallbacks, cb)
} }
func (stream *StandardStream) EmitPositionUpdate(position PositionMap) { func (stream *StandardStream) EmitFuturesPositionUpdate(futuresPositions FuturesPositionMap) {
for _, cb := range stream.PositionUpdateCallbacks { for _, cb := range stream.FuturesPositionUpdateCallbacks {
cb(position) cb(futuresPositions)
} }
} }
func (stream *StandardStream) OnPositionSnapshot(cb func(position PositionMap)) { func (stream *StandardStream) OnFuturesPositionSnapshot(cb func(futuresPositions FuturesPositionMap)) {
stream.PositionSnapshotCallbacks = append(stream.PositionSnapshotCallbacks, cb) stream.FuturesPositionSnapshotCallbacks = append(stream.FuturesPositionSnapshotCallbacks, cb)
} }
func (stream *StandardStream) EmitPositionSnapshot(position PositionMap) { func (stream *StandardStream) EmitFuturesPositionSnapshot(futuresPositions FuturesPositionMap) {
for _, cb := range stream.PositionSnapshotCallbacks { for _, cb := range stream.FuturesPositionSnapshotCallbacks {
cb(position) cb(futuresPositions)
} }
} }
@ -169,7 +169,7 @@ type StandardStreamEventHub interface {
OnBookSnapshot(cb func(book SliceOrderBook)) OnBookSnapshot(cb func(book SliceOrderBook))
OnPositionUpdate(cb func(position PositionMap)) OnFuturesPositionUpdate(cb func(futuresPositions FuturesPositionMap))
OnPositionSnapshot(cb func(position PositionMap)) OnFuturesPositionSnapshot(cb func(futuresPositions FuturesPositionMap))
} }

View File

@ -62,9 +62,9 @@ type StandardStream struct {
bookSnapshotCallbacks []func(book SliceOrderBook) bookSnapshotCallbacks []func(book SliceOrderBook)
// Futures // Futures
PositionUpdateCallbacks []func(position PositionMap) FuturesPositionUpdateCallbacks []func(futuresPositions FuturesPositionMap)
PositionSnapshotCallbacks []func(position PositionMap) FuturesPositionSnapshotCallbacks []func(futuresPositions FuturesPositionMap)
} }
func (stream *StandardStream) Subscribe(channel Channel, symbol string, options SubscribeOptions) { func (stream *StandardStream) Subscribe(channel Channel, symbol string, options SubscribeOptions) {