Skip to content

Commit 59d6992

Browse files
authored
Merge pull request sammchardy#720 from AlexNik/get_daily_snapshot_endpoint
Add Get Daily Account Snapshot endpoint
2 parents 0f7154a + 82f6580 commit 59d6992

3 files changed

Lines changed: 120 additions & 2 deletions

File tree

Endpoints.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@
1414
```
1515
- **GET /sapi/v1/capital/config/getall (HMAC SHA256)** (Get information of coins (available for deposit and withdraw) for user.)
1616

17-
> :warning: Not yet implemented
1817
- **GET /sapi/v1/accountSnapshot (HMAC SHA256)** (Daily Account Snapshot (USER_DATA).)
19-
18+
```python
19+
client.get_account_snapshot(type='SPOT')
20+
```
21+
2022
> :warning: Not yet implemented
2123
- **POST /sapi/v1/account/disableFastWithdrawSwitch (HMAC SHA256)** (Disable Fast Withdraw Switch (USER_DATA).)
2224

binance/client.py

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5583,3 +5583,111 @@ def get_all_coins_info(self, **params):
55835583
55845584
"""
55855585
return self._request_margin_api('get', 'capital/config/getall', True, data=params)
5586+
5587+
def get_account_snapshot(self, **params):
5588+
"""Get daily account snapshot of specific type.
5589+
5590+
https://binance-docs.github.io/apidocs/spot/en/#daily-account-snapshot-user_data
5591+
5592+
:param type: required. Valid values are SPOT/MARGIN/FUTURES.
5593+
:type type: string
5594+
:param startTime: optional
5595+
:type startTime: int
5596+
:param endTime: optional
5597+
:type endTime: int
5598+
:param limit: optional
5599+
:type limit: int
5600+
:param recvWindow: optional
5601+
:type recvWindow: int
5602+
:param timestamp: requred
5603+
:type timestamp: int
5604+
5605+
:returns: API response
5606+
5607+
.. code-block:: python
5608+
{
5609+
"code":200, // 200 for success; others are error codes
5610+
"msg":"", // error message
5611+
"snapshotVos":[
5612+
{
5613+
"data":{
5614+
"balances":[
5615+
{
5616+
"asset":"BTC",
5617+
"free":"0.09905021",
5618+
"locked":"0.00000000"
5619+
},
5620+
{
5621+
"asset":"USDT",
5622+
"free":"1.89109409",
5623+
"locked":"0.00000000"
5624+
}
5625+
],
5626+
"totalAssetOfBtc":"0.09942700"
5627+
},
5628+
"type":"spot",
5629+
"updateTime":1576281599000
5630+
}
5631+
]
5632+
}
5633+
OR
5634+
{
5635+
"code":200, // 200 for success; others are error codes
5636+
"msg":"", // error message
5637+
"snapshotVos":[
5638+
{
5639+
"data":{
5640+
"marginLevel":"2748.02909813",
5641+
"totalAssetOfBtc":"0.00274803",
5642+
"totalLiabilityOfBtc":"0.00000100",
5643+
"totalNetAssetOfBtc":"0.00274750",
5644+
"userAssets":[
5645+
{
5646+
"asset":"XRP",
5647+
"borrowed":"0.00000000",
5648+
"free":"1.00000000",
5649+
"interest":"0.00000000",
5650+
"locked":"0.00000000",
5651+
"netAsset":"1.00000000"
5652+
}
5653+
]
5654+
},
5655+
"type":"margin",
5656+
"updateTime":1576281599000
5657+
}
5658+
]
5659+
}
5660+
OR
5661+
{
5662+
"code":200, // 200 for success; others are error codes
5663+
"msg":"", // error message
5664+
"snapshotVos":[
5665+
{
5666+
"data":{
5667+
"assets":[
5668+
{
5669+
"asset":"USDT",
5670+
"marginBalance":"118.99782335",
5671+
"walletBalance":"120.23811389"
5672+
}
5673+
],
5674+
"position":[
5675+
{
5676+
"entryPrice":"7130.41000000",
5677+
"markPrice":"7257.66239673",
5678+
"positionAmt":"0.01000000",
5679+
"symbol":"BTCUSDT",
5680+
"unRealizedProfit":"1.24029054"
5681+
}
5682+
]
5683+
},
5684+
"type":"futures",
5685+
"updateTime":1576281599000
5686+
}
5687+
]
5688+
}
5689+
5690+
:raises: BinanceRequestException, BinanceAPIException
5691+
5692+
"""
5693+
return self._request_margin_api('get', 'accountSnapshot', True, data=params)

docs/general.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,14 @@ Get information of coins (available for deposit and withdraw) for user
5656
5757
info = client.get_all_coins_info()
5858
59+
`Get Get Daily Account Snapshot <binance.html#binance.client.Client.get_account_snapshot>`_
60+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
61+
62+
Get daily account snapshot of specific type. Valid types: SPOT/MARGIN/FUTURES.
63+
64+
.. code:: python
65+
info = client.get_account_snapshot(type='SPOT')
66+
5967
`Get Current Products <binance.html#binance.client.Client.get_products>`_
6068
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6169

0 commit comments

Comments
 (0)