12
This commit is contained in:
parent
0dd5ca80a3
commit
7b1a20567f
28
bn.py
28
bn.py
@ -1,28 +0,0 @@
|
|||||||
from binance.spot import Spot
|
|
||||||
from binance.cm_futures import CMFutures
|
|
||||||
|
|
||||||
cm = CMFutures()
|
|
||||||
spot = Spot()
|
|
||||||
|
|
||||||
# Get klines
|
|
||||||
def klines(symbol, interval, limit=1000):
|
|
||||||
lines = spot.klines(symbol,interval, limit=limit)
|
|
||||||
return lines
|
|
||||||
|
|
||||||
def ticker_price(symbol):
|
|
||||||
try:
|
|
||||||
prices = cm.ticker_price(symbol)
|
|
||||||
return prices[0]['price'] if len(prices)>0 else 0
|
|
||||||
except:
|
|
||||||
return 0
|
|
||||||
|
|
||||||
# Get Symbols
|
|
||||||
def symbols():
|
|
||||||
info = spot.exchange_info()
|
|
||||||
|
|
||||||
symbols = []
|
|
||||||
for s in info['symbols']:
|
|
||||||
if s['symbol'].endswith('USDT'):
|
|
||||||
symbols.append(s['symbol'])
|
|
||||||
|
|
||||||
return symbols
|
|
||||||
Loading…
Reference in New Issue
Block a user