mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-22 14:55:16 +00:00
add exists method for active book
This commit is contained in:
parent
0a908e5dda
commit
289227e5f3
|
@ -111,6 +111,21 @@ func (b *LocalActiveOrderBook) NumOfAsks() int {
|
|||
return b.Asks.Len()
|
||||
}
|
||||
|
||||
func (b *LocalActiveOrderBook) Exists(order types.Order) bool {
|
||||
|
||||
switch order.Side {
|
||||
|
||||
case types.SideTypeBuy:
|
||||
return b.Bids.Exists(order.OrderID)
|
||||
|
||||
case types.SideTypeSell:
|
||||
return b.Asks.Exists(order.OrderID)
|
||||
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
func (b *LocalActiveOrderBook) Remove(order types.Order) bool {
|
||||
switch order.Side {
|
||||
case types.SideTypeBuy:
|
||||
|
|
Loading…
Reference in New Issue
Block a user