Merge pull request #10947 from freqtrade/dependabot/pip/develop/pycoingecko-3.2.0
chore(deps): bump pycoingecko from 3.1.0 to 3.2.0
This commit is contained in:
@@ -4,23 +4,10 @@ from pycoingecko import CoinGeckoAPI
|
|||||||
class FtCoinGeckoApi(CoinGeckoAPI):
|
class FtCoinGeckoApi(CoinGeckoAPI):
|
||||||
"""
|
"""
|
||||||
Simple wrapper around pycoingecko's api to support Demo API keys.
|
Simple wrapper around pycoingecko's api to support Demo API keys.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
__API_URL_BASE = "https://api.coingecko.com/api/v3/"
|
|
||||||
__PRO_API_URL_BASE = "https://pro-api.coingecko.com/api/v3/"
|
|
||||||
_api_key: str = ""
|
|
||||||
|
|
||||||
def __init__(self, api_key: str = "", *, is_demo=True, retries=5):
|
def __init__(self, api_key: str = "", *, is_demo=True, retries=5):
|
||||||
super().__init__(retries=retries)
|
if api_key and is_demo:
|
||||||
# Don't pass api_key to parent, instead set the header on the session directly
|
super().__init__(retries=retries, demo_api_key=api_key)
|
||||||
self._api_key = api_key
|
|
||||||
|
|
||||||
if api_key and not is_demo:
|
|
||||||
self.api_base_url = self.__PRO_API_URL_BASE
|
|
||||||
self.session.params.update({"x_cg_pro_api_key": api_key})
|
|
||||||
else:
|
else:
|
||||||
# Use demo api key
|
super().__init__(api_key=api_key, retries=retries)
|
||||||
self.api_base_url = self.__API_URL_BASE
|
|
||||||
if api_key:
|
|
||||||
self.session.params.update({"x_cg_demo_api_key": api_key})
|
|
||||||
|
|||||||
+1
-1
@@ -44,7 +44,7 @@ dependencies = [
|
|||||||
"pandas-ta",
|
"pandas-ta",
|
||||||
"technical",
|
"technical",
|
||||||
"tabulate",
|
"tabulate",
|
||||||
"pycoingecko",
|
"pycoingecko>=3.2.0",
|
||||||
"py_find_1st",
|
"py_find_1st",
|
||||||
"python-rapidjson",
|
"python-rapidjson",
|
||||||
"orjson",
|
"orjson",
|
||||||
|
|||||||
+1
-1
@@ -20,7 +20,7 @@ jsonschema==4.23.0
|
|||||||
TA-Lib==0.4.32
|
TA-Lib==0.4.32
|
||||||
technical==1.4.4
|
technical==1.4.4
|
||||||
tabulate==0.9.0
|
tabulate==0.9.0
|
||||||
pycoingecko==3.1.0
|
pycoingecko==3.2.0
|
||||||
jinja2==3.1.4
|
jinja2==3.1.4
|
||||||
tables==3.10.1
|
tables==3.10.1
|
||||||
joblib==1.4.2
|
joblib==1.4.2
|
||||||
|
|||||||
@@ -206,14 +206,16 @@ def test_convert_amount(mocker):
|
|||||||
|
|
||||||
def test_FtCoinGeckoApi():
|
def test_FtCoinGeckoApi():
|
||||||
ftc = FtCoinGeckoApi()
|
ftc = FtCoinGeckoApi()
|
||||||
assert ftc._api_key == ""
|
assert ftc.extra_params is None
|
||||||
assert ftc.api_base_url == "https://api.coingecko.com/api/v3/"
|
assert ftc.api_base_url == "https://api.coingecko.com/api/v3/"
|
||||||
|
|
||||||
# defaults to demo
|
# defaults to demo
|
||||||
ftc = FtCoinGeckoApi(api_key="123456")
|
ftc = FtCoinGeckoApi(api_key="123456")
|
||||||
assert ftc._api_key == "123456"
|
assert ftc.extra_params is not None
|
||||||
|
assert ftc.extra_params["x_cg_demo_api_key"] == "123456"
|
||||||
assert ftc.api_base_url == "https://api.coingecko.com/api/v3/"
|
assert ftc.api_base_url == "https://api.coingecko.com/api/v3/"
|
||||||
|
|
||||||
ftc = FtCoinGeckoApi(api_key="123456", is_demo=False)
|
ftc = FtCoinGeckoApi(api_key="123456", is_demo=False)
|
||||||
assert ftc._api_key == "123456"
|
assert ftc.extra_params is not None
|
||||||
|
assert ftc.extra_params["x_cg_pro_api_key"] == "123456"
|
||||||
assert ftc.api_base_url == "https://pro-api.coingecko.com/api/v3/"
|
assert ftc.api_base_url == "https://pro-api.coingecko.com/api/v3/"
|
||||||
|
|||||||
Reference in New Issue
Block a user