def webAccounts(functions): myWebTraders = [] webTraderBook = WebTraderBook() #先登錄賬戶並停頓5秒待其完成. 如此則即便重現連接,也還是同一個myWebTrader,其記憶不丟失 for func in functions: try: acc = webTraderBook.logonWith(func) myWebTraders.append(acc) # print('已經登錄{acnt}'.format(acnt=acc.account)) except Exception as e: print('WebPyAcc webAccounts: ') print(e) return myWebTraders
def webAccount(func): webTraderBook = WebTraderBook() try: acc = webTraderBook.logonWith(func) except Exception as e: raise e