mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-27 04:31:13 +00:00
fix fmp historical deprecated urls
This commit is contained in:
@@ -96,9 +96,6 @@ class FMPCryptoHistoricalFetcher(
|
|||||||
url_params = f"{query.symbol}?{query_str}&apikey={api_key}"
|
url_params = f"{query.symbol}?{query_str}&apikey={api_key}"
|
||||||
url = f"{base_url}/historical-chart/{query.interval}/{url_params}"
|
url = f"{base_url}/historical-chart/{query.interval}/{url_params}"
|
||||||
|
|
||||||
if query.interval == "1day":
|
|
||||||
url = f"{base_url}/historical-price-full/crypto/{url_params}"
|
|
||||||
|
|
||||||
return await get_data_many(url, "historical", **kwargs)
|
return await get_data_many(url, "historical", **kwargs)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|||||||
@@ -89,9 +89,6 @@ class FMPCurrencyHistoricalFetcher(
|
|||||||
url_params = f"{query.symbol}?{query_str}&apikey={api_key}"
|
url_params = f"{query.symbol}?{query_str}&apikey={api_key}"
|
||||||
url = f"{base_url}/historical-chart/{query.interval}/{url_params}"
|
url = f"{base_url}/historical-chart/{query.interval}/{url_params}"
|
||||||
|
|
||||||
if query.interval == "1day":
|
|
||||||
url = f"{base_url}/historical-price-full/forex/{url_params}"
|
|
||||||
|
|
||||||
return await get_data_many(url, "historical", **kwargs)
|
return await get_data_many(url, "historical", **kwargs)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|||||||
@@ -97,13 +97,6 @@ class FMPEquityHistoricalFetcher(
|
|||||||
base_url = "https://financialmodelingprep.com/api/v3"
|
base_url = "https://financialmodelingprep.com/api/v3"
|
||||||
query_str = get_querystring(query.model_dump(), ["symbol", "interval"])
|
query_str = get_querystring(query.model_dump(), ["symbol", "interval"])
|
||||||
|
|
||||||
def get_url_params(symbol: str) -> str:
|
|
||||||
url_params = f"{symbol}?{query_str}&apikey={api_key}"
|
|
||||||
url = f"{base_url}/historical-chart/{interval}/{url_params}"
|
|
||||||
if interval == "1day":
|
|
||||||
url = f"{base_url}/historical-price-full/{url_params}"
|
|
||||||
return url
|
|
||||||
|
|
||||||
# if there are more than 20 symbols, we need to increase the timeout
|
# if there are more than 20 symbols, we need to increase the timeout
|
||||||
if len(query.symbol.split(",")) > 20:
|
if len(query.symbol.split(",")) > 20:
|
||||||
kwargs.update({"preferences": {"request_timeout": 30}})
|
kwargs.update({"preferences": {"request_timeout": 30}})
|
||||||
@@ -121,7 +114,10 @@ class FMPEquityHistoricalFetcher(
|
|||||||
|
|
||||||
return data
|
return data
|
||||||
|
|
||||||
urls = [get_url_params(symbol) for symbol in query.symbol.split(",")]
|
urls = [
|
||||||
|
f"{base_url}/historical-chart/{interval}/{symbol}?{query_str}&apikey={api_key}"
|
||||||
|
for symbol in query.symbol.split(",")
|
||||||
|
]
|
||||||
|
|
||||||
return await async_requests(urls, callback, **kwargs)
|
return await async_requests(urls, callback, **kwargs)
|
||||||
|
|
||||||
|
|||||||
@@ -95,9 +95,6 @@ class FMPMarketIndicesFetcher(
|
|||||||
url_params = f"{query.symbol}?{query_str}&apikey={api_key}"
|
url_params = f"{query.symbol}?{query_str}&apikey={api_key}"
|
||||||
url = f"{base_url}/historical-chart/{query.interval}/{url_params}"
|
url = f"{base_url}/historical-chart/{query.interval}/{url_params}"
|
||||||
|
|
||||||
if query.interval == "1day":
|
|
||||||
url = f"{base_url}/historical-chart/1day/{query.symbol}?apikey={api_key}"
|
|
||||||
|
|
||||||
return await get_data_many(url, "historical", **kwargs)
|
return await get_data_many(url, "historical", **kwargs)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|||||||
Reference in New Issue
Block a user