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

Binance links update #519

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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
42 changes: 21 additions & 21 deletions binance/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ def get_all_tickers(self):
:raises: BinanceRequestException, BinanceAPIException

"""
return self._get('ticker/allPrices')
return self._get('allPrices')

def get_orderbook_tickers(self):
"""Best price/qty on the order book for all symbols.
Expand Down Expand Up @@ -466,7 +466,7 @@ def get_orderbook_tickers(self):
:raises: BinanceRequestException, BinanceAPIException

"""
return self._get('ticker/allBookTickers')
return self._get('allBookTickers')

def get_order_book(self, **params):
"""Get the Order Book for the market
Expand Down Expand Up @@ -996,7 +996,7 @@ def get_ticker(self, **params):
:raises: BinanceRequestException, BinanceAPIException

"""
return self._get('ticker/24hr', data=params)
return self._get('24hr', data=params)

def get_symbol_ticker(self, **params):
"""Latest price for a symbol or symbols.
Expand Down Expand Up @@ -1033,7 +1033,7 @@ def get_symbol_ticker(self, **params):
:raises: BinanceRequestException, BinanceAPIException

"""
return self._get('ticker/price', data=params, version=self.PRIVATE_API_VERSION)
return self._get('price', data=params, version=self.PRIVATE_API_VERSION)

def get_orderbook_ticker(self, **params):
"""Latest price for a symbol or symbols.
Expand Down Expand Up @@ -1079,7 +1079,7 @@ def get_orderbook_ticker(self, **params):
:raises: BinanceRequestException, BinanceAPIException

"""
return self._get('ticker/bookTicker', data=params, version=self.PRIVATE_API_VERSION)
return self._get('bookTicker', data=params, version=self.PRIVATE_API_VERSION)

# Account Endpoints

Expand Down Expand Up @@ -3465,15 +3465,15 @@ def futures_exchange_info(self):
def futures_order_book(self, **params):
"""Get the Order Book for the market

https://binance-docs.github.io/apidocs/futures/en/#order-book-market_data
https://binance-docs.github.io/apidocs/futures/en/#order-book

"""
return self._request_futures_api('get', 'depth', data=params)

def futures_recent_trades(self, **params):
"""Get recent trades (up to last 500).

https://binance-docs.github.io/apidocs/futures/en/#recent-trades-list-market_data
https://binance-docs.github.io/apidocs/futures/en/#recent-trades-list

"""
return self._request_futures_api('get', 'trades', data=params)
Expand All @@ -3490,23 +3490,23 @@ def futures_aggregate_trades(self, **params):
"""Get compressed, aggregate trades. Trades that fill at the time, from the same order, with the same
price will have the quantity aggregated.

https://binance-docs.github.io/apidocs/futures/en/#compressed-aggregate-trades-list-market_data
https://binance-docs.github.io/apidocs/futures/en/#compressed-aggregate-trades-list

"""
return self._request_futures_api('get', 'aggTrades', data=params)

def futures_klines(self, **params):
"""Kline/candlestick bars for a symbol. Klines are uniquely identified by their open time.

https://binance-docs.github.io/apidocs/futures/en/#kline-candlestick-data-market_data
https://binance-docs.github.io/apidocs/futures/en/#kline-candlestick-data

"""
return self._request_futures_api('get', 'klines', data=params)

def futures_mark_price(self, **params):
"""Get Mark Price and Funding Rate

https://binance-docs.github.io/apidocs/futures/en/#mark-price-market_data
https://binance-docs.github.io/apidocs/futures/en/#mark-price

"""
return self._request_futures_api('get', 'premiumIndex', data=params)
Expand All @@ -3522,50 +3522,50 @@ def futures_funding_rate(self, **params):
def futures_ticker(self, **params):
"""24 hour rolling window price change statistics.

https://binance-docs.github.io/apidocs/futures/en/#24hr-ticker-price-change-statistics-market_data
https://binance-docs.github.io/apidocs/futures/en/#24hr-ticker-price-change-statistics

"""
return self._request_futures_api('get', 'ticker/24hr', data=params)

def futures_symbol_ticker(self, **params):
"""Latest price for a symbol or symbols.

https://binance-docs.github.io/apidocs/futures/en/#symbol-price-ticker-market_data
https://binance-docs.github.io/apidocs/futures/en/#symbol-price-ticker

"""
return self._request_futures_api('get', 'ticker/price', data=params)

def futures_orderbook_ticker(self, **params):
"""Best price/qty on the order book for a symbol or symbols.

https://binance-docs.github.io/apidocs/futures/en/#symbol-order-book-ticker-market_data
https://binance-docs.github.io/apidocs/futures/en/#symbol-order-book-ticker

"""
return self._request_futures_api('get', 'ticker/bookTicker', data=params)

def futures_liquidation_orders(self, **params):
"""Get all liquidation orders

https://binance-docs.github.io/apidocs/futures/en/#get-all-liquidation-orders-market_data
https://binance-docs.github.io/apidocs/futures/en/#get-all-liquidation-orders

"""
return self._request_futures_api('get', 'ticker/allForceOrders', data=params)
return self._request_futures_api('get', 'allForceOrders', data=params)

def futures_open_interest(self, **params):
"""Get present open interest of a specific symbol.

https://binance-docs.github.io/apidocs/futures/en/#open-interest-market_data
https://binance-docs.github.io/apidocs/futures/en/#open-interest-statistics-market_data

"""
return self._request_futures_api('get', 'ticker/openInterest', data=params)
return self._request_futures_api('get', 'openInterest', data=params)

def futures_leverage_bracket(self, **params):
"""Notional and Leverage Brackets

https://binance-docs.github.io/apidocs/futures/en/#notional-and-leverage-brackets-market_data
https://binance-docs.github.io/apidocs/futures/en/#notional-and-leverage-brackets-user_data

"""
return self._request_futures_api('get', 'ticker/leverageBracket', data=params)
return self._request_futures_api('get', 'leverageBracket', data=params)

def transfer_history(self, **params):
"""Get future account transaction history list
Expand Down Expand Up @@ -3594,7 +3594,7 @@ def futures_get_order(self, **params):
def futures_get_open_orders(self, **params):
"""Get all open orders on a symbol.

https://binance-docs.github.io/apidocs/futures/en/#current-open-orders-user_data
https://binance-docs.github.io/apidocs/futures/en/#current-all-open-orders-user_data

"""
return self._request_futures_api('get', 'openOrders', True, data=params)
Expand Down Expand Up @@ -3674,7 +3674,7 @@ def futures_change_position_margin(self, **params):
def futures_position_margin_history(self, **params):
"""Get position margin change history

https://binance-docs.github.io/apidocs/futures/en/#get-postion-margin-change-history-trade
https://binance-docs.github.io/apidocs/futures/en/#get-position-margin-change-history-trade

"""
return self._request_futures_api('get', 'positionMargin/history', True, data=params)
Expand Down
20 changes: 20 additions & 0 deletions tests/test_api_request_paths.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env python
# coding=utf-8

from binance.client import Client
from binance.exceptions import BinanceAPIException, BinanceRequestException, BinanceWithdrawException
import pytest

client = Client()


def test_run_get_products():
client.get_products()


def test_run_get_server_time():
client.get_server_time()


def test_run_futures_open_interest():
client.futures_open_interest(symbol="BTCUSDT")