mirror of
https://github.com/discountry/ritmex-bot.git
synced 2026-09-11 09:18:08 +00:00
commit
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
- [Async Generator Ticker Poller](./examples/py/)
|
||||
|
||||
|
||||
```python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import asyncio
|
||||
import os
|
||||
import sys
|
||||
|
||||
|
||||
import ccxt.async_support as ccxt # noqa: E402
|
||||
|
||||
|
||||
async def poll():
|
||||
kraken = ccxt.kraken({
|
||||
'apiKey': "hEvQNMDIeoCJbr7W/ZBb5CGOrx3G0lWF5B3zqa1JBxdZlEaL8EK+D0Mw",
|
||||
'secret': "JaE9wI6Nwgh5oRxiHcVxurwzwBxwc05W/qv/k1srGg4s3EYuXPpNkLLM5NYbbWpM8rCyijIeDavRuqWbU0ZV9A==",
|
||||
# 'verbose': True, # switch it to False if you don't want the HTTP log
|
||||
})
|
||||
while True:
|
||||
yield await kraken.fetch_ticker('BTC/USD')
|
||||
await asyncio.sleep(kraken.rateLimit / 1000)
|
||||
|
||||
|
||||
async def main():
|
||||
async for ticker in poll():
|
||||
print(ticker)
|
||||
|
||||
|
||||
asyncio.run(main())
|
||||
|
||||
```
|
||||
Reference in New Issue
Block a user