candle close alert
This commit is contained in:
parent
30a7f1b68c
commit
dd03cae0f3
10 changed files with 328 additions and 60 deletions
|
|
@ -135,8 +135,8 @@ func (b *Bybit) Candles(ctx context.Context, instrument entities.Instrument, fro
|
|||
}
|
||||
|
||||
for _, item := range resp.List {
|
||||
if len(item) < 4 {
|
||||
b.log.Error("bybit candles: length of elements less then 4", "len", len(item))
|
||||
if len(item) < 5 {
|
||||
b.log.Error("bybit candles: length of elements less than 5", "len", len(item))
|
||||
continue
|
||||
}
|
||||
startMs, err := strconv.ParseInt(item[0], 10, 64)
|
||||
|
|
@ -154,10 +154,16 @@ func (b *Bybit) Candles(ctx context.Context, instrument entities.Instrument, fro
|
|||
b.log.Error("bybit candles: failed to parse candle low price", "err", err)
|
||||
continue
|
||||
}
|
||||
close, err := decimal.NewFromString(item[4])
|
||||
if err != nil {
|
||||
b.log.Error("bybit candles: failed to parse candle close price", "err", err)
|
||||
continue
|
||||
}
|
||||
allCandles = append(allCandles, entities.Candle{
|
||||
OpenTime: time.UnixMilli(startMs),
|
||||
High: high,
|
||||
Low: low,
|
||||
Close: close,
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue