mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-26 08:45:16 +00:00
types: modify Positions to FuturesPositions
This commit is contained in:
parent
5cc768031e
commit
3d63032f7d
|
@ -124,23 +124,23 @@ func (stream *StandardStream) EmitBookSnapshot(book SliceOrderBook) {
|
|||
}
|
||||
}
|
||||
|
||||
func (stream *StandardStream) OnPositionUpdate(cb func(position PositionMap)) {
|
||||
stream.PositionUpdateCallbacks = append(stream.PositionUpdateCallbacks, cb)
|
||||
func (stream *StandardStream) OnFuturesPositionUpdate(cb func(futuresPositions FuturesPositionMap)) {
|
||||
stream.FuturesPositionUpdateCallbacks = append(stream.FuturesPositionUpdateCallbacks, cb)
|
||||
}
|
||||
|
||||
func (stream *StandardStream) EmitPositionUpdate(position PositionMap) {
|
||||
for _, cb := range stream.PositionUpdateCallbacks {
|
||||
cb(position)
|
||||
func (stream *StandardStream) EmitFuturesPositionUpdate(futuresPositions FuturesPositionMap) {
|
||||
for _, cb := range stream.FuturesPositionUpdateCallbacks {
|
||||
cb(futuresPositions)
|
||||
}
|
||||
}
|
||||
|
||||
func (stream *StandardStream) OnPositionSnapshot(cb func(position PositionMap)) {
|
||||
stream.PositionSnapshotCallbacks = append(stream.PositionSnapshotCallbacks, cb)
|
||||
func (stream *StandardStream) OnFuturesPositionSnapshot(cb func(futuresPositions FuturesPositionMap)) {
|
||||
stream.FuturesPositionSnapshotCallbacks = append(stream.FuturesPositionSnapshotCallbacks, cb)
|
||||
}
|
||||
|
||||
func (stream *StandardStream) EmitPositionSnapshot(position PositionMap) {
|
||||
for _, cb := range stream.PositionSnapshotCallbacks {
|
||||
cb(position)
|
||||
func (stream *StandardStream) EmitFuturesPositionSnapshot(futuresPositions FuturesPositionMap) {
|
||||
for _, cb := range stream.FuturesPositionSnapshotCallbacks {
|
||||
cb(futuresPositions)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -169,7 +169,7 @@ type StandardStreamEventHub interface {
|
|||
|
||||
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))
|
||||
}
|
||||
|
|
|
@ -62,9 +62,9 @@ type StandardStream struct {
|
|||
bookSnapshotCallbacks []func(book SliceOrderBook)
|
||||
|
||||
// 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) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user