numerapi.signalsapi module¶
API for Numerai Signals
- class numerapi.signalsapi.SignalsAPI(*args, **kwargs)[source]¶
Bases:
Api
“API for Numerai Signals
- daily_model_performances(username: str) List[Dict] [source]¶
Fetch daily Numerai Signals performance of a model.
- Parameters:
username (str) –
- Returns:
list of daily user performance entries
For each entry in the list, there is a dict with the following content:
date (datetime)
corrRank (int)
corrRep (float or None)
mmcRank (int)
mmcRep (float or None)
icRank (int)
icRep (float or None)
tcRank (int)
tcRep (float or None)
corr20dRank (int)
corr20dRep (float or None)
corr60Rank (int)
corr60Rep (float or None)
mmc20dRank (int)
mmc20dRep (float or None)
- Return type:
list of dicts
Example
>>> api = SignalsAPI() >>> api.daily_model_performances("floury_kerril_moodle") [{'corrRank': 45, 'corrRep': -0.00010935616731632354, 'corr20dRank': None, 'corr20dRep': None, 'mmc20dRank': None, 'mmc20dRep': None, 'date': datetime.datetime(2020, 9, 18, 0, 0, tzinfo=tzutc()), 'mmcRank': 6, 'mmcRep': 0.0, 'icRank': 6, 'icRep': 0.0, ...}, ... ]
- download_validation_data() None [source]¶
download CSV file with historical targets and ticker universe
- get_leaderboard(limit: int = 50, offset: int = 0) List[Dict] [source]¶
Get the current Numerai Signals leaderboard :param limit: number of items to return (optional, defaults to 50) :type limit: int :param offset: number of items to skip (optional, defaults to 0) :type offset: int
- Returns:
list of leaderboard entries Each dict contains the following items:
username (str)
sharpe (float)
rank (int)
prevRank (int)
today (float)
mmc (float)
mmcRank (int)
icRep (float)
icRank (int)
tcRep (float)
tcRank (int)
nmrStaked (float)
- Return type:
list of dicts
Example
>>> numerapi.SignalsAPI().get_leaderboard(1) [{'prevRank': 1, 'rank': 1, 'sharpe': 2.3, 'today': 0.01321, 'username': 'floury_kerril_moodle', 'mmc': -0.0101202715, 'mmcRank': 30, 'nmrStaked': 13.0, 'icRep': -0.0101202715, 'icRank': 30, .. }]
- public_user_profile(username: str) Dict [source]¶
Fetch the public Numerai Signals profile of a user.
- Parameters:
username (str) –
- Returns:
user profile including the following fields:
username (str)
startDate (datetime)
id (string)
bio (str)
nmrStaked (decimal.Decimal)
- Return type:
dict
Example
>>> api = SignalsAPI() >>> api.public_user_profile("floury_kerril_moodle") {'bio': None, 'id': '635db2a4-bdc6-4e5d-b515-f5120392c8c9', 'startDate': datetime.datetime(2019, 3, 26, 0, 43), 'username': 'floury_kerril_moodle', 'nmrStaked': Decimal('14.630994874320760131')}
- stake_get(username) Decimal [source]¶
get current stake for a given users
- Parameters:
username (str) –
- Returns:
current stake
- Return type:
decimal.Decimal
Example
>>> SignalsAPI().stake_get("uuazed") Decimal('14.63')
- submission_status(model_id: str | None = None) None [source]¶
submission status of the last submission associated with the account
DEPRECATED numerai no longer provides this data. This will be removed in one of the next versions
- Parameters:
model_id (str) –
Example
>>> api = SignalsAPI(secret_key="..", public_id="..") >>> model_id = api.get_models()['uuazed'] >>> api.submission_status(model_id)
- ticker_universe() List[str] [source]¶
fetch universe of accepted tickers
- Returns:
list of currently accepted tickers
- Return type:
list of strings
Example
>>> SignalsAPI().ticker_universe() ["MSFT", "AMZN", "APPL", ...]
- upload_predictions(file_path: str = 'predictions.csv', model_id: str | None = None, df: DataFrame | None = None, timeout: None | float | Tuple[float, float] = (10, 60)) str [source]¶
Upload predictions from file. Will read TRIGGER_ID from the environment if this model is enabled with a Numerai Compute cluster setup by Numerai CLI.
- Parameters:
file_path (str) – CSV file with predictions that will get uploaded
model_id (str) – Target model UUID (required for accounts with multiple models)
df (pandas.DataFrame) – Pandas DataFrame to upload, if function is given df and file_path, df will be uploaded
timeout (float|tuple(float,float)) – waiting time (connection timeout, read timeout)
- Returns:
submission_id
- Return type:
str
Example
>>> api = SignalsAPI(secret_key="..", public_id="..") >>> model_id = api.get_models()['uuazed'] >>> api.upload_predictions("prediction.cvs", model_id=model_id) '93c46857-fed9-4594-981e-82db2b358daf'
>>> # upload directly from a pandas DataFrame: >>> api.upload_predictions(df = predictions_df, model_id=model_id)