def order(trade_account, type_, symbol, price, quantity): ta = trade_account t = Trader(ta.exchange, ta.login_name, ta.login_password) if type_ == 'buy': r = t.buy(symbol, price, quantity) else: r = t.sell(symbol, price, quantity) return r, t.last_error