嘿,我是 Stack Over Flow 和 Python 的新手,但想学习并希望有人可以帮助我。我正在尝试在 python 中开发一个币安交易机器人。请参阅下面我的脚本:
from binance.client import Client
class Trader:
def __init__(self, file):
self.connect(file)
""" Creates Binance client """
def connect(self,file):
lines = [line.rstrip('\n') for line in open(file)]
key = lines[0]
secret = lines[1]
self.client = Client(key, secret)
""" Gets all account balances """
def getBalances(self):
prices = self.client.get_withdraw_history()
return prices
filename = 'API credentials.txt'
trader = Trader(filename)
balances = trader.getBalances()
print(balances)
Run Code Online (Sandbox Code Playgroud)
该脚本给我一个模块未找到错误,请参阅下面的完整详细信息:
PyDev console: starting.
Python 3.8.3 (tags/v3.8.3:6f8c832, May 13 2020, 22:20:19) [MSC v.1925 …Run Code Online (Sandbox Code Playgroud)