I’m trying to do some stake-related calculations using numerapi inside python and I’m running into a few issues.
First, there seems to be a bug with get_stakes() in that it doesn’t operate as advertised (indeed, it crashes). I already posted an issue on github about that one.
I found two other (functioning) API calls that seem to report stake information. The first is stake_get() and it runs like this:
Note the different values. Which is correct?
The latter number is what’s reported by the numerai UI:
And it’s also what appears as the stake for the current round (250):
Questions:
What does the output of stake_get() mean?
Why do the numbers from stake_get() and public_user_profile() differ?
Why do neither of these stake measures (nor the value displayed under “NMR Staked” in the UI) reflect the total stake across all the four current rounds?
Once get_stakes() is fixed, should there really be three ways of getting stake information and if so shouldn’t they all return consistent results?
I realize my post touches on API questions and also on the whole complex business of staking. I’m eager for input from anyone who can help me understand either better!
In general, numerapi is developed by the community (mainly me) and it’s meant to simplify the interaction with numerai’s API for Python users. The numerai guys are taking care of the data, what is available etc. Numerapi interacts with the graphql backend and provides all relevant information via a python interface. In case you are curious, you can browse their API on https://api-tournament.numer.ai/
Regarding your questions
earnings are currently automatically added to your stake. stake_get includes your earnings from not fully resolved rounds. So this value is changing with every daily score.
in contrast, the stake value in public_user_profile does not contain those future earnings. Thus, this is the NMR you’ve staked
Summing up those stakes doesn’t make sense. It’s the same NMR that is staked. For example you staked around 50NMR, not 200 (4 x 50)
get_stakes was a left-over, which I removed in the latest numerapi release. Thanks for reporting! (In the past, users needed to stake every round - meaning stakes did not roll-over to the next round. That get_stakes function allowed to get your stakes per round. This is no longer relevant and numerai is no longer providing that information)
This was very helpful - thank you. I learned a lot about the graphql approach by digging into the numerapi code and those docs.
Still, I predict that the choice to include expected earnings in one stake value and not in the other will be just as confusing to future users as it is (or, was) to me. Might it make more sense to offer an optional keyword param like include_future_earnings to any and all stake calls, and/or always include the future estimated earnings as a second returned value? In other words, anytime you ask for stakes you get back two values instead of one, perhaps committed_stakes and estimated_earnings or something similar?
The keyword approach won’t work in that case, because I don’t control what the numerai graphql backend returns. So returning two values for stakes would be a task for the numerai guys to implement. Once the information is there, we could adjust numerapi accordingly.
However, I’ll update the documentation to make it more obvious what is going on.