Skip to content

Commit 0374b9a

Browse files
authored
feat(client): add Index price constituents (sammchardy#1511)
* Update client.py * Update async_client.py * Update test_client_futures.py * Update test_async_client_futures.py * __doc__ added to the new async methods * Update async_client.py
1 parent 4dfcd74 commit 0374b9a

File tree

4 files changed

+42
-0
lines changed

4 files changed

+42
-0
lines changed

binance/async_client.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1759,6 +1759,13 @@ async def futures_symbol_ticker(self, **params):
17591759
async def futures_orderbook_ticker(self, **params):
17601760
return await self._request_futures_api("get", "ticker/bookTicker", data=params)
17611761

1762+
async def futures_index_price_constituents(self, **params):
1763+
return await self._request_futures_api("get", "constituents", data=params)
1764+
1765+
futures_index_price_constituents.__doc__ = (
1766+
Client.futures_index_price_constituents.__doc__
1767+
)
1768+
17621769
async def futures_liquidation_orders(self, **params):
17631770
return await self._request_futures_api(
17641771
"get", "forceOrders", signed=True, data=params
@@ -2056,6 +2063,13 @@ async def futures_coin_orderbook_ticker(self, **params):
20562063
"get", "ticker/bookTicker", data=params
20572064
)
20582065

2066+
async def futures_coin_index_price_constituents(self, **params):
2067+
return await self._request_futures_coin_api("get", "constituents", data=params)
2068+
2069+
futures_coin_index_price_constituents.__doc__ = (
2070+
Client.futures_coin_index_price_constituents.__doc__
2071+
)
2072+
20592073
async def futures_coin_liquidation_orders(self, **params):
20602074
return await self._request_futures_coin_api(
20612075
"get", "forceOrders", signed=True, data=params

binance/client.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7293,6 +7293,14 @@ def futures_orderbook_ticker(self, **params):
72937293
"""
72947294
return self._request_futures_api("get", "ticker/bookTicker", data=params)
72957295

7296+
def futures_index_price_constituents(self, **params):
7297+
"""Get index price constituents
7298+
7299+
https://binance-docs.github.io/apidocs/futures/en/#query-index-price-constituents
7300+
7301+
"""
7302+
return self._request_futures_api("get", "constituents", data=params)
7303+
72967304
def futures_liquidation_orders(self, **params):
72977305
"""Get all liquidation orders
72987306
@@ -7897,6 +7905,14 @@ def futures_coin_orderbook_ticker(self, **params):
78977905
"""
78987906
return self._request_futures_coin_api("get", "ticker/bookTicker", data=params)
78997907

7908+
def futures_coin_index_price_constituents(self, **params):
7909+
"""Get index price constituents
7910+
7911+
https://binance-docs.github.io/apidocs/delivery/en/#query-index-price-constituents
7912+
7913+
"""
7914+
return self._request_futures_coin_api("get", "constituents", data=params)
7915+
79007916
def futures_coin_liquidation_orders(self, **params):
79017917
"""Get all liquidation orders
79027918

tests/test_async_client_futures.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,10 @@ async def test_futures_orderbook_ticker(futuresClientAsync):
9393
await futuresClientAsync.futures_orderbook_ticker()
9494

9595

96+
async def test_futures_index_index_price_constituents(futuresClientAsync):
97+
await futuresClientAsync.futures_index_price_constituents(symbol="BTCUSD")
98+
99+
96100
async def test_futures_liquidation_orders(futuresClientAsync):
97101
await futuresClientAsync.futures_liquidation_orders()
98102

@@ -444,6 +448,10 @@ async def test_futures_coin_orderbook_ticker(futuresClientAsync):
444448
await futuresClientAsync.futures_coin_orderbook_ticker()
445449

446450

451+
async def test_futures_coin_index_index_price_constituents(futuresClientAsync):
452+
await futuresClientAsync.futures_coin_index_price_constituents(symbol="BTCUSD")
453+
454+
447455
@pytest.mark.skip(reason="Not implemented")
448456
async def test_futures_coin_liquidation_orders(futuresClientAsync):
449457
await futuresClientAsync.futures_coin_liquidation_orders()

tests/test_client_futures.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@ def test_futures_symbol_ticker(futuresClient):
104104
def test_futures_orderbook_ticker(futuresClient):
105105
futuresClient.futures_orderbook_ticker()
106106

107+
def test_futures_index_index_price_constituents(futuresClient):
108+
futuresClient.futures_index_price_constituents(symbol="BTCUSD")
107109

108110
def test_futures_liquidation_orders(futuresClient):
109111
futuresClient.futures_liquidation_orders()
@@ -445,6 +447,8 @@ def test_futures_coin_symbol_ticker(futuresClient):
445447
def test_futures_coin_orderbook_ticker(futuresClient):
446448
futuresClient.futures_coin_orderbook_ticker()
447449

450+
def test_futures_coin_index_index_price_constituents(futuresClient):
451+
futuresClient.futures_coin_index_price_constituents(symbol="BTCUSD")
448452

449453
@pytest.mark.skip(reason="Not implemented")
450454
def test_futures_coin_liquidation_orders(futuresClient):

0 commit comments

Comments
 (0)