Skip to content

Commit 3429013

Browse files
authored
feat: add futures data link (#1521)
* feat: add futures data link * fix pyright
1 parent 08b060f commit 3429013

File tree

2 files changed

+56
-0
lines changed

2 files changed

+56
-0
lines changed

binance/async_client.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3985,3 +3985,12 @@ async def margin_max_borrowable(self, **params):
39853985
)
39863986

39873987
margin_max_borrowable.__doc__ = Client.margin_max_borrowable.__doc__
3988+
3989+
####################################################
3990+
# Futures Data
3991+
####################################################
3992+
3993+
async def futures_historical_data_link(self, **params):
3994+
return await self._request_margin_api("get", "futures/data/histDataLink", signed=True, data=params)
3995+
3996+
futures_historical_data_link.__doc__ = Client.futures_historical_data_link.__doc__

binance/client.py

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13468,3 +13468,50 @@ def margin_max_borrowable(self, **params):
1346813468
return self._request_margin_api(
1346913469
"get", "margin/maxBorrowable", signed=True, data=params
1347013470
)
13471+
13472+
####################################################
13473+
# Futures Data
13474+
####################################################
13475+
13476+
def futures_historical_data_link(self, **params):
13477+
"""Get Future TickLevel Orderbook Historical Data Download Link.
13478+
13479+
https://developers.binance.com/docs/derivatives/futures-data/market-data
13480+
13481+
:param symbol: STRING - Required - Symbol name, e.g. BTCUSDT or BTCUSD_PERP
13482+
:type symbol: str
13483+
:param dataType: ENUM - Required - Data type:
13484+
- T_DEPTH for ticklevel orderbook data
13485+
- S_DEPTH for orderbook snapshot data
13486+
:type dataType: str
13487+
:param startTime: LONG - Required - Start time in milliseconds
13488+
:type startTime: int
13489+
:param endTime: LONG - Required - End time in milliseconds
13490+
:type endTime: int
13491+
:param recvWindow: LONG - Optional - Number of milliseconds after timestamp the request is valid for
13492+
:type recvWindow: int
13493+
:param timestamp: LONG - Required - Current timestamp in milliseconds
13494+
:type timestamp: int
13495+
13496+
:returns: API response
13497+
13498+
.. code-block:: python
13499+
13500+
{
13501+
"data": [
13502+
{
13503+
"day": "2023-06-30",
13504+
"url": "https://bin-prod-user-rebate-bucket.s3.ap-northeast-1.amazonaws.com/future-data-symbol-update/2023-06-30/BTCUSDT_T_DEPTH_2023-06-30.tar.gz?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20230925T025710Z&X-Amz-SignedHeaders=host&X-Amz-Expires=86399&X-Amz-Credential=AKIAVL364M5ZNFZ74IPP%2F20230925%2Fap-northeast-1%2Fs3%2Faws4_request&X-Amz-Signature=5fffcb390d10f34d71615726f81f99e42d80a11532edeac77b858c51a88cbf59"
13505+
}
13506+
]
13507+
}
13508+
13509+
:raises: BinanceRequestException, BinanceAPIException
13510+
13511+
Notes:
13512+
- The span between startTime and endTime can't be more than 7 days
13513+
- The download link will be valid for 1 day
13514+
- Only VIP users can query this endpoint
13515+
- Weight: 200
13516+
"""
13517+
return self._request_margin_api("get", "futures/data/histDataLink", signed=True, data=params)

0 commit comments

Comments
 (0)