From 5ed7c2ea9d665eda4e922e30b91601664d9ba24c Mon Sep 17 00:00:00 2001 From: Bernardo Braga Date: Sun, 4 Jan 2026 15:51:50 +0000 Subject: [PATCH 1/2] adding get_leaderboard for crypto tournament --- numerapi/cryptoapi.py | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/numerapi/cryptoapi.py b/numerapi/cryptoapi.py index 43beaa1..84f8526 100644 --- a/numerapi/cryptoapi.py +++ b/numerapi/cryptoapi.py @@ -1,10 +1,49 @@ """API for Numerai Crypto""" +from typing import List, Dict from numerapi import base_api +from numerapi import utils + class CryptoAPI(base_api.Api): """"API for Numerai Crypto""" - + # def __init__(self, *args, **kwargs): base_api.Api.__init__(self, *args, **kwargs) self.tournament_id = 12 + # + def get_leaderboard(self, limit: int = 50, offset: int = 0) -> List[Dict]: + """Get the current Numerai Crypto leaderboard with a reduced set of fields. + # + Returns: + list of dicts: each dict contains only the requested fields: + - nmrStaked + - rank + - username + - corrRep + - mmcRep + - return_1_day + - return_52_weeks + - return_13_weeks + """ + query = ''' + query($limit: Int! + $offset: Int!) { + cryptosignalsLeaderboard(limit: $limit + offset: $offset) { + nmrStaked + rank + username + corrRep + mmcRep + return_1_day + return_52_weeks + return_13_weeks + } + } + ''' + arguments = {'limit': limit, 'offset': offset} + data = self.raw_query(query, arguments)['data']['cryptosignalsLeaderboard'] + for item in data: + utils.replace(item, "nmrStaked", utils.parse_float_string) + return data From c9b3638a02fb2129f539bea3a1c39641940353ca Mon Sep 17 00:00:00 2001 From: Bernardo Braga Date: Sun, 4 Jan 2026 16:05:16 +0000 Subject: [PATCH 2/2] cleaning # leftovers --- numerapi/cryptoapi.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/numerapi/cryptoapi.py b/numerapi/cryptoapi.py index 84f8526..4f98e91 100644 --- a/numerapi/cryptoapi.py +++ b/numerapi/cryptoapi.py @@ -7,14 +7,14 @@ class CryptoAPI(base_api.Api): """"API for Numerai Crypto""" - # + def __init__(self, *args, **kwargs): base_api.Api.__init__(self, *args, **kwargs) self.tournament_id = 12 - # + def get_leaderboard(self, limit: int = 50, offset: int = 0) -> List[Dict]: """Get the current Numerai Crypto leaderboard with a reduced set of fields. - # + Returns: list of dicts: each dict contains only the requested fields: - nmrStaked