FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Add helper function to get info about particular symbol · EncodingJerry/python-binance@78825bb · GitHub

Commit 78825bb

Browse files
Sam McHardy
committed
Add helper function to get info about particular symbol
1 parent 7c6b7a5 commit 78825bb

2 files changed

Lines changed: 58 additions & 0 deletions

File tree

‎binance/client.py‎

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,55 @@ def get_exchange_info(self):
264264

265265
return self._get('exchangeInfo')
266266

267+
def get_symbol_info(self, symbol):
268+
"""Return information about a symbol
269+
270+
:param symbol: required e.g BNBBTC
271+
:type symbol: str
272+
273+
:returns: Dict if found, None if not
274+
275+
.. code-block:: python
276+
277+
{
278+
"symbol": "ETHBTC",
279+
"status": "TRADING",
280+
"baseAsset": "ETH",
281+
"baseAssetPrecision": 8,
282+
"quoteAsset": "BTC",
283+
"quotePrecision": 8,
284+
"orderTypes": ["LIMIT", "MARKET"],
285+
"icebergAllowed": false,
286+
"filters": [
287+
{
288+
"filterType": "PRICE_FILTER",
289+
"minPrice": "0.00000100",
290+
"maxPrice": "100000.00000000",
291+
"tickSize": "0.00000100"
292+
}, {
293+
"filterType": "LOT_SIZE",
294+
"minQty": "0.00100000",
295+
"maxQty": "100000.00000000",
296+
"stepSize": "0.00100000"
297+
}, {
298+
"filterType": "MIN_NOTIONAL",
299+
"minNotional": "0.00100000"
300+
}
301+
]
302+
}
303+
304+
:raises: BinanceResponseException, BinanceAPIException
305+
306+
"""
307+
308+
res = self._get('exchangeInfo')
309+
310+
for item in res['symbols']:
311+
if item['symbol'] == symbol.upper():
312+
return item
313+
314+
return None
315+
267316
# General Endpoints
268317

269318
def ping(self):

‎docs/general.rst‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,15 @@ General Endpoints
2222
2323
info = client.get_exchange_info()
2424
25+
`Get Symbol Info <binance.html#binance.client.Client.get_symbol_info>`_
26+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
27+
28+
Get the exchange info for a particular symbol
29+
30+
.. code:: python
31+
32+
info = client.get_symbol_info('BNBBTC')
33+
2534
`Get Current Products <binance.html#binance.client.Client.get_products>`_
2635
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2736

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL