mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-26 00:35:15 +00:00
pkg/exchange: fix okex bookticker bug
This commit is contained in:
parent
6f4f1ad558
commit
594ab9cbaf
|
@ -65,17 +65,21 @@ type BookEvent struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (data *BookEvent) BookTicker() types.BookTicker {
|
func (data *BookEvent) BookTicker() types.BookTicker {
|
||||||
|
ticker := types.BookTicker{
|
||||||
var askBookData BookEntry = data.Asks[0]
|
Symbol: data.Symbol,
|
||||||
var bidBookData BookEntry = data.Bids[0]
|
|
||||||
|
|
||||||
return types.BookTicker{
|
|
||||||
Symbol: data.Symbol,
|
|
||||||
Buy: bidBookData.Price,
|
|
||||||
BuySize: bidBookData.Price,
|
|
||||||
Sell: askBookData.Price,
|
|
||||||
SellSize: askBookData.Volume,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(data.Bids) > 0 {
|
||||||
|
ticker.Buy = data.Bids[0].Price
|
||||||
|
ticker.BuySize = data.Bids[0].Volume
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(data.Asks) > 0 {
|
||||||
|
ticker.Sell = data.Asks[0].Price
|
||||||
|
ticker.SellSize = data.Asks[0].Volume
|
||||||
|
}
|
||||||
|
|
||||||
|
return ticker
|
||||||
}
|
}
|
||||||
|
|
||||||
func (data *BookEvent) Book() types.SliceOrderBook {
|
func (data *BookEvent) Book() types.SliceOrderBook {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user