Skip to content

Commit 9ad9baa

Browse files
committed
Improve logging for TardisInstrumentProvider
1 parent fe49c0d commit 9ad9baa

File tree

3 files changed

+8
-10
lines changed

3 files changed

+8
-10
lines changed

Diff for: nautilus_trader/adapters/tardis/providers.py

+2
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ async def load_all_async(self, filters: dict | None = None) -> None:
7373
for venue in venues:
7474
venue = venue.upper().replace("-", "_")
7575
for exchange in nautilus_pyo3.tardis_exchange_from_venue_str(venue):
76+
self._log.info(f"Requesting instruments for {exchange=}")
7677
pyo3_instruments = await self._client.instruments(
7778
exchange=exchange.lower(),
7879
base_currency=list(base_currency) if base_currency else None,
@@ -121,6 +122,7 @@ async def load_ids_async(
121122
ts_init = time.time_ns()
122123

123124
for exchange, symbols in venue_instruments.items():
125+
self._log.info(f"Requesting instruments for {exchange=}")
124126
pyo3_instruments = await self._client.instruments(
125127
exchange=exchange.lower(),
126128
base_currency=list(base_currency) if base_currency else None,

Diff for: tests/integration_tests/adapters/tardis/sandbox/http_instruments.py

+5-8
Original file line numberDiff line numberDiff line change
@@ -38,19 +38,16 @@ async def run():
3838
base_currency=["BTC"],
3939
quote_currency=["USD"],
4040
instrument_type=["perpetual"],
41-
active=True,
41+
# active=True,
4242
# start=pd.Timestamp("2021-01-01").value,
4343
# end=pd.Timestamp("2022-01-01").value,
4444
effective=pd.Timestamp("2020-08-01 08:00:00").value,
4545
)
4646

47-
for inst in pyo3_instruments:
48-
print(inst.id)
49-
print(
50-
CryptoPerpetual.from_pyo3(inst),
51-
pd.Timestamp(inst.ts_event),
52-
pd.Timestamp(inst.ts_init),
53-
)
47+
for pyo3_inst in pyo3_instruments:
48+
inst = CryptoPerpetual.from_pyo3(pyo3_inst) # Remove/change this if not filtering for perps
49+
print(repr(inst))
50+
print(pd.Timestamp(inst.ts_event))
5451

5552
print(f"Received: {len(pyo3_instruments)} instruments")
5653

Diff for: tests/integration_tests/adapters/tardis/sandbox/instrument_provider.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ async def run():
7171
"venues": frozenset(exchanges),
7272
# "quote_currency": frozenset(["BTC"]),
7373
# "base_currency": frozenset(["USDC"]),
74-
# "instrument_type": frozenset(["spot"]),
74+
# "instrument_type": frozenset(["perpetual"]),
7575
# "start": pd.Timestamp("2021-01-01").value,
7676
# "end": pd.Timestamp("2023-01-01").value,
7777
# "effective": pd.Timestamp("2022-01-01").value,
@@ -96,7 +96,6 @@ async def run():
9696

9797
for instrument in provider.list_all():
9898
print(instrument.id)
99-
print(instrument.size_increment)
10099

101100
count = len(provider.list_all())
102101
total_instrument_count += count

0 commit comments

Comments
 (0)