MCPcopy Create free account
hub / github.com/Gunthersuper/Binance-Futures-Python-Examples / klines

Function klines

main1.py:45–59  ·  view source on GitHub ↗
(symbol)

Source from the content-addressed store, hash-verified

43
44# Getting candles for the needed symbol, its a dataframe with 'Time', 'Open', 'High', 'Low', 'Close', 'Volume'
45def klines(symbol):
46 try:
47 resp = pd.DataFrame(client.klines(symbol, '15m'))
48 resp = resp.iloc[:,:6]
49 resp.columns = ['Time', 'Open', 'High', 'Low', 'Close', 'Volume']
50 resp = resp.set_index('Time')
51 resp.index = pd.to_datetime(resp.index, unit = 'ms')
52 resp = resp.astype(float)
53 return resp
54 except ClientError as error:
55 print(
56 "Found error. status: {}, error code: {}, error message: {}".format(
57 error.status_code, error.error_code, error.error_message
58 )
59 )
60
61
62# Set leverage for the needed symbol. You need this bcz different symbols can have different leverage

Callers 4

str_signalFunction · 0.85
rsi_signalFunction · 0.85
macd_emaFunction · 0.85
ema200_50Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected