mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-14 19:13:52 +00:00
extend ticker method
This commit is contained in:
parent
d5a6930545
commit
9194a9152c
|
@ -18,6 +18,22 @@ type Ticker struct {
|
|||
Sell fixedpoint.Value // `sell` from Max, `askPrice` from binance
|
||||
}
|
||||
|
||||
func (t *Ticker) GetValidPrice() fixedpoint.Value {
|
||||
if !t.Last.IsZero() {
|
||||
return t.Last
|
||||
}
|
||||
|
||||
if !t.Buy.IsZero() {
|
||||
return t.Buy
|
||||
}
|
||||
|
||||
if !t.Sell.IsZero() {
|
||||
return t.Sell
|
||||
}
|
||||
|
||||
return t.Open
|
||||
}
|
||||
|
||||
func (t *Ticker) String() string {
|
||||
return fmt.Sprintf("O:%s H:%s L:%s LAST:%s BID/ASK:%s/%s TIME:%s", t.Open, t.High, t.Low, t.Last, t.Buy, t.Sell, t.Time.String())
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user