Skip to content

Commit 18b3c8f

Browse files
committed
more type hints
1 parent 6fa221f commit 18b3c8f

2 files changed

Lines changed: 11 additions & 7 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# Changelog
22
Notable changes to this project.
33

4+
## [dev]
5+
- more type hints
6+
47
## [2.20.8] - 2025-09-11
58
- added `BMC` and `Alpha` to diagnostics
69

numerapi/base_api.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@
1818
class Api:
1919
"""Wrapper around the Numerai API"""
2020

21-
def __init__(self, public_id=None, secret_key=None, verbosity="INFO",
22-
show_progress_bars=True):
21+
def __init__(self, public_id: str | None = None,
22+
secret_key: str | None = None, verbosity: str = "INFO",
23+
show_progress_bars: bool = True):
2324
"""
2425
initialize Numerai API wrapper for Python
2526
@@ -951,7 +952,7 @@ def round_model_performances(self, username: str) -> List[Dict]:
951952
return self.round_model_performances_v2(username)
952953

953954

954-
def stake_change(self, nmr, action: str = "decrease",
955+
def stake_change(self, nmr: float | str, action: str = "decrease",
955956
model_id: str = "") -> Dict:
956957
"""Change stake by `value` NMR.
957958
@@ -1004,7 +1005,7 @@ def stake_change(self, nmr, action: str = "decrease",
10041005
utils.replace(stake, "dueDate", utils.parse_datetime_string)
10051006
return stake
10061007

1007-
def stake_drain(self, model_id: str = None) -> Dict:
1008+
def stake_drain(self, model_id: str | None = None) -> Dict:
10081009
"""Completely remove your stake.
10091010
10101011
Args:
@@ -1048,7 +1049,7 @@ def stake_drain(self, model_id: str = None) -> Dict:
10481049
raw = self.raw_query(query, arguments, authorization=True)
10491050
return raw['data']['releaseStake']
10501051

1051-
def stake_decrease(self, nmr, model_id: str) -> Dict:
1052+
def stake_decrease(self, nmr: float | str, model_id: str) -> Dict:
10521053
"""Decrease your stake by `value` NMR.
10531054
10541055
Args:
@@ -1076,7 +1077,7 @@ def stake_decrease(self, nmr, model_id: str) -> Dict:
10761077
"""
10771078
return self.stake_change(nmr, 'decrease', model_id)
10781079

1079-
def stake_increase(self, nmr, model_id: str) -> Dict:
1080+
def stake_increase(self, nmr: float | str, model_id: str) -> Dict:
10801081
"""Increase your stake by `value` NMR.
10811082
10821083
Args:
@@ -1274,7 +1275,7 @@ def modelid_to_modelname(self, model_id: str) -> str:
12741275
res = self.raw_query(query, arguments, authorization=True)
12751276
return res['data']['model']["name"]
12761277

1277-
def pipeline_status(self, date: str = None) -> Dict:
1278+
def pipeline_status(self, date: str | None = None) -> Dict:
12781279
"""Get status of Numerai's scoring pipeline
12791280
12801281
Args:

0 commit comments

Comments
 (0)