python-binance icon indicating copy to clipboard operation
python-binance copied to clipboard

How to get Staking data?

Open alexandrechoske opened this issue 3 years ago • 7 comments

Hi, is there a way to retrieve the staking data trhough the API?

I Found this on Binance API.

https://docs.binance.org/api-reference/dex-api/staking.html

But did not find any related paths in Python-Binance

Thanks in advance.

alexandrechoske avatar Mar 01 '22 16:03 alexandrechoske

Sorry but I didnt understand, what is benc13? And syncrhonize where? I am just using the python-binance api...

alexandrechoske avatar Mar 02 '22 02:03 alexandrechoske

What you found is staking doc for binance chain, not the centralized exchange.

AFAIK, there is no way to get staking data through any existing API in binance exchange.

Reference thread: https://dev.binance.vision/t/earn-locked-staking/1453

halfelf avatar Mar 04 '22 02:03 halfelf

Good news, binance has added staking API since 28th Apr. This could be done by calling some "private" methods in this library.

GET /sapi/v1/staking/productList to get Staking product list
POST /sapi/v1/staking/purchase to stake product
POST /sapi/v1/staking/redeem to redeem product
GET /sapi/v1/staking/position to get Staking product holding position
GET /sapi/v1/staking/stakingRecord to inquiry Staking history records
POST /sapi/v1/staking/setAutoStaking to set Auto Staking function
GET /sapi/v1/staking/personalLeftQuota to inquiry Staking left quota

halfelf avatar May 03 '22 02:05 halfelf

How does one create a private method? I couldn't find this in the documentation, or any issues with an example. I'm able to make the calls manually within python, but i'd rather use this module, cuz them i'm sure i'm not rate limiting. (perhaps somewhat lazy)

solipsist01 avatar May 06 '22 05:05 solipsist01

@solipsist01 You don't "create" private method. This library has wrapped the http request well. The only thing you need is to find the right endpoint and params.

I have a forked project from this lib and wrapped these API.

ref: https://github.com/halfelf/trio-binance/blob/master/trio_binance/client.py#L1173

Similarly, one can directly call those "margin request" method in this lib:

client._request_margin_api('get', 'staking/productList', True, data={'product': 'STAKING'})

halfelf avatar May 06 '22 07:05 halfelf

Was anyone able to use GET /sapi/v1/staking/personalLeftQuota(HMAC SHA256), or the POST /sapi/v1/staking/purchase (HMAC SHA256) endpoint ? These endpoints ask for a productId. but only a projectId is supplied in the output of the GET /sapi/v1/staking/productList (HMAC SHA256) endpoint.

No endpoint gives me a productId.

when i use projectId i get the error that GET isn't supported for this endpoint.

solipsist01 avatar May 07 '22 09:05 solipsist01

Hello, I`m having the same issue, I need to call endpoints such as GET /sapi/v1/staking/productList and /sapi/v1/staking/stakingRecord, but I could not found way to do it.

Anyone have done this before? Thanks

Menniti avatar Sep 20 '22 16:09 Menniti