candle close alert

This commit is contained in:
yash 2026-04-27 20:34:48 +03:00
parent 30a7f1b68c
commit dd03cae0f3
10 changed files with 328 additions and 60 deletions

View file

@ -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,
})
}