Skip to content

Commit

Permalink
Update underlying premium endpoints (v0.16.1) (#53)
Browse files Browse the repository at this point in the history
* feat: update underlying premium endpoints

* fix: remove f-string
  • Loading branch information
martinkersner authored Aug 23, 2024
1 parent 733d4d8 commit 3417997
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 19 deletions.
2 changes: 1 addition & 1 deletion datamaxi/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.16.0"
__version__ = "0.16.1"
28 changes: 11 additions & 17 deletions datamaxi/datamaxi/premium.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,6 @@ def get(
`GET /api/v1/premium`
<https://docs.datamaxiplus.com/api/datasets/premium/premium>
`GET /api/v1/premium/:sourceExchange`
<https://docs.datamaxiplus.com/api/datasets/premium/premium-by-source-exchange>
`GET /api/v1/premium/:sourceExchange/:targetExchange`
<https://docs.datamaxiplus.com/api/datasets/premium/premium-by-source-and-target-exchange>
Args:
sort (str): Sort data by `asc` or `desc`
limit (int): Limit number of data to return
Expand All @@ -48,6 +42,12 @@ def get(
Premium data in pandas DataFrame
"""
params = {}
if sourceExchange is not None:
params["sourceExchange"] = sourceExchange

if targetExchange is not None:
params["targetExchange"] = targetExchange

if sort is not None:
params["sort"] = sort

Expand All @@ -57,14 +57,7 @@ def get(
if symbol is not None:
params["symbol"] = symbol

if sourceExchange is not None and targetExchange is not None:
res = self.query(
f"/api/v1/premium/{sourceExchange}/{targetExchange}", params
)
elif sourceExchange is not None:
res = self.query(f"/api/v1/premium/{sourceExchange}", params)
else:
res = self.query("/api/v1/premium", params)
res = self.query("/api/v1/premium", params)

if pandas:
df = pd.DataFrame(res)
Expand Down Expand Up @@ -93,7 +86,7 @@ def symbols(self, sourceExchange: str, targetExchange: str) -> List[str]:
[datamaxi.Premium.get](./#datamaxi.datamaxi.Premium.get)
API.
`GET /api/v1/premium/symbols/{sourceExchange}/{targetExchange}`
`GET /api/v1/premium/symbols`
<https://docs.datamaxiplus.com/api/datasets/premium/symbols>
Expand All @@ -111,5 +104,6 @@ def symbols(self, sourceExchange: str, targetExchange: str) -> List[str]:
]
)

url_path = f"/api/v1/premium/symbols/{sourceExchange}/{targetExchange}"
return self.query(url_path)
params = {"sourceExchange": sourceExchange, "targetExchange": targetExchange}
url_path = "/api/v1/premium/symbols"
return self.query(url_path, params)
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "datamaxi"
version = "0.16.0"
version = "0.16.1"
authors = [
{ name="Bisonai", email="[email protected]" },
]
Expand Down

0 comments on commit 3417997

Please sign in to comment.