Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add futures data link #1521

Merged
merged 2 commits into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions binance/async_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -3913,3 +3913,12 @@ async def margin_max_borrowable(self, **params):
)

margin_max_borrowable.__doc__ = Client.margin_max_borrowable.__doc__

####################################################
# Futures Data
####################################################

async def futures_historical_data_link(self, **params):
return await self._request_margin_api("get", "futures/data/histDataLink", signed=True, data=params)

futures_historical_data_link.__doc__ = Client.futures_historical_data_link.__doc__
47 changes: 47 additions & 0 deletions binance/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -11483,3 +11483,50 @@ def margin_max_borrowable(self, **params):
return self._request_margin_api(
"get", "margin/maxBorrowable", signed=True, data=params
)

####################################################
# Futures Data
####################################################

def futures_historical_data_link(self, **params):
"""Get Future TickLevel Orderbook Historical Data Download Link.

https://developers.binance.com/docs/derivatives/futures-data/market-data

:param symbol: STRING - Required - Symbol name, e.g. BTCUSDT or BTCUSD_PERP
:type symbol: str
:param dataType: ENUM - Required - Data type:
- T_DEPTH for ticklevel orderbook data
- S_DEPTH for orderbook snapshot data
:type dataType: str
:param startTime: LONG - Required - Start time in milliseconds
:type startTime: int
:param endTime: LONG - Required - End time in milliseconds
:type endTime: int
:param recvWindow: LONG - Optional - Number of milliseconds after timestamp the request is valid for
:type recvWindow: int
:param timestamp: LONG - Required - Current timestamp in milliseconds
:type timestamp: int

:returns: API response

.. code-block:: python

{
"data": [
{
"day": "2023-06-30",
"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"
}
]
}

:raises: BinanceRequestException, BinanceAPIException

Notes:
- The span between startTime and endTime can't be more than 7 days
- The download link will be valid for 1 day
- Only VIP users can query this endpoint
- Weight: 200
"""
return self._request_margin_api("get", "futures/data/histDataLink", signed=True, data=params)
Loading