Skip to content

Commit fe13f74

Browse files
committed
Improve handling of time range filters for Tardis
1 parent acb5cb5 commit fe13f74

File tree

9 files changed

+395
-52
lines changed

9 files changed

+395
-52
lines changed

RELEASES.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,16 @@
33
Released on TBD (UTC).
44

55
### Enhancements
6-
- Add WebSocket batch order operations for Bybit (#2521), thanks @sunlei
6+
- Added WebSocket batch order operations for Bybit (#2521), thanks @sunlei
7+
- Added `UnixNanos::max()` convenience method for the maximum valid value
8+
- Added `available_offset` filter parameter for `TardisInstrumentProvider`
79

810
### Breaking Changes
911
- Removed catalog `basename_template` argument (#2510), thanks @faysou
1012

1113
### Internal Improvements
1214
- Implemented exponential backoff and jitter for the `RetryManager` (#2518), thanks @davidsblom
15+
- Improved handling of time range and effective date filters for `TardisInstrumentProvider`
1316
- Improved reconnection robustness for Bybit private/trading channels (#2520), thanks @sunlei
1417
- Fixed some clippy lints (#2517), thanks @twitu
1518
- Upgraded `databento` crate to v0.23.0

crates/adapters/tardis/bin/example_http.rs

+3
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ async fn main() {
6969
Exchange::Bitmex,
7070
Some("XBTUSD"),
7171
Some(&filter),
72+
None,
73+
None,
74+
None,
7275
Some(effective),
7376
None,
7477
)

crates/adapters/tardis/src/http/client.rs

+6
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ use reqwest::Response;
2222
use super::{
2323
TARDIS_BASE_URL,
2424
error::{Error, TardisErrorResponse},
25+
instruments::is_available,
2526
models::InstrumentInfo,
2627
parse::parse_instrument_any,
2728
query::InstrumentFilter,
@@ -148,18 +149,23 @@ impl TardisHttpClient {
148149
/// Returns all Nautilus instrument definitions for the given `exchange`, and filter params.
149150
///
150151
/// See <https://docs.tardis.dev/api/instruments-metadata-api>.
152+
#[allow(clippy::too_many_arguments)]
151153
pub async fn instruments(
152154
&self,
153155
exchange: Exchange,
154156
symbol: Option<&str>,
155157
filter: Option<&InstrumentFilter>,
158+
start: Option<UnixNanos>,
159+
end: Option<UnixNanos>,
160+
available_offset: Option<UnixNanos>,
156161
effective: Option<UnixNanos>,
157162
ts_init: Option<UnixNanos>,
158163
) -> Result<Vec<InstrumentAny>> {
159164
let response = self.instruments_info(exchange, symbol, filter).await?;
160165

161166
Ok(response
162167
.into_iter()
168+
.filter(|info| is_available(info, start, end, available_offset, effective))
163169
.flat_map(|info| parse_instrument_any(info, effective, ts_init, self.normalize_symbols))
164170
.collect())
165171
}

0 commit comments

Comments
 (0)