numerapi 2.20.6__tar.gz → 2.20.8__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.6 → numerapi-2.20.8}/PKG-INFO +1 -1
- {numerapi-2.20.6 → numerapi-2.20.8}/numerapi/base_api.py +33 -16
- {numerapi-2.20.6 → numerapi-2.20.8}/numerapi/utils.py +1 -1
- {numerapi-2.20.6 → numerapi-2.20.8}/numerapi.egg-info/PKG-INFO +1 -1
- {numerapi-2.20.6 → numerapi-2.20.8}/setup.py +1 -1
- {numerapi-2.20.6 → numerapi-2.20.8}/LICENSE +0 -0
- {numerapi-2.20.6 → numerapi-2.20.8}/README.md +0 -0
- {numerapi-2.20.6 → numerapi-2.20.8}/numerapi/__init__.py +0 -0
- {numerapi-2.20.6 → numerapi-2.20.8}/numerapi/cli.py +0 -0
- {numerapi-2.20.6 → numerapi-2.20.8}/numerapi/cryptoapi.py +0 -0
- {numerapi-2.20.6 → numerapi-2.20.8}/numerapi/numerapi.py +0 -0
- {numerapi-2.20.6 → numerapi-2.20.8}/numerapi/py.typed +0 -0
- {numerapi-2.20.6 → numerapi-2.20.8}/numerapi/signalsapi.py +0 -0
- {numerapi-2.20.6 → numerapi-2.20.8}/numerapi.egg-info/SOURCES.txt +0 -0
- {numerapi-2.20.6 → numerapi-2.20.8}/numerapi.egg-info/dependency_links.txt +0 -0
- {numerapi-2.20.6 → numerapi-2.20.8}/numerapi.egg-info/entry_points.txt +0 -0
- {numerapi-2.20.6 → numerapi-2.20.8}/numerapi.egg-info/requires.txt +0 -0
- {numerapi-2.20.6 → numerapi-2.20.8}/numerapi.egg-info/top_level.txt +0 -0
- {numerapi-2.20.6 → numerapi-2.20.8}/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
|
|
|
@@ -634,6 +637,8 @@ class Api:
|
|
|
634
637
|
* perEraDiagnostics (`list`) each with the following fields:
|
|
635
638
|
* era (`int`)
|
|
636
639
|
* examplePredsCorr (`float`)
|
|
640
|
+
* validationAlpha (`float`)
|
|
641
|
+
* validationBmc (`float`)
|
|
637
642
|
* validationCorr (`float`)
|
|
638
643
|
* validationCorrV4 (`float`)
|
|
639
644
|
* validationFeatureCorrMax (`float`)
|
|
@@ -695,6 +700,11 @@ class Api:
|
|
|
695
700
|
* validationRicMean (`float`)
|
|
696
701
|
* validationRicSharpe (`float`)
|
|
697
702
|
* validationRicStd (`float`)
|
|
703
|
+
* validationAlphaCorrWExamplePreds (`float`)
|
|
704
|
+
* validationAlphaMaxDrawdown (`float`)
|
|
705
|
+
* validationAlphaMean (`float`)
|
|
706
|
+
* validationAlphaSharpe (`float`)
|
|
707
|
+
* validationAlphaStd (`float`)
|
|
698
708
|
|
|
699
709
|
Example:
|
|
700
710
|
>>> napi = NumerAPI(secret_key="..", public_id="..")
|
|
@@ -718,6 +728,9 @@ class Api:
|
|
|
718
728
|
perEraDiagnostics {
|
|
719
729
|
era
|
|
720
730
|
examplePredsCorr
|
|
731
|
+
validationAlpha
|
|
732
|
+
validationBmc
|
|
733
|
+
validationChurn
|
|
721
734
|
validationCorr
|
|
722
735
|
validationCorrV4
|
|
723
736
|
validationFeatureCorrMax
|
|
@@ -727,7 +740,6 @@ class Api:
|
|
|
727
740
|
validationFncV4
|
|
728
741
|
validationIcV2
|
|
729
742
|
validationRic
|
|
730
|
-
validationBmc
|
|
731
743
|
}
|
|
732
744
|
status
|
|
733
745
|
trainedOnVal
|
|
@@ -787,6 +799,11 @@ class Api:
|
|
|
787
799
|
validationRicMean
|
|
788
800
|
validationRicSharpe
|
|
789
801
|
validationRicStd
|
|
802
|
+
validationAlphaCorrWExamplePreds
|
|
803
|
+
validationAlphaMaxDrawdown
|
|
804
|
+
validationAlphaMean
|
|
805
|
+
validationAlphaSharpe
|
|
806
|
+
validationAlphaStd
|
|
790
807
|
}
|
|
791
808
|
}
|
|
792
809
|
'''
|
|
@@ -935,7 +952,7 @@ class Api:
|
|
|
935
952
|
|
|
936
953
|
|
|
937
954
|
def stake_change(self, nmr, action: str = "decrease",
|
|
938
|
-
model_id: str
|
|
955
|
+
model_id: str = "") -> Dict:
|
|
939
956
|
"""Change stake by `value` NMR.
|
|
940
957
|
|
|
941
958
|
Args:
|
|
@@ -1031,7 +1048,7 @@ class Api:
|
|
|
1031
1048
|
raw = self.raw_query(query, arguments, authorization=True)
|
|
1032
1049
|
return raw['data']['releaseStake']
|
|
1033
1050
|
|
|
1034
|
-
def stake_decrease(self, nmr, model_id: str
|
|
1051
|
+
def stake_decrease(self, nmr, model_id: str) -> Dict:
|
|
1035
1052
|
"""Decrease your stake by `value` NMR.
|
|
1036
1053
|
|
|
1037
1054
|
Args:
|
|
@@ -1059,7 +1076,7 @@ class Api:
|
|
|
1059
1076
|
"""
|
|
1060
1077
|
return self.stake_change(nmr, 'decrease', model_id)
|
|
1061
1078
|
|
|
1062
|
-
def stake_increase(self, nmr, model_id: str
|
|
1079
|
+
def stake_increase(self, nmr, model_id: str) -> Dict:
|
|
1063
1080
|
"""Increase your stake by `value` NMR.
|
|
1064
1081
|
|
|
1065
1082
|
Args:
|
|
@@ -1470,8 +1487,8 @@ class Api:
|
|
|
1470
1487
|
return data
|
|
1471
1488
|
|
|
1472
1489
|
def download_submission(self, submission_id: str | None = None,
|
|
1473
|
-
model_id: str
|
|
1474
|
-
dest_path: str
|
|
1490
|
+
model_id: str = "",
|
|
1491
|
+
dest_path: str = "") -> str:
|
|
1475
1492
|
""" Download previous submissions from numerai
|
|
1476
1493
|
|
|
1477
1494
|
Args:
|
|
@@ -1494,7 +1511,7 @@ class Api:
|
|
|
1494
1511
|
>>> api.download_submission(submission_id=submission_id)
|
|
1495
1512
|
"""
|
|
1496
1513
|
msg = "You need to provide one of `model_id` and `submission_id"
|
|
1497
|
-
assert model_id or submission_id, msg
|
|
1514
|
+
assert model_id != "" or submission_id != "", msg
|
|
1498
1515
|
auth_query = '''
|
|
1499
1516
|
query($id: String) {
|
|
1500
1517
|
submissionDownloadAuth(id: $id) {
|
|
@@ -1509,7 +1526,7 @@ class Api:
|
|
|
1509
1526
|
data = self.raw_query(
|
|
1510
1527
|
auth_query, {'id': submission_id},
|
|
1511
1528
|
authorization=True)['data']["submissionDownloadAuth"]
|
|
1512
|
-
if dest_path
|
|
1529
|
+
if dest_path == "":
|
|
1513
1530
|
dest_path = data["filename"]
|
|
1514
1531
|
path = utils.download_file(data["url"], dest_path)
|
|
1515
1532
|
return path
|
|
@@ -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
|
|
File without changes
|