numerapi 2.23.0.dev0__py3-none-any.whl → 2.23.0.dev2__py3-none-any.whl
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/base_api.py +145 -1
- {numerapi-2.23.0.dev0.dist-info → numerapi-2.23.0.dev2.dist-info}/METADATA +1 -1
- {numerapi-2.23.0.dev0.dist-info → numerapi-2.23.0.dev2.dist-info}/RECORD +7 -7
- {numerapi-2.23.0.dev0.dist-info → numerapi-2.23.0.dev2.dist-info}/WHEEL +1 -1
- {numerapi-2.23.0.dev0.dist-info → numerapi-2.23.0.dev2.dist-info}/entry_points.txt +0 -0
- {numerapi-2.23.0.dev0.dist-info → numerapi-2.23.0.dev2.dist-info}/licenses/LICENSE +0 -0
- {numerapi-2.23.0.dev0.dist-info → numerapi-2.23.0.dev2.dist-info}/top_level.txt +0 -0
numerapi/base_api.py
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import datetime
|
|
4
4
|
import logging
|
|
5
5
|
import os
|
|
6
|
+
import warnings
|
|
6
7
|
from io import BytesIO
|
|
7
8
|
from typing import Dict, List, Tuple, Union
|
|
8
9
|
|
|
@@ -426,7 +427,7 @@ class Api:
|
|
|
426
427
|
|
|
427
428
|
max_amount = max_amount if max_amount is not None else amount
|
|
428
429
|
query = """
|
|
429
|
-
|
|
430
|
+
query($submissionId: ID!, $staker: String!, $maxAmount: String!) {
|
|
430
431
|
v3StakeAuth(
|
|
431
432
|
submissionId: $submissionId
|
|
432
433
|
staker: $staker
|
|
@@ -1046,9 +1047,145 @@ class Api:
|
|
|
1046
1047
|
utils.replace(results, "updatedAt", utils.parse_datetime_string)
|
|
1047
1048
|
return results
|
|
1048
1049
|
|
|
1050
|
+
def submission_scores(
|
|
1051
|
+
self,
|
|
1052
|
+
model_id: str,
|
|
1053
|
+
display_name: str | None = None,
|
|
1054
|
+
version: str | None = None,
|
|
1055
|
+
day: int | None = None,
|
|
1056
|
+
resolved: bool | None = None,
|
|
1057
|
+
tournament: int | None = None,
|
|
1058
|
+
last_n_rounds: int | None = None,
|
|
1059
|
+
distinct_on_round: bool | None = None,
|
|
1060
|
+
) -> List[Dict]:
|
|
1061
|
+
"""Fetch submission score history for a model.
|
|
1062
|
+
|
|
1063
|
+
Args:
|
|
1064
|
+
model_id (str): target model UUID
|
|
1065
|
+
display_name (str, optional): score metric name filter
|
|
1066
|
+
version (str, optional): score version filter
|
|
1067
|
+
day (int, optional): day filter
|
|
1068
|
+
resolved (bool, optional): resolved-state filter
|
|
1069
|
+
tournament (int, optional): tournament filter, defaults to the
|
|
1070
|
+
API instance tournament
|
|
1071
|
+
last_n_rounds (int, optional): limit by most recent rounds
|
|
1072
|
+
distinct_on_round (bool, optional): keep only the latest score per
|
|
1073
|
+
round after applying other filters
|
|
1074
|
+
|
|
1075
|
+
Returns:
|
|
1076
|
+
list of dicts: list of submission score entries
|
|
1077
|
+
"""
|
|
1078
|
+
|
|
1079
|
+
query = """
|
|
1080
|
+
query($modelId: ID!
|
|
1081
|
+
$displayName: String
|
|
1082
|
+
$version: String
|
|
1083
|
+
$day: Int
|
|
1084
|
+
$resolved: Boolean
|
|
1085
|
+
$tournament: Int
|
|
1086
|
+
$lastNRounds: Int
|
|
1087
|
+
$distinctOnRound: Boolean) {
|
|
1088
|
+
submissionScores(modelId: $modelId
|
|
1089
|
+
displayName: $displayName
|
|
1090
|
+
version: $version
|
|
1091
|
+
day: $day
|
|
1092
|
+
resolved: $resolved
|
|
1093
|
+
tournament: $tournament
|
|
1094
|
+
lastNRounds: $lastNRounds
|
|
1095
|
+
distinctOnRound: $distinctOnRound) {
|
|
1096
|
+
roundId
|
|
1097
|
+
submissionId
|
|
1098
|
+
roundNumber
|
|
1099
|
+
roundResolveTime
|
|
1100
|
+
roundScoreTime
|
|
1101
|
+
roundCloseStakingTime
|
|
1102
|
+
value
|
|
1103
|
+
percentile
|
|
1104
|
+
displayName
|
|
1105
|
+
version
|
|
1106
|
+
date
|
|
1107
|
+
day
|
|
1108
|
+
resolveDate
|
|
1109
|
+
resolved
|
|
1110
|
+
}
|
|
1111
|
+
}
|
|
1112
|
+
"""
|
|
1113
|
+
arguments = {
|
|
1114
|
+
"modelId": model_id,
|
|
1115
|
+
"displayName": display_name,
|
|
1116
|
+
"version": version,
|
|
1117
|
+
"day": day,
|
|
1118
|
+
"resolved": resolved,
|
|
1119
|
+
"tournament": self.tournament_id if tournament is None else tournament,
|
|
1120
|
+
"lastNRounds": last_n_rounds,
|
|
1121
|
+
"distinctOnRound": distinct_on_round,
|
|
1122
|
+
}
|
|
1123
|
+
scores = self.raw_query(query, arguments)["data"]["submissionScores"]
|
|
1124
|
+
for score in scores:
|
|
1125
|
+
utils.replace(score, "roundResolveTime", utils.parse_datetime_string)
|
|
1126
|
+
utils.replace(score, "roundScoreTime", utils.parse_datetime_string)
|
|
1127
|
+
utils.replace(score, "roundCloseStakingTime", utils.parse_datetime_string)
|
|
1128
|
+
utils.replace(score, "date", utils.parse_datetime_string)
|
|
1129
|
+
utils.replace(score, "resolveDate", utils.parse_datetime_string)
|
|
1130
|
+
return scores
|
|
1131
|
+
|
|
1132
|
+
def pending_model_payouts(self, tournament: int | None = None) -> Dict:
|
|
1133
|
+
"""Fetch actual and pending payouts for the authenticated user's models.
|
|
1134
|
+
|
|
1135
|
+
Args:
|
|
1136
|
+
tournament (int, optional): tournament filter, defaults to the API
|
|
1137
|
+
instance tournament
|
|
1138
|
+
|
|
1139
|
+
Returns:
|
|
1140
|
+
dict: payout groups with `actual` and `pending` lists
|
|
1141
|
+
"""
|
|
1142
|
+
|
|
1143
|
+
query = """
|
|
1144
|
+
query($tournament: Int!) {
|
|
1145
|
+
pendingModelPayouts(tournament: $tournament) {
|
|
1146
|
+
actual {
|
|
1147
|
+
roundId
|
|
1148
|
+
roundNumber
|
|
1149
|
+
roundResolveTime
|
|
1150
|
+
modelId
|
|
1151
|
+
modelName
|
|
1152
|
+
modelDisplayName
|
|
1153
|
+
payoutNmr
|
|
1154
|
+
payoutValue
|
|
1155
|
+
currencySymbol
|
|
1156
|
+
}
|
|
1157
|
+
pending {
|
|
1158
|
+
roundId
|
|
1159
|
+
roundNumber
|
|
1160
|
+
roundResolveTime
|
|
1161
|
+
modelId
|
|
1162
|
+
modelName
|
|
1163
|
+
modelDisplayName
|
|
1164
|
+
payoutNmr
|
|
1165
|
+
payoutValue
|
|
1166
|
+
currencySymbol
|
|
1167
|
+
}
|
|
1168
|
+
}
|
|
1169
|
+
}
|
|
1170
|
+
"""
|
|
1171
|
+
arguments = {
|
|
1172
|
+
"tournament": self.tournament_id if tournament is None else tournament
|
|
1173
|
+
}
|
|
1174
|
+
payouts = self.raw_query(query, arguments, authorization=True)["data"][
|
|
1175
|
+
"pendingModelPayouts"
|
|
1176
|
+
]
|
|
1177
|
+
for payout_type in ["actual", "pending"]:
|
|
1178
|
+
for payout in payouts[payout_type]:
|
|
1179
|
+
utils.replace(payout, "roundResolveTime", utils.parse_datetime_string)
|
|
1180
|
+
utils.replace(payout, "payoutNmr", utils.parse_float_string)
|
|
1181
|
+
utils.replace(payout, "payoutValue", utils.parse_float_string)
|
|
1182
|
+
return payouts
|
|
1183
|
+
|
|
1049
1184
|
def round_model_performances_v2(self, model_id: str):
|
|
1050
1185
|
"""Fetch round model performance of a user.
|
|
1051
1186
|
|
|
1187
|
+
DEPRECATED - please use `submission_scores` instead when possible.
|
|
1188
|
+
|
|
1052
1189
|
Args:
|
|
1053
1190
|
model_id (str)
|
|
1054
1191
|
|
|
@@ -1076,6 +1213,13 @@ class Api:
|
|
|
1076
1213
|
* percentile (`float`)
|
|
1077
1214
|
* value (`float`): value of the metric
|
|
1078
1215
|
"""
|
|
1216
|
+
warnings.warn(
|
|
1217
|
+
"`round_model_performances_v2` is deprecated because it relies on "
|
|
1218
|
+
"`v2RoundModelPerformances`. Use `submission_scores` instead when "
|
|
1219
|
+
"possible.",
|
|
1220
|
+
DeprecationWarning,
|
|
1221
|
+
stacklevel=2,
|
|
1222
|
+
)
|
|
1079
1223
|
|
|
1080
1224
|
query = """
|
|
1081
1225
|
query($modelId: String!
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
numerapi/__init__.py,sha256=okDA4NGjUj1Q8bDJg4T1t0LTf_S3GPbXCdw8gla7_VU,449
|
|
2
|
-
numerapi/base_api.py,sha256=
|
|
2
|
+
numerapi/base_api.py,sha256=Q--49pamMwgb7AM98JC3gVS4K7k2xE7lmf6mtIwk3lc,71010
|
|
3
3
|
numerapi/cli.py,sha256=oaATypyxS0mlW2Uouby6Srq0DxWkouBg63uiXJY-QHM,8206
|
|
4
4
|
numerapi/cryptoapi.py,sha256=J9fAEhiaEfpvRCiDsSJz8rlazKD-4nkJRJ85f09jGp0,1502
|
|
5
5
|
numerapi/numerapi.py,sha256=cyTpNGRKr4BqK2jKA2Rj540tjyykpV3axz-6jLm1Flo,12323
|
|
6
6
|
numerapi/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
7
7
|
numerapi/signalsapi.py,sha256=inKwMvuIWNGcDFzzdhqRO1RIms_qz1d7lkwA2dzvAoQ,10188
|
|
8
8
|
numerapi/utils.py,sha256=YgXujHyE1TLTf5v1pspcVAX89SQI3Zl3vMcbNlHZJDs,4688
|
|
9
|
-
numerapi-2.23.0.
|
|
10
|
-
numerapi-2.23.0.
|
|
11
|
-
numerapi-2.23.0.
|
|
12
|
-
numerapi-2.23.0.
|
|
13
|
-
numerapi-2.23.0.
|
|
14
|
-
numerapi-2.23.0.
|
|
9
|
+
numerapi-2.23.0.dev2.dist-info/licenses/LICENSE,sha256=BnOIJOdxTIxmbNPf_ZmCXqepXDTRWad1nQf9eYk-eSg,1056
|
|
10
|
+
numerapi-2.23.0.dev2.dist-info/METADATA,sha256=RtntW1DNgRIHzPTY19VrpNWOoo-XJmkm4jHBlhmKx74,7041
|
|
11
|
+
numerapi-2.23.0.dev2.dist-info/WHEEL,sha256=SmOxYU7pzNKBqASvQJ7DjX3XGUF92lrGhMb3R6_iiqI,91
|
|
12
|
+
numerapi-2.23.0.dev2.dist-info/entry_points.txt,sha256=P7RHLytfftNPE14vRxml52-UEkyuAviRegWTID4a_ig,46
|
|
13
|
+
numerapi-2.23.0.dev2.dist-info/top_level.txt,sha256=7f4lKNQqRDEGaDXGIqRQCx-rU5pNl6ZgbXz864F1uXY,9
|
|
14
|
+
numerapi-2.23.0.dev2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|