numerapi 2.20.5__tar.gz → 2.20.7__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {numerapi-2.20.5 → numerapi-2.20.7}/PKG-INFO +1 -1
- {numerapi-2.20.5 → numerapi-2.20.7}/numerapi/base_api.py +18 -15
- {numerapi-2.20.5 → numerapi-2.20.7}/numerapi/cli.py +2 -4
- {numerapi-2.20.5 → numerapi-2.20.7}/numerapi/utils.py +1 -1
- {numerapi-2.20.5 → numerapi-2.20.7}/numerapi.egg-info/PKG-INFO +1 -1
- {numerapi-2.20.5 → numerapi-2.20.7}/setup.py +1 -1
- {numerapi-2.20.5 → numerapi-2.20.7}/LICENSE +0 -0
- {numerapi-2.20.5 → numerapi-2.20.7}/README.md +0 -0
- {numerapi-2.20.5 → numerapi-2.20.7}/numerapi/__init__.py +0 -0
- {numerapi-2.20.5 → numerapi-2.20.7}/numerapi/cryptoapi.py +0 -0
- {numerapi-2.20.5 → numerapi-2.20.7}/numerapi/numerapi.py +0 -0
- {numerapi-2.20.5 → numerapi-2.20.7}/numerapi/py.typed +0 -0
- {numerapi-2.20.5 → numerapi-2.20.7}/numerapi/signalsapi.py +0 -0
- {numerapi-2.20.5 → numerapi-2.20.7}/numerapi.egg-info/SOURCES.txt +0 -0
- {numerapi-2.20.5 → numerapi-2.20.7}/numerapi.egg-info/dependency_links.txt +0 -0
- {numerapi-2.20.5 → numerapi-2.20.7}/numerapi.egg-info/entry_points.txt +0 -0
- {numerapi-2.20.5 → numerapi-2.20.7}/numerapi.egg-info/requires.txt +0 -0
- {numerapi-2.20.5 → numerapi-2.20.7}/numerapi.egg-info/top_level.txt +0 -0
- {numerapi-2.20.5 → numerapi-2.20.7}/setup.cfg +0 -0
|
@@ -60,7 +60,8 @@ class Api:
|
|
|
60
60
|
"You need to supply both a public id and a secret key.")
|
|
61
61
|
self.token = None
|
|
62
62
|
|
|
63
|
-
def _handle_call_error(self, errors):
|
|
63
|
+
def _handle_call_error(self, errors) -> str:
|
|
64
|
+
msg = ""
|
|
64
65
|
if isinstance(errors, list):
|
|
65
66
|
for error in errors:
|
|
66
67
|
if "message" in error:
|
|
@@ -157,7 +158,7 @@ class Api:
|
|
|
157
158
|
args = {'round': round_num, "tournament": self.tournament_id}
|
|
158
159
|
return self.raw_query(query, args)['data']['listDatasets']
|
|
159
160
|
|
|
160
|
-
def download_dataset(self, filename: str
|
|
161
|
+
def download_dataset(self, filename: str,
|
|
161
162
|
dest_path: str | None = None,
|
|
162
163
|
round_num: int | None = None) -> str:
|
|
163
164
|
""" Download specified file for the given round.
|
|
@@ -189,12 +190,14 @@ class Api:
|
|
|
189
190
|
|
|
190
191
|
query = """
|
|
191
192
|
query ($filename: String!
|
|
192
|
-
$round: Int
|
|
193
|
+
$round: Int
|
|
194
|
+
$tournament: Int) {
|
|
193
195
|
dataset(filename: $filename
|
|
194
|
-
round: $round
|
|
196
|
+
round: $round
|
|
197
|
+
tournament: $tournament)
|
|
195
198
|
}
|
|
196
199
|
"""
|
|
197
|
-
args = {'filename': filename, "round": round_num}
|
|
200
|
+
args = {'filename': filename, "round": round_num, "tournament": self.tournament_id}
|
|
198
201
|
|
|
199
202
|
dataset_url = self.raw_query(query, args)['data']['dataset']
|
|
200
203
|
utils.download_file(dataset_url, dest_path, self.show_progress_bars)
|
|
@@ -323,7 +326,7 @@ class Api:
|
|
|
323
326
|
return {item["displayName"]: item["id"]
|
|
324
327
|
for item in sorted(data, key=lambda x: x["displayName"])}
|
|
325
328
|
|
|
326
|
-
def get_models(self, tournament: int = None) -> Dict:
|
|
329
|
+
def get_models(self, tournament: int | None = None) -> Dict:
|
|
327
330
|
"""Get mapping of account model names to model ids for convenience
|
|
328
331
|
|
|
329
332
|
Args:
|
|
@@ -500,7 +503,7 @@ class Api:
|
|
|
500
503
|
return txs
|
|
501
504
|
|
|
502
505
|
def set_submission_webhook(self, model_id: str,
|
|
503
|
-
webhook: str = None) -> bool:
|
|
506
|
+
webhook: str | None = None) -> bool:
|
|
504
507
|
"""Set a model's submission webhook used in Numerai Compute.
|
|
505
508
|
Read More: https://docs.numer.ai/tournament/compute
|
|
506
509
|
|
|
@@ -555,7 +558,7 @@ class Api:
|
|
|
555
558
|
|
|
556
559
|
def upload_diagnostics(self, file_path: str = "predictions.csv",
|
|
557
560
|
tournament: int | None = None,
|
|
558
|
-
model_id: str
|
|
561
|
+
model_id: str = "",
|
|
559
562
|
df: pd.DataFrame | None = None) -> str:
|
|
560
563
|
"""Upload predictions to diagnostics from file.
|
|
561
564
|
|
|
@@ -935,7 +938,7 @@ class Api:
|
|
|
935
938
|
|
|
936
939
|
|
|
937
940
|
def stake_change(self, nmr, action: str = "decrease",
|
|
938
|
-
model_id: str
|
|
941
|
+
model_id: str = "") -> Dict:
|
|
939
942
|
"""Change stake by `value` NMR.
|
|
940
943
|
|
|
941
944
|
Args:
|
|
@@ -1031,7 +1034,7 @@ class Api:
|
|
|
1031
1034
|
raw = self.raw_query(query, arguments, authorization=True)
|
|
1032
1035
|
return raw['data']['releaseStake']
|
|
1033
1036
|
|
|
1034
|
-
def stake_decrease(self, nmr, model_id: str
|
|
1037
|
+
def stake_decrease(self, nmr, model_id: str) -> Dict:
|
|
1035
1038
|
"""Decrease your stake by `value` NMR.
|
|
1036
1039
|
|
|
1037
1040
|
Args:
|
|
@@ -1059,7 +1062,7 @@ class Api:
|
|
|
1059
1062
|
"""
|
|
1060
1063
|
return self.stake_change(nmr, 'decrease', model_id)
|
|
1061
1064
|
|
|
1062
|
-
def stake_increase(self, nmr, model_id: str
|
|
1065
|
+
def stake_increase(self, nmr, model_id: str) -> Dict:
|
|
1063
1066
|
"""Increase your stake by `value` NMR.
|
|
1064
1067
|
|
|
1065
1068
|
Args:
|
|
@@ -1470,8 +1473,8 @@ class Api:
|
|
|
1470
1473
|
return data
|
|
1471
1474
|
|
|
1472
1475
|
def download_submission(self, submission_id: str | None = None,
|
|
1473
|
-
model_id: str
|
|
1474
|
-
dest_path: str
|
|
1476
|
+
model_id: str = "",
|
|
1477
|
+
dest_path: str = "") -> str:
|
|
1475
1478
|
""" Download previous submissions from numerai
|
|
1476
1479
|
|
|
1477
1480
|
Args:
|
|
@@ -1494,7 +1497,7 @@ class Api:
|
|
|
1494
1497
|
>>> api.download_submission(submission_id=submission_id)
|
|
1495
1498
|
"""
|
|
1496
1499
|
msg = "You need to provide one of `model_id` and `submission_id"
|
|
1497
|
-
assert model_id or submission_id, msg
|
|
1500
|
+
assert model_id != "" or submission_id != "", msg
|
|
1498
1501
|
auth_query = '''
|
|
1499
1502
|
query($id: String) {
|
|
1500
1503
|
submissionDownloadAuth(id: $id) {
|
|
@@ -1509,7 +1512,7 @@ class Api:
|
|
|
1509
1512
|
data = self.raw_query(
|
|
1510
1513
|
auth_query, {'id': submission_id},
|
|
1511
1514
|
authorization=True)['data']["submissionDownloadAuth"]
|
|
1512
|
-
if dest_path
|
|
1515
|
+
if dest_path == "":
|
|
1513
1516
|
dest_path = data["filename"]
|
|
1514
1517
|
path = utils.download_file(data["url"], dest_path)
|
|
1515
1518
|
return path
|
|
@@ -103,13 +103,11 @@ def submission_filenames(round_num, tournament, model_id):
|
|
|
103
103
|
|
|
104
104
|
|
|
105
105
|
@cli.command()
|
|
106
|
-
@click.option('--tournament', default=8,
|
|
107
|
-
help='The ID of the tournament, defaults to 8')
|
|
108
106
|
@click.option('--hours', default=12,
|
|
109
107
|
help='timeframe to consider, defaults to 12')
|
|
110
|
-
def check_new_round(hours=12
|
|
108
|
+
def check_new_round(hours=12):
|
|
111
109
|
"""Check if a new round has started within the last `hours`."""
|
|
112
|
-
click.echo(int(napi.check_new_round(hours=hours
|
|
110
|
+
click.echo(int(napi.check_new_round(hours=hours)))
|
|
113
111
|
|
|
114
112
|
|
|
115
113
|
@cli.command()
|
|
@@ -104,7 +104,7 @@ def download_file(url: str, dest_path: str, show_progress_bars: bool = True):
|
|
|
104
104
|
return dest_path
|
|
105
105
|
|
|
106
106
|
|
|
107
|
-
def post_with_err_handling(url: str, body:
|
|
107
|
+
def post_with_err_handling(url: str, body: dict, headers: dict,
|
|
108
108
|
*, timeout: int | None = None,
|
|
109
109
|
retries: int = 3, delay: int = 1, backoff: int = 2
|
|
110
110
|
) -> dict:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|