mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-14 02:53:50 +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)) {
|
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))
|
||||||
}
|
}
|
||||||
|
|
|
@ -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) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user