Skip to content

Commit

Permalink
[HistoryCollector] improve error description
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeDSM committed Oct 3, 2023
1 parent 552f8aa commit 0228e9e
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,12 @@ async def check_timestamps(self):
raise errors.DataCollectorError("start_timestamp is higher than end_timestamp")

async def get_first_candle_timestamp(self, ideal_start_timestamp, symbol, time_frame):
return (
await self.exchange.get_symbol_prices(str(symbol), time_frame, limit=1, since=ideal_start_timestamp)
)[0][commons_enums.PriceIndexes.IND_PRICE_TIME.value]
try:
return (
await self.exchange.get_symbol_prices(str(symbol), time_frame, limit=1, since=ideal_start_timestamp)
)[0][commons_enums.PriceIndexes.IND_PRICE_TIME.value]
except (trading_errors.FailedRequest, IndexError) as err:
raise errors.DataCollectorError(
f"Impossible to initialize {self.exchange_name} data collector: {err}. This means that {symbol} "
f"for the {time_frame.value} time frame is not supported in this context on {self.exchange_name}."
)

0 comments on commit 0228e9e

Please sign in to comment.