Skip to content

Commit 3abb97c

Browse files
committed
fix: subscribe candlesticks with Period::Day
1 parent 03e75d0 commit 3abb97c

2 files changed

Lines changed: 6 additions & 17 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
# [3.0.8] 2025-07-15
8+
9+
- fix: subscribe candlesticks with `Period::Day`.
10+
711
# [3.0.7] 2025-06-09
812

913
- add `AccountBalance.frozen_transaction_fees`

rust/src/quote/core.rs

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -672,23 +672,8 @@ impl Core {
672672
let mut tails = HashMap::new();
673673

674674
for candlestick in resp.candlesticks {
675-
let time = OffsetDateTime::from_unix_timestamp(candlestick.timestamp)
676-
.map_err(|err| Error::parse_field_error("timestamp", err))?
677-
.to_timezone(market.timezone);
678-
let ts = match market.candlestick_trade_session(time) {
679-
Some(ts) => ts,
680-
None => {
681-
tracing::error!(
682-
symbol = symbol,
683-
time = time
684-
.format(&time::format_description::well_known::Rfc3339)
685-
.unwrap(),
686-
"unknown trade session"
687-
);
688-
return Err(Error::UnknownTradeSession { symbol, time });
689-
}
690-
};
691-
let candlestick = candlestick.try_into()?;
675+
let candlestick: Candlestick = candlestick.try_into()?;
676+
let ts = convert_trade_session(candlestick.trade_session);
692677
let index = candlesticks.len();
693678
candlesticks.push(candlestick);
694679
tails.insert(ts, TailCandlestick { index, candlestick });

0 commit comments

Comments
 (0)