Skip to content

Commit

Permalink
added examples/py/async-bittrex-orderbook.py ccxt#345
Browse files Browse the repository at this point in the history
  • Loading branch information
kroitor committed Oct 19, 2017
1 parent 944c128 commit f4b7fa8
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions examples/py/async-bittrex-orderbook.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# -*- coding: utf-8 -*-

import asyncio
import os
import sys

root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
sys.path.append(root)

import ccxt.async as ccxt # noqa: E402

exchange = ccxt.bittrex()


async def poll():
while True:
yield await exchange.fetch_order_book('BTC/USDT')
await asyncio.sleep(exchange.rateLimit / 1000)


async def main():
async for orderbook in poll():
print(orderbook['bids'][0], orderbook['asks'][0])


asyncio.get_event_loop().run_until_complete(main())

0 comments on commit f4b7fa8

Please sign in to comment.