Skip to content

Instantly share code, notes, and snippets.

@dev4Fun
Created May 15, 2018 23:55
Show Gist options
  • Save dev4Fun/5c47b7dcd64e4418fbde10f9e8e4ce1d to your computer and use it in GitHub Desktop.
Save dev4Fun/5c47b7dcd64e4418fbde10f9e8e4ce1d to your computer and use it in GitHub Desktop.
async def _wait_order_complete(self, order_id):
status = 'open'
order = None
while status is 'open':
await asyncio.sleep(self.check_timeout)
order = self.exchange.fetch_order(order_id)
status = order['status']
logging.info(f'Finished order {order_id} with {status} status')
# do not proceed further if we canceled order
if status == 'canceled':
raise ExchangeError('Trade has been canceled')
return order
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment