(symbol)
| 43 | |
| 44 | # Getting candles for the needed symbol, its a dataframe with 'Time', 'Open', 'High', 'Low', 'Close', 'Volume' |
| 45 | def 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 |
no outgoing calls
no test coverage detected