Numerai Python API
Automatically download and upload data for the Numerai machine learning competition
This library is a client to the Numerai API. The interface is programmed in Python and allows downloading the training data, uploading predictions, and accessing some user information. Some parts of the code were taken from numerflow by ChristianSch. Visit his wiki, if you need further information on the reverse engineering process.
If you encounter a problem or have suggestions, feel free to open an issue.
Installation
This library supports both Python 2 and 3. Clone this repository, then cd
into this repository's directory. Then pip install -e .
Usage
See the example.py. You can run it as ./example.py
Documentation
download_current_dataset
Parameters
dest_path
: Optional parameter. Destination folder for the dataset. Default: currrent working directory.unzip
: Optional parameter. Decide if you wish to unzip the downloaded training data. Default: True
Return values
status_code
: Status code of the requests operation.
upload_prediction
Parameters
file_path
: Path to the prediction. It should already contain the file name ('path/to/file/prediction.csv')
Return values
status_code
: Status code of the requests operation.
Notes
- Uploading a prediction shortly before a new dataset is released may result in a <400 Bad Request>. If this happens, just wait for the new dataset and upload new predictions then.
- Uploading too many predictions in a certain amount of time will result in a <429 Too Many Requests>.
- Uploading predictions to an account that has 2FA (Two Factor Authentication) enabled is not currently supported
get_user
Parameters
username
: Name of the user you want to request.
Return values
array-like
: Tuple of size nine containing theusername
,submission_id
,validation_logloss
,validation_consistency
,originality
,concordance
,career_usd
,career_nmr
and the status code of the requests operation. If it fails all values except the status code will beNone
.
get_scores
Parameters
username
: Name of the user you want to request.
Return values
array-like
: Tuple of size 2 containing anumpy.ndarray
containing the scores of all uploaded predictions with the newest first and the status code of the requests operation. If it fails all values except the status code will beNone
.
get_earnings_per_round
Parameters
username
: Name of the user you want to request.
Return values
array-like
: Tuple of size 2 containing anumpy.ndarray
containing the earnings of each round with the oldest first and the status code of the requests operation. If it fails all values except the status code will beNone
.
login
Return values
array-like
: Tuple of size four containing theaccessToken
,refreshToken
,id
, and the status code of the requests operation. If it fails all values except the status code will beNone
.
authorize
Parameters
file_path
: Path to the prediction. It should already contain the file name ('path/to/file/prediction.csv')
Return values
array-like
: Tuple of size four containing thefilename
,signedRequest
,headers
, and the status code of the requests operation. If it fails all values except the status code will beNone
.
get_current_competition
Return values
array-like
: Tuple of size three containing thedataset_id
,_id
and the status code of the requests operation. If it fails all values except the status code will beNone
.
get_new_leaderboard
Return Values
list
: A list of every user that has submitted in this round of the competition, including statistics like how much USD and NMR were earned by that user in that round.
Notes
- Each round of the competition is numbered. The first competition is 1. Specify a round of the competition to get leaderboard information for that round, or leave off the round of the competition to get the current round of the competition.