numerapi 2.18.0__tar.gz → 2.19.1__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.
@@ -0,0 +1,172 @@
1
+ Metadata-Version: 2.1
2
+ Name: numerapi
3
+ Version: 2.19.1
4
+ Summary: Automatically download and upload data for the Numerai machine learning competition
5
+ Home-page: https://github.com/uuazed/numerapi
6
+ Maintainer: uuazed
7
+ Maintainer-email: uuazed@gmail.com
8
+ License: MIT License
9
+ Platform: OS Independent
10
+ Classifier: Development Status :: 5 - Production/Stable
11
+ Classifier: Environment :: Console
12
+ Classifier: Intended Audience :: Science/Research
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Programming Language :: Python
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Topic :: Scientific/Engineering
18
+ Description-Content-Type: text/markdown
19
+ License-File: LICENSE
20
+
21
+ [![Build Status](https://app.travis-ci.com/uuazed/numerapi.svg)](https://app.travis-ci.com/uuazed/numerapi)
22
+ [![codecov](https://codecov.io/gh/uuazed/numerapi/branch/master/graph/badge.svg)](https://codecov.io/gh/uuazed/numerapi)
23
+ [![PyPI](https://img.shields.io/pypi/v/numerapi.svg)](https://pypi.python.org/pypi/numerapi)
24
+ [![Downloads](https://pepy.tech/badge/numerapi/month)](https://pepy.tech/project/numerapi)
25
+ [![Docs](https://readthedocs.org/projects/numerapi/badge/?version=stable)](http://numerapi.readthedocs.io/en/stable/?badge=stable)
26
+
27
+ # Numerai Python API
28
+ Automatically download and upload data for the Numerai machine learning
29
+ competition.
30
+
31
+ This library is a Python client to the Numerai API. The interface is programmed
32
+ in Python and allows downloading the training data, uploading predictions, and
33
+ accessing user, submission and competitions information. It works for both, the
34
+ main competition and the newer Numerai Signals competition.
35
+
36
+ If you encounter a problem or have suggestions, feel free to open an issue.
37
+
38
+ # Installation
39
+ `pip install --upgrade numerapi`
40
+
41
+ # Usage
42
+
43
+ Numerapi can be used as a regular, importable Python module or from the command
44
+ line.
45
+
46
+ Some actions (like uploading predictions or staking) require a token to verify
47
+ that it is really you interacting with Numerai's API. These tokens consists of
48
+ a `public_id` and `secret_key`. Both can be obtained by login in to Numer.ai and
49
+ going to Account -> Custom API Keys. Tokens can be passed to the Python module
50
+ as parameters or you can be set via environment variables (`NUMERAI_PUBLIC_ID`
51
+ and `NUMERAI_SECRET_KEY`).
52
+
53
+ ## Python module
54
+
55
+ ### Usage example - main competition
56
+
57
+ import numerapi
58
+ # some API calls do not require logging in
59
+ napi = numerapi.NumerAPI(verbosity="info")
60
+ # download current dataset => also check `https://numer.ai/data`
61
+ napi.download_dataset("v4/train.parquet", "train.parquet")
62
+ # get current leaderboard
63
+ leaderboard = napi.get_leaderboard()
64
+ # check if a new round has started
65
+ if napi.check_new_round():
66
+ print("new round has started within the last 12hours!")
67
+ else:
68
+ print("no new round within the last 12 hours")
69
+
70
+ # provide api tokens
71
+ example_public_id = "somepublicid"
72
+ example_secret_key = "somesecretkey"
73
+ napi = numerapi.NumerAPI(example_public_id, example_secret_key)
74
+
75
+ # upload predictions
76
+ model_id = napi.get_models()['uuazed']
77
+ napi.upload_predictions("preds.csv", model_id=model_id)
78
+ # increase your stake by 1.2 NMR
79
+ napi.stake_increase(1.2)
80
+
81
+ # convert results to a pandas dataframe
82
+ import pandas as pd
83
+ df = pd.DataFrame(napi.daily_user_performances("uuazed"))
84
+
85
+
86
+ ### Usage example - Numerai Signals
87
+
88
+ import numerapi
89
+
90
+ napi = numerapi.SignalsAPI()
91
+ # get current leaderboard
92
+ leaderboard = napi.get_leaderboard()
93
+
94
+ # setup API with api tokens
95
+ example_public_id = "somepublicid"
96
+ example_secret_key = "somesecretkey"
97
+ napi = numerapi.SignalsAPI(example_public_id, example_secret_key)
98
+
99
+ # upload predictions
100
+ model_id = napi.get_models()['uuazed']
101
+ napi.upload_predictions("preds.csv", model_id=model_id)
102
+
103
+ # get daily performance as pandas dataframe
104
+ import pandas as pd
105
+ df = pd.DataFrame(napi.daily_user_performances("uuazed"))
106
+
107
+ # using the diagnostics tool
108
+ napi.upload_diagnostics("preds.csv", model_id=model_id)
109
+ # ... or using a pandas DataFrame directly
110
+ napi.upload_diagnostics(df=df, model_id=model_id)
111
+ # fetch results
112
+ napi.diagnostic(model_id)
113
+
114
+
115
+ ## Command line interface
116
+
117
+ To get started with the cli interface, let's take a look at the help page:
118
+
119
+ $ numerapi --help
120
+ Usage: numerapi [OPTIONS] COMMAND [ARGS]...
121
+
122
+ Wrapper around the Numerai API
123
+
124
+ Options:
125
+ --help Show this message and exit.
126
+
127
+ Commands:
128
+ account Get all information about your account!
129
+ check-new-round Check if a new round has started within...
130
+ competitions Retrieves information about all...
131
+ current-round Get number of the current active round.
132
+ daily-model-performances Fetch daily performance of a model.
133
+ daily-submissions-performances Fetch daily performance of a user's...
134
+ dataset-url Fetch url of the current dataset.
135
+ download-dataset Download specified file for the given...
136
+ download-dataset-old Download dataset for the current active...
137
+ leaderboard Get the leaderboard.
138
+ list-datasets List of available data files
139
+ models Get map of account models!
140
+ profile Fetch the public profile of a user.
141
+ stake-decrease Decrease your stake by `value` NMR.
142
+ stake-drain Completely remove your stake.
143
+ stake-get Get stake value of a user.
144
+ stake-increase Increase your stake by `value` NMR.
145
+ submission-filenames Get filenames of your submissions
146
+ submit Upload predictions from file.
147
+ transactions List all your deposits and withdrawals.
148
+ user Get all information about you!...
149
+ version Installed numerapi version.
150
+
151
+
152
+ Each command has it's own help page, for example:
153
+
154
+ $ numerapi submit --help
155
+ Usage: numerapi submit [OPTIONS] PATH
156
+
157
+ Upload predictions from file.
158
+
159
+ Options:
160
+ --tournament INTEGER The ID of the tournament, defaults to 1
161
+ --model_id TEXT An account model UUID (required for accounts with
162
+ multiple models
163
+
164
+ --help Show this message and exit.
165
+
166
+
167
+ # API Reference
168
+
169
+ Checkout the [detailed API docs](http://numerapi.readthedocs.io/en/latest/api/numerapi.html#module-numerapi.numerapi)
170
+ to learn about all available methods, parameters and returned values.
171
+
172
+
@@ -11,4 +11,5 @@ except pkg_resources.DistributionNotFound:
11
11
  # pylint: disable=wrong-import-position
12
12
  from numerapi.numerapi import NumerAPI
13
13
  from numerapi.signalsapi import SignalsAPI
14
+ from numerapi.cryptoapi import CryptoAPI
14
15
  # pylint: enable=wrong-import-position
@@ -3,7 +3,7 @@
3
3
  import os
4
4
  import datetime
5
5
  import logging
6
- from typing import Dict, List
6
+ from typing import Dict, List, Union, Tuple
7
7
  from io import BytesIO
8
8
  import pytz
9
9
 
@@ -655,6 +655,7 @@ class Api:
655
655
  * validationFncV4 (`float`)
656
656
  * validationIcV2 (`float`)
657
657
  * validationRic (`float`)
658
+ * validationBmc (`float`)
658
659
  * validationCorrPlusMmcStd (`float`)
659
660
  * validationMmcMean (`float`)
660
661
  * validationCorrStdRating (`float`)
@@ -686,6 +687,7 @@ class Api:
686
687
  * validationCorrV4CorrWExamplePreds (`float`)
687
688
  * validationCorrV4MaxDrawdown (`float`)
688
689
  * validationCorrV4Mean (`float`)
690
+ * validationBmcMean (`float`)
689
691
  * validationCorrV4Sharpe (`float`)
690
692
  * validationCorrV4Std (`float`)
691
693
  * validationFeatureNeutralCorrV3Mean (`float`)
@@ -737,6 +739,7 @@ class Api:
737
739
  validationFncV4
738
740
  validationIcV2
739
741
  validationRic
742
+ validationBmc
740
743
  }
741
744
  status
742
745
  trainedOnVal
@@ -767,6 +770,7 @@ class Api:
767
770
  validationMmcSharpeRating
768
771
  validationMmcStd
769
772
  validationMmcStdRating
773
+ validationBmcMean
770
774
 
771
775
  validationAdjustedSharpe
772
776
  validationApy
@@ -1116,9 +1120,7 @@ class Api:
1116
1120
  """Completely remove your stake.
1117
1121
 
1118
1122
  Args:
1119
- model_id (str): Target model UUID (required for accounts with
1120
- multiple models)
1121
- tournament (int): ID of the tournament (optional, defaults to 8)
1123
+ model_id (str): Target model UUID
1122
1124
 
1123
1125
  Returns:
1124
1126
  dict: stake information with the following content:
@@ -1127,17 +1129,36 @@ class Api:
1127
1129
  * status (`str`)
1128
1130
  * requestedAmount (`decimal.Decimal`)
1129
1131
  * type (`str`)
1132
+ * drain (`bool`)
1130
1133
 
1131
1134
  Example:
1132
1135
  >>> api = NumerAPI(secret_key="..", public_id="..")
1133
- >>> model = api.get_models()['uuazed']
1134
- >>> api.stake_drain(model)
1136
+ >>> model_id = api.get_models()['uuazed']
1137
+ >>> api.stake_drain(model_id)
1135
1138
  {'dueDate': None,
1136
1139
  'requestedAmount': decimal.Decimal('11000000'),
1137
1140
  'type': 'decrease',
1138
- 'status': ''}
1141
+ 'status': '',
1142
+ 'drain": True}
1139
1143
  """
1140
- return self.stake_decrease(11000000, model_id)
1144
+ query = '''
1145
+ mutation($drain: bool!
1146
+ $amount: String
1147
+ $modelId: String) {
1148
+ releaseStake(drain: $drain
1149
+ modelId: $modelId
1150
+ amount: $amount) {
1151
+ id
1152
+ dueDate
1153
+ status
1154
+ type
1155
+ requestedAmount
1156
+ drain
1157
+ }
1158
+ }'''
1159
+ arguments = {'drain': True, "modelId": model_id, "amount": '11000000'}
1160
+ raw = self.raw_query(query, arguments, authorization=True)
1161
+ return raw['data']['releaseStake']
1141
1162
 
1142
1163
  def stake_decrease(self, nmr, model_id: str = None) -> Dict:
1143
1164
  """Decrease your stake by `value` NMR.
@@ -1624,3 +1645,78 @@ class Api:
1624
1645
  dest_path = data["filename"]
1625
1646
  path = utils.download_file(data["url"], dest_path)
1626
1647
  return path
1648
+
1649
+ def upload_predictions(self, file_path: str = "predictions.csv",
1650
+ model_id: str = None,
1651
+ df: pd.DataFrame = None,
1652
+ data_datestamp: int = None,
1653
+ timeout: Union[None, float, Tuple[float, float]] = (10, 600)
1654
+ ) -> str:
1655
+ """Upload predictions from file.
1656
+ Will read TRIGGER_ID from the environment if this model is enabled with
1657
+ a Numerai Compute cluster setup by Numerai CLI.
1658
+
1659
+ Args:
1660
+ file_path (str): CSV file with predictions that will get uploaded
1661
+ model_id (str): Target model UUID (required for accounts with
1662
+ multiple models)
1663
+ df (pandas.DataFrame): pandas DataFrame to upload, if function is
1664
+ given df and file_path, df will be uploaded.
1665
+ data_datestamp (int): Data lag, in case submission is done using
1666
+ data from the previous day(s).
1667
+ timeout (float|tuple(float,float)): waiting time (connection timeout,
1668
+ read timeout)
1669
+
1670
+ Returns:
1671
+ str: submission_id
1672
+
1673
+ Example:
1674
+ >>> api = NumerAPI(secret_key="..", public_id="..")
1675
+ >>> model_id = api.get_models()['uuazed']
1676
+ >>> api.upload_predictions("prediction.cvs", model_id=model_id)
1677
+ '93c46857-fed9-4594-981e-82db2b358daf'
1678
+ >>> # upload from pandas DataFrame directly:
1679
+ >>> api.upload_predictions(df=predictions_df, model_id=model_id)
1680
+ """
1681
+ self.logger.info("uploading predictions...")
1682
+
1683
+ # write the pandas DataFrame as a binary buffer if provided
1684
+ buffer_csv = None
1685
+
1686
+ if df is not None:
1687
+ buffer_csv = BytesIO(df.to_csv(index=False).encode())
1688
+ buffer_csv.name = file_path
1689
+
1690
+ upload_auth = self._upload_auth(
1691
+ 'submission_upload_auth', file_path, self.tournament_id, model_id)
1692
+
1693
+ # get compute id if available and pass it along
1694
+ headers = {"x_compute_id": os.getenv("NUMERAI_COMPUTE_ID")}
1695
+ with open(file_path, 'rb') if df is None else buffer_csv as file:
1696
+ requests.put(
1697
+ upload_auth['url'], data=file.read(), headers=headers,
1698
+ timeout=timeout)
1699
+ create_query = '''
1700
+ mutation($filename: String!
1701
+ $tournament: Int!
1702
+ $modelId: String
1703
+ $triggerId: String,
1704
+ $dataDatestamp: Int) {
1705
+ create_submission(filename: $filename
1706
+ tournament: $tournament
1707
+ modelId: $modelId
1708
+ triggerId: $triggerId
1709
+ source: "numerapi"
1710
+ dataDatestamp: $dataDatestamp) {
1711
+ id
1712
+ }
1713
+ }
1714
+ '''
1715
+ arguments = {'filename': upload_auth['filename'],
1716
+ 'tournament': self.tournament_id,
1717
+ 'modelId': model_id,
1718
+ 'triggerId': os.getenv('TRIGGER_ID', None),
1719
+ 'dataDatestamp': data_datestamp}
1720
+ create = self.raw_query(create_query, arguments, authorization=True)
1721
+ submission_id = create['data']['create_submission']['id']
1722
+ return submission_id
@@ -0,0 +1,8 @@
1
+ from numerapi import base_api
2
+
3
+ class CryptoAPI(base_api.Api):
4
+ """"API for Numerai Crypto"""
5
+
6
+ def __init__(self, *args, **kwargs):
7
+ base_api.Api.__init__(self, *args, **kwargs)
8
+ self.tournament_id = 12
@@ -1,12 +1,7 @@
1
1
  """API for Numerai Classic"""
2
2
 
3
- import os
4
3
  import decimal
5
- from typing import List, Dict, Tuple, Union
6
- from io import BytesIO
7
-
8
- import requests
9
- import pandas as pd
4
+ from typing import List, Dict
10
5
 
11
6
  from numerapi import utils
12
7
  from numerapi import base_api
@@ -245,84 +240,6 @@ class NumerAPI(base_api.Api):
245
240
  _ = model_id
246
241
  self.logger.warning("Method submission_status is DEPRECATED and will be removed soon.")
247
242
 
248
- def upload_predictions(self, file_path: str = "predictions.csv",
249
- tournament: int = 8,
250
- model_id: str = None,
251
- df: pd.DataFrame = None,
252
- data_datestamp: int = None,
253
- timeout: Union[None, float, Tuple[float, float]] = (10, 600),
254
- ) -> str:
255
- """Upload predictions from file.
256
- Will read TRIGGER_ID from the environment if this model is enabled with
257
- a Numerai Compute cluster setup by Numerai CLI.
258
-
259
- Args:
260
- file_path (str): CSV file with predictions that will get uploaded
261
- tournament (int): ID of the tournament (optional, defaults to 8)
262
- -- DEPRECATED there is only one tournament nowadays
263
- model_id (str): Target model UUID (required for accounts with
264
- multiple models)
265
- df (pandas.DataFrame): pandas DataFrame to upload, if function is
266
- given df and file_path, df will be uploaded.
267
- data_datestamp (int): Data lag, in case submission is done using
268
- data from the previous day(s).
269
- timeout (float|tuple(float,float)): waiting time (connection timeout,
270
- read timeout)
271
-
272
- Returns:
273
- str: submission_id
274
-
275
- Example:
276
- >>> api = NumerAPI(secret_key="..", public_id="..")
277
- >>> model_id = api.get_models()['uuazed']
278
- >>> api.upload_predictions("prediction.cvs", model_id=model_id)
279
- '93c46857-fed9-4594-981e-82db2b358daf'
280
- >>> # upload from pandas DataFrame directly:
281
- >>> api.upload_predictions(df=predictions_df, model_id=model_id)
282
- """
283
- self.logger.info("uploading predictions...")
284
-
285
- # write the pandas DataFrame as a binary buffer if provided
286
- buffer_csv = None
287
-
288
- if df is not None:
289
- buffer_csv = BytesIO(df.to_csv(index=False).encode())
290
- buffer_csv.name = file_path
291
-
292
- upload_auth = self._upload_auth(
293
- 'submission_upload_auth', file_path, tournament, model_id)
294
-
295
- # get compute id if available and pass it along
296
- headers = {"x_compute_id": os.getenv("NUMERAI_COMPUTE_ID")}
297
- with open(file_path, 'rb') if df is None else buffer_csv as file:
298
- requests.put(
299
- upload_auth['url'], data=file.read(), headers=headers,
300
- timeout=timeout)
301
- create_query = '''
302
- mutation($filename: String!
303
- $tournament: Int!
304
- $modelId: String
305
- $triggerId: String,
306
- $dataDatestamp: Int) {
307
- create_submission(filename: $filename
308
- tournament: $tournament
309
- modelId: $modelId
310
- triggerId: $triggerId
311
- source: "numerapi"
312
- dataDatestamp: $dataDatestamp) {
313
- id
314
- }
315
- }
316
- '''
317
- arguments = {'filename': upload_auth['filename'],
318
- 'tournament': tournament,
319
- 'modelId': model_id,
320
- 'triggerId': os.getenv('TRIGGER_ID', None),
321
- 'dataDatestamp': data_datestamp}
322
- create = self.raw_query(create_query, arguments, authorization=True)
323
- submission_id = create['data']['create_submission']['id']
324
- return submission_id
325
-
326
243
  def get_leaderboard(self, limit: int = 50, offset: int = 0) -> List[Dict]:
327
244
  """Get the current model leaderboard
328
245
 
@@ -82,7 +82,8 @@ class SignalsAPI(base_api.Api):
82
82
  def upload_predictions(self, file_path: str = "predictions.csv",
83
83
  model_id: str = None,
84
84
  df: pd.DataFrame = None,
85
- timeout: Union[None, float, Tuple[float, float]] = (10, 60),
85
+ data_datestamp: int = None,
86
+ timeout: Union[None, float, Tuple[float, float]] = (10, 600)
86
87
  ) -> str:
87
88
  """Upload predictions from file.
88
89
  Will read TRIGGER_ID from the environment if this model is enabled with
@@ -118,45 +119,35 @@ class SignalsAPI(base_api.Api):
118
119
  buffer_csv = BytesIO(df.to_csv(index=False).encode())
119
120
  buffer_csv.name = file_path
120
121
 
121
- auth_query = '''
122
- query($filename: String!
123
- $modelId: String) {
124
- submissionUploadSignalsAuth(filename: $filename
125
- modelId: $modelId) {
126
- filename
127
- url
128
- }
129
- }
130
- '''
131
-
132
- arguments = {'filename': os.path.basename(file_path),
133
- 'modelId': model_id}
134
- submission_resp = self.raw_query(auth_query, arguments,
135
- authorization=True)
136
- auth = submission_resp['data']['submissionUploadSignalsAuth']
122
+ upload_auth = self._upload_auth(
123
+ 'submissionUploadSignalsAuth', file_path,
124
+ self.tournament_id, model_id)
137
125
 
138
126
  # get compute id if available and pass it along
139
127
  headers = {"x_compute_id": os.getenv("NUMERAI_COMPUTE_ID")}
140
128
 
141
129
  with open(file_path, 'rb') if df is None else buffer_csv as file:
142
- requests.put(auth['url'], data=file.read(),
130
+ requests.put(upload_auth['url'], data=file.read(),
143
131
  headers=headers, timeout=timeout)
144
132
  create_query = '''
145
133
  mutation($filename: String!
146
134
  $modelId: String
147
- $triggerId: String) {
135
+ $triggerId: String
136
+ $dataDatestamp: Int) {
148
137
  createSignalsSubmission(filename: $filename
149
138
  modelId: $modelId
150
139
  triggerId: $triggerId
151
- source: "numerapi") {
140
+ source: "numerapi"
141
+ dataDatestamp: $dataDatestamp) {
152
142
  id
153
143
  firstEffectiveDate
154
144
  }
155
145
  }
156
146
  '''
157
- arguments = {'filename': auth['filename'],
147
+ arguments = {'filename': upload_auth['filename'],
158
148
  'modelId': model_id,
159
- 'triggerId': os.getenv('TRIGGER_ID', None)}
149
+ 'triggerId': os.getenv('TRIGGER_ID', None),
150
+ 'dataDatestamp': data_datestamp}
160
151
  create = self.raw_query(create_query, arguments, authorization=True)
161
152
  return create['data']['createSignalsSubmission']['id']
162
153
 
@@ -307,8 +298,8 @@ class SignalsAPI(base_api.Api):
307
298
  >>> SignalsAPI().ticker_universe()
308
299
  ["MSFT", "AMZN", "APPL", ...]
309
300
  """
310
- path = self.download_dataset("signals/universe_public.csv")
311
- return pd.read_csv(path).ticker.tolist()
301
+ path = self.download_dataset("signals/v1.0/live.parquet")
302
+ return pd.read_parquet(path).numerai_ticker.tolist()
312
303
 
313
304
  def download_validation_data(self) -> None:
314
305
  """download CSV file with historical targets and ticker universe
@@ -0,0 +1,172 @@
1
+ Metadata-Version: 2.1
2
+ Name: numerapi
3
+ Version: 2.19.1
4
+ Summary: Automatically download and upload data for the Numerai machine learning competition
5
+ Home-page: https://github.com/uuazed/numerapi
6
+ Maintainer: uuazed
7
+ Maintainer-email: uuazed@gmail.com
8
+ License: MIT License
9
+ Platform: OS Independent
10
+ Classifier: Development Status :: 5 - Production/Stable
11
+ Classifier: Environment :: Console
12
+ Classifier: Intended Audience :: Science/Research
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Programming Language :: Python
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Topic :: Scientific/Engineering
18
+ Description-Content-Type: text/markdown
19
+ License-File: LICENSE
20
+
21
+ [![Build Status](https://app.travis-ci.com/uuazed/numerapi.svg)](https://app.travis-ci.com/uuazed/numerapi)
22
+ [![codecov](https://codecov.io/gh/uuazed/numerapi/branch/master/graph/badge.svg)](https://codecov.io/gh/uuazed/numerapi)
23
+ [![PyPI](https://img.shields.io/pypi/v/numerapi.svg)](https://pypi.python.org/pypi/numerapi)
24
+ [![Downloads](https://pepy.tech/badge/numerapi/month)](https://pepy.tech/project/numerapi)
25
+ [![Docs](https://readthedocs.org/projects/numerapi/badge/?version=stable)](http://numerapi.readthedocs.io/en/stable/?badge=stable)
26
+
27
+ # Numerai Python API
28
+ Automatically download and upload data for the Numerai machine learning
29
+ competition.
30
+
31
+ This library is a Python client to the Numerai API. The interface is programmed
32
+ in Python and allows downloading the training data, uploading predictions, and
33
+ accessing user, submission and competitions information. It works for both, the
34
+ main competition and the newer Numerai Signals competition.
35
+
36
+ If you encounter a problem or have suggestions, feel free to open an issue.
37
+
38
+ # Installation
39
+ `pip install --upgrade numerapi`
40
+
41
+ # Usage
42
+
43
+ Numerapi can be used as a regular, importable Python module or from the command
44
+ line.
45
+
46
+ Some actions (like uploading predictions or staking) require a token to verify
47
+ that it is really you interacting with Numerai's API. These tokens consists of
48
+ a `public_id` and `secret_key`. Both can be obtained by login in to Numer.ai and
49
+ going to Account -> Custom API Keys. Tokens can be passed to the Python module
50
+ as parameters or you can be set via environment variables (`NUMERAI_PUBLIC_ID`
51
+ and `NUMERAI_SECRET_KEY`).
52
+
53
+ ## Python module
54
+
55
+ ### Usage example - main competition
56
+
57
+ import numerapi
58
+ # some API calls do not require logging in
59
+ napi = numerapi.NumerAPI(verbosity="info")
60
+ # download current dataset => also check `https://numer.ai/data`
61
+ napi.download_dataset("v4/train.parquet", "train.parquet")
62
+ # get current leaderboard
63
+ leaderboard = napi.get_leaderboard()
64
+ # check if a new round has started
65
+ if napi.check_new_round():
66
+ print("new round has started within the last 12hours!")
67
+ else:
68
+ print("no new round within the last 12 hours")
69
+
70
+ # provide api tokens
71
+ example_public_id = "somepublicid"
72
+ example_secret_key = "somesecretkey"
73
+ napi = numerapi.NumerAPI(example_public_id, example_secret_key)
74
+
75
+ # upload predictions
76
+ model_id = napi.get_models()['uuazed']
77
+ napi.upload_predictions("preds.csv", model_id=model_id)
78
+ # increase your stake by 1.2 NMR
79
+ napi.stake_increase(1.2)
80
+
81
+ # convert results to a pandas dataframe
82
+ import pandas as pd
83
+ df = pd.DataFrame(napi.daily_user_performances("uuazed"))
84
+
85
+
86
+ ### Usage example - Numerai Signals
87
+
88
+ import numerapi
89
+
90
+ napi = numerapi.SignalsAPI()
91
+ # get current leaderboard
92
+ leaderboard = napi.get_leaderboard()
93
+
94
+ # setup API with api tokens
95
+ example_public_id = "somepublicid"
96
+ example_secret_key = "somesecretkey"
97
+ napi = numerapi.SignalsAPI(example_public_id, example_secret_key)
98
+
99
+ # upload predictions
100
+ model_id = napi.get_models()['uuazed']
101
+ napi.upload_predictions("preds.csv", model_id=model_id)
102
+
103
+ # get daily performance as pandas dataframe
104
+ import pandas as pd
105
+ df = pd.DataFrame(napi.daily_user_performances("uuazed"))
106
+
107
+ # using the diagnostics tool
108
+ napi.upload_diagnostics("preds.csv", model_id=model_id)
109
+ # ... or using a pandas DataFrame directly
110
+ napi.upload_diagnostics(df=df, model_id=model_id)
111
+ # fetch results
112
+ napi.diagnostic(model_id)
113
+
114
+
115
+ ## Command line interface
116
+
117
+ To get started with the cli interface, let's take a look at the help page:
118
+
119
+ $ numerapi --help
120
+ Usage: numerapi [OPTIONS] COMMAND [ARGS]...
121
+
122
+ Wrapper around the Numerai API
123
+
124
+ Options:
125
+ --help Show this message and exit.
126
+
127
+ Commands:
128
+ account Get all information about your account!
129
+ check-new-round Check if a new round has started within...
130
+ competitions Retrieves information about all...
131
+ current-round Get number of the current active round.
132
+ daily-model-performances Fetch daily performance of a model.
133
+ daily-submissions-performances Fetch daily performance of a user's...
134
+ dataset-url Fetch url of the current dataset.
135
+ download-dataset Download specified file for the given...
136
+ download-dataset-old Download dataset for the current active...
137
+ leaderboard Get the leaderboard.
138
+ list-datasets List of available data files
139
+ models Get map of account models!
140
+ profile Fetch the public profile of a user.
141
+ stake-decrease Decrease your stake by `value` NMR.
142
+ stake-drain Completely remove your stake.
143
+ stake-get Get stake value of a user.
144
+ stake-increase Increase your stake by `value` NMR.
145
+ submission-filenames Get filenames of your submissions
146
+ submit Upload predictions from file.
147
+ transactions List all your deposits and withdrawals.
148
+ user Get all information about you!...
149
+ version Installed numerapi version.
150
+
151
+
152
+ Each command has it's own help page, for example:
153
+
154
+ $ numerapi submit --help
155
+ Usage: numerapi submit [OPTIONS] PATH
156
+
157
+ Upload predictions from file.
158
+
159
+ Options:
160
+ --tournament INTEGER The ID of the tournament, defaults to 1
161
+ --model_id TEXT An account model UUID (required for accounts with
162
+ multiple models
163
+
164
+ --help Show this message and exit.
165
+
166
+
167
+ # API Reference
168
+
169
+ Checkout the [detailed API docs](http://numerapi.readthedocs.io/en/latest/api/numerapi.html#module-numerapi.numerapi)
170
+ to learn about all available methods, parameters and returned values.
171
+
172
+
@@ -4,6 +4,7 @@ setup.py
4
4
  numerapi/__init__.py
5
5
  numerapi/base_api.py
6
6
  numerapi/cli.py
7
+ numerapi/cryptoapi.py
7
8
  numerapi/numerapi.py
8
9
  numerapi/signalsapi.py
9
10
  numerapi/utils.py
@@ -6,7 +6,7 @@ def load(path):
6
6
  return open(path, 'r').read()
7
7
 
8
8
 
9
- numerapi_version = '2.18.0'
9
+ numerapi_version = '2.19.1'
10
10
 
11
11
 
12
12
  classifiers = [
numerapi-2.18.0/PKG-INFO DELETED
@@ -1,169 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: numerapi
3
- Version: 2.18.0
4
- Summary: Automatically download and upload data for the Numerai machine learning competition
5
- Home-page: https://github.com/uuazed/numerapi
6
- Maintainer: uuazed
7
- Maintainer-email: uuazed@gmail.com
8
- License: MIT License
9
- Description: [![Build Status](https://app.travis-ci.com/uuazed/numerapi.svg)](https://app.travis-ci.com/uuazed/numerapi)
10
- [![codecov](https://codecov.io/gh/uuazed/numerapi/branch/master/graph/badge.svg)](https://codecov.io/gh/uuazed/numerapi)
11
- [![PyPI](https://img.shields.io/pypi/v/numerapi.svg)](https://pypi.python.org/pypi/numerapi)
12
- [![Downloads](https://pepy.tech/badge/numerapi/month)](https://pepy.tech/project/numerapi)
13
- [![Docs](https://readthedocs.org/projects/numerapi/badge/?version=stable)](http://numerapi.readthedocs.io/en/stable/?badge=stable)
14
-
15
- # Numerai Python API
16
- Automatically download and upload data for the Numerai machine learning
17
- competition.
18
-
19
- This library is a Python client to the Numerai API. The interface is programmed
20
- in Python and allows downloading the training data, uploading predictions, and
21
- accessing user, submission and competitions information. It works for both, the
22
- main competition and the newer Numerai Signals competition.
23
-
24
- If you encounter a problem or have suggestions, feel free to open an issue.
25
-
26
- # Installation
27
- `pip install --upgrade numerapi`
28
-
29
- # Usage
30
-
31
- Numerapi can be used as a regular, importable Python module or from the command
32
- line.
33
-
34
- Some actions (like uploading predictions or staking) require a token to verify
35
- that it is really you interacting with Numerai's API. These tokens consists of
36
- a `public_id` and `secret_key`. Both can be obtained by login in to Numer.ai and
37
- going to Account -> Custom API Keys. Tokens can be passed to the Python module
38
- as parameters or you can be set via environment variables (`NUMERAI_PUBLIC_ID`
39
- and `NUMERAI_SECRET_KEY`).
40
-
41
- ## Python module
42
-
43
- ### Usage example - main competition
44
-
45
- import numerapi
46
- # some API calls do not require logging in
47
- napi = numerapi.NumerAPI(verbosity="info")
48
- # download current dataset => also check `https://numer.ai/data`
49
- napi.download_dataset("v4/train.parquet", "train.parquet")
50
- # get current leaderboard
51
- leaderboard = napi.get_leaderboard()
52
- # check if a new round has started
53
- if napi.check_new_round():
54
- print("new round has started within the last 12hours!")
55
- else:
56
- print("no new round within the last 12 hours")
57
-
58
- # provide api tokens
59
- example_public_id = "somepublicid"
60
- example_secret_key = "somesecretkey"
61
- napi = numerapi.NumerAPI(example_public_id, example_secret_key)
62
-
63
- # upload predictions
64
- model_id = napi.get_models()['uuazed']
65
- napi.upload_predictions("preds.csv", model_id=model_id)
66
- # increase your stake by 1.2 NMR
67
- napi.stake_increase(1.2)
68
-
69
- # convert results to a pandas dataframe
70
- import pandas as pd
71
- df = pd.DataFrame(napi.daily_user_performances("uuazed"))
72
-
73
-
74
- ### Usage example - Numerai Signals
75
-
76
- import numerapi
77
-
78
- napi = numerapi.SignalsAPI()
79
- # get current leaderboard
80
- leaderboard = napi.get_leaderboard()
81
-
82
- # setup API with api tokens
83
- example_public_id = "somepublicid"
84
- example_secret_key = "somesecretkey"
85
- napi = numerapi.SignalsAPI(example_public_id, example_secret_key)
86
-
87
- # upload predictions
88
- model_id = napi.get_models()['uuazed']
89
- napi.upload_predictions("preds.csv", model_id=model_id)
90
-
91
- # get daily performance as pandas dataframe
92
- import pandas as pd
93
- df = pd.DataFrame(napi.daily_user_performances("uuazed"))
94
-
95
- # using the diagnostics tool
96
- napi.upload_diagnostics("preds.csv", model_id=model_id)
97
- # ... or using a pandas DataFrame directly
98
- napi.upload_diagnostics(df=df, model_id=model_id)
99
- # fetch results
100
- napi.diagnostic(model_id)
101
-
102
-
103
- ## Command line interface
104
-
105
- To get started with the cli interface, let's take a look at the help page:
106
-
107
- $ numerapi --help
108
- Usage: numerapi [OPTIONS] COMMAND [ARGS]...
109
-
110
- Wrapper around the Numerai API
111
-
112
- Options:
113
- --help Show this message and exit.
114
-
115
- Commands:
116
- account Get all information about your account!
117
- check-new-round Check if a new round has started within...
118
- competitions Retrieves information about all...
119
- current-round Get number of the current active round.
120
- daily-model-performances Fetch daily performance of a model.
121
- daily-submissions-performances Fetch daily performance of a user's...
122
- dataset-url Fetch url of the current dataset.
123
- download-dataset Download specified file for the given...
124
- download-dataset-old Download dataset for the current active...
125
- leaderboard Get the leaderboard.
126
- list-datasets List of available data files
127
- models Get map of account models!
128
- profile Fetch the public profile of a user.
129
- stake-decrease Decrease your stake by `value` NMR.
130
- stake-drain Completely remove your stake.
131
- stake-get Get stake value of a user.
132
- stake-increase Increase your stake by `value` NMR.
133
- submission-filenames Get filenames of your submissions
134
- submit Upload predictions from file.
135
- transactions List all your deposits and withdrawals.
136
- user Get all information about you!...
137
- version Installed numerapi version.
138
-
139
-
140
- Each command has it's own help page, for example:
141
-
142
- $ numerapi submit --help
143
- Usage: numerapi submit [OPTIONS] PATH
144
-
145
- Upload predictions from file.
146
-
147
- Options:
148
- --tournament INTEGER The ID of the tournament, defaults to 1
149
- --model_id TEXT An account model UUID (required for accounts with
150
- multiple models
151
-
152
- --help Show this message and exit.
153
-
154
-
155
- # API Reference
156
-
157
- Checkout the [detailed API docs](http://numerapi.readthedocs.io/en/latest/api/numerapi.html#module-numerapi.numerapi)
158
- to learn about all available methods, parameters and returned values.
159
-
160
- Platform: OS Independent
161
- Classifier: Development Status :: 5 - Production/Stable
162
- Classifier: Environment :: Console
163
- Classifier: Intended Audience :: Science/Research
164
- Classifier: License :: OSI Approved :: MIT License
165
- Classifier: Operating System :: OS Independent
166
- Classifier: Programming Language :: Python
167
- Classifier: Programming Language :: Python :: 3
168
- Classifier: Topic :: Scientific/Engineering
169
- Description-Content-Type: text/markdown
@@ -1,169 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: numerapi
3
- Version: 2.18.0
4
- Summary: Automatically download and upload data for the Numerai machine learning competition
5
- Home-page: https://github.com/uuazed/numerapi
6
- Maintainer: uuazed
7
- Maintainer-email: uuazed@gmail.com
8
- License: MIT License
9
- Description: [![Build Status](https://app.travis-ci.com/uuazed/numerapi.svg)](https://app.travis-ci.com/uuazed/numerapi)
10
- [![codecov](https://codecov.io/gh/uuazed/numerapi/branch/master/graph/badge.svg)](https://codecov.io/gh/uuazed/numerapi)
11
- [![PyPI](https://img.shields.io/pypi/v/numerapi.svg)](https://pypi.python.org/pypi/numerapi)
12
- [![Downloads](https://pepy.tech/badge/numerapi/month)](https://pepy.tech/project/numerapi)
13
- [![Docs](https://readthedocs.org/projects/numerapi/badge/?version=stable)](http://numerapi.readthedocs.io/en/stable/?badge=stable)
14
-
15
- # Numerai Python API
16
- Automatically download and upload data for the Numerai machine learning
17
- competition.
18
-
19
- This library is a Python client to the Numerai API. The interface is programmed
20
- in Python and allows downloading the training data, uploading predictions, and
21
- accessing user, submission and competitions information. It works for both, the
22
- main competition and the newer Numerai Signals competition.
23
-
24
- If you encounter a problem or have suggestions, feel free to open an issue.
25
-
26
- # Installation
27
- `pip install --upgrade numerapi`
28
-
29
- # Usage
30
-
31
- Numerapi can be used as a regular, importable Python module or from the command
32
- line.
33
-
34
- Some actions (like uploading predictions or staking) require a token to verify
35
- that it is really you interacting with Numerai's API. These tokens consists of
36
- a `public_id` and `secret_key`. Both can be obtained by login in to Numer.ai and
37
- going to Account -> Custom API Keys. Tokens can be passed to the Python module
38
- as parameters or you can be set via environment variables (`NUMERAI_PUBLIC_ID`
39
- and `NUMERAI_SECRET_KEY`).
40
-
41
- ## Python module
42
-
43
- ### Usage example - main competition
44
-
45
- import numerapi
46
- # some API calls do not require logging in
47
- napi = numerapi.NumerAPI(verbosity="info")
48
- # download current dataset => also check `https://numer.ai/data`
49
- napi.download_dataset("v4/train.parquet", "train.parquet")
50
- # get current leaderboard
51
- leaderboard = napi.get_leaderboard()
52
- # check if a new round has started
53
- if napi.check_new_round():
54
- print("new round has started within the last 12hours!")
55
- else:
56
- print("no new round within the last 12 hours")
57
-
58
- # provide api tokens
59
- example_public_id = "somepublicid"
60
- example_secret_key = "somesecretkey"
61
- napi = numerapi.NumerAPI(example_public_id, example_secret_key)
62
-
63
- # upload predictions
64
- model_id = napi.get_models()['uuazed']
65
- napi.upload_predictions("preds.csv", model_id=model_id)
66
- # increase your stake by 1.2 NMR
67
- napi.stake_increase(1.2)
68
-
69
- # convert results to a pandas dataframe
70
- import pandas as pd
71
- df = pd.DataFrame(napi.daily_user_performances("uuazed"))
72
-
73
-
74
- ### Usage example - Numerai Signals
75
-
76
- import numerapi
77
-
78
- napi = numerapi.SignalsAPI()
79
- # get current leaderboard
80
- leaderboard = napi.get_leaderboard()
81
-
82
- # setup API with api tokens
83
- example_public_id = "somepublicid"
84
- example_secret_key = "somesecretkey"
85
- napi = numerapi.SignalsAPI(example_public_id, example_secret_key)
86
-
87
- # upload predictions
88
- model_id = napi.get_models()['uuazed']
89
- napi.upload_predictions("preds.csv", model_id=model_id)
90
-
91
- # get daily performance as pandas dataframe
92
- import pandas as pd
93
- df = pd.DataFrame(napi.daily_user_performances("uuazed"))
94
-
95
- # using the diagnostics tool
96
- napi.upload_diagnostics("preds.csv", model_id=model_id)
97
- # ... or using a pandas DataFrame directly
98
- napi.upload_diagnostics(df=df, model_id=model_id)
99
- # fetch results
100
- napi.diagnostic(model_id)
101
-
102
-
103
- ## Command line interface
104
-
105
- To get started with the cli interface, let's take a look at the help page:
106
-
107
- $ numerapi --help
108
- Usage: numerapi [OPTIONS] COMMAND [ARGS]...
109
-
110
- Wrapper around the Numerai API
111
-
112
- Options:
113
- --help Show this message and exit.
114
-
115
- Commands:
116
- account Get all information about your account!
117
- check-new-round Check if a new round has started within...
118
- competitions Retrieves information about all...
119
- current-round Get number of the current active round.
120
- daily-model-performances Fetch daily performance of a model.
121
- daily-submissions-performances Fetch daily performance of a user's...
122
- dataset-url Fetch url of the current dataset.
123
- download-dataset Download specified file for the given...
124
- download-dataset-old Download dataset for the current active...
125
- leaderboard Get the leaderboard.
126
- list-datasets List of available data files
127
- models Get map of account models!
128
- profile Fetch the public profile of a user.
129
- stake-decrease Decrease your stake by `value` NMR.
130
- stake-drain Completely remove your stake.
131
- stake-get Get stake value of a user.
132
- stake-increase Increase your stake by `value` NMR.
133
- submission-filenames Get filenames of your submissions
134
- submit Upload predictions from file.
135
- transactions List all your deposits and withdrawals.
136
- user Get all information about you!...
137
- version Installed numerapi version.
138
-
139
-
140
- Each command has it's own help page, for example:
141
-
142
- $ numerapi submit --help
143
- Usage: numerapi submit [OPTIONS] PATH
144
-
145
- Upload predictions from file.
146
-
147
- Options:
148
- --tournament INTEGER The ID of the tournament, defaults to 1
149
- --model_id TEXT An account model UUID (required for accounts with
150
- multiple models
151
-
152
- --help Show this message and exit.
153
-
154
-
155
- # API Reference
156
-
157
- Checkout the [detailed API docs](http://numerapi.readthedocs.io/en/latest/api/numerapi.html#module-numerapi.numerapi)
158
- to learn about all available methods, parameters and returned values.
159
-
160
- Platform: OS Independent
161
- Classifier: Development Status :: 5 - Production/Stable
162
- Classifier: Environment :: Console
163
- Classifier: Intended Audience :: Science/Research
164
- Classifier: License :: OSI Approved :: MIT License
165
- Classifier: Operating System :: OS Independent
166
- Classifier: Programming Language :: Python
167
- Classifier: Programming Language :: Python :: 3
168
- Classifier: Topic :: Scientific/Engineering
169
- Description-Content-Type: text/markdown
File without changes
File without changes
File without changes
File without changes
File without changes