Repository navigation
tvkit v0.18.0
Refused-request reporting, reported by @xgboosted in #59.
Fixed
-
A symbol or interval that TradingView refuses is reported as what it is, not as "Invalid
interval or bars count". TradingView answers such a request with asymbol_errorand/or a
series_errorframe that carries a reason. tvkit skipped thesymbol_errorand replaced the
series_errorwith a fixed message blaming the interval orbars_count, which no retry could
fix. The exception now carries TradingView's reason verbatim —permission denied (group economics_paid)forECONOMICS:andFRED:symbols on anonymous sessions,invalid symbol
for an unknown symbol,unsupported resolution: INDEX:NDFI, 5,seconds_not_entitled,
custom_resolution— and is raised on the first refusal frame. -
get_ohlcv()andget_quote_data()raise on a refusal instead of ending silently. The
streams' skip-malformed-frames guard swallowed the error, so a refused symbol produced an empty
stream (or, for quotes, a short one) and no exception. The documentedRaisesbehaviour now
holds.
Added
SeriesErrorandEntitlementError, exported fromtvkit.api.chart.
SeriesError(ValueError)is raised for everysymbol_error/series_error;
EntitlementErrorsubclasses it for refusals that say the session is not entitled
(permission denied,*_not_entitled) — permanent, do not retry. Both carrysymbol,
interval,message_type,reasonanddetails. SubclassingValueErrorkeeps existing
except ValueErrorhandlers working and keepstvkit.batchfrom retrying them; they are
deliberately notChartErrors, and not the built-inPermissionError(anOSError, which
retry policies commonly treat as transient).
Changed
-
Messages and types for refused requests. Code matching the text
"Invalid interval or bars count"no longer matches.series_errormessages keep the"TradingView series error"prefix;
symbol_errormessages start with"TradingView could not resolve symbol". Intvkit.batch,
ErrorInfo.exception_typefor these failures is"SeriesError"or"EntitlementError"
instead of"ValueError". -
Segmented fetches raise the refusal itself.
SegmentedFetchServiceno longer wraps a
SeriesErrorinSegmentedFetchError: TradingView refused the whole request, not one segment,
soexcept EntitlementErroraroundget_historical_ohlcv()works whether or not the range was
segmented. Other segment failures are still wrapped. -
One
ERRORlog line per refusal — the message and the raw frame — instead of four lines
blaming the interval andbars_count.