Skip to content

TypeError when using exchange.listen_orderbook #27

@PepijnBoers

Description

@PepijnBoers

Hi,

I would like to use the websocket option to retrieve orderbook data. However, I'm facing a type error when running the following code block:

import asyncio
import cryptocom.exchange as cro

async def main():
    exchange = cro.Exchange()
    price = await exchange.listen_orderbook([cro.pairs.CRO_USDT])
    print(f'CRO price {price}')


asyncio.run(main())

Traceback:

Traceback (most recent call last):
  File "/Users/xxxxx/projects/crypto-board/src/data/test.py", line 10, in <module>
    asyncio.run(main())
  File "/usr/local/Cellar/[email protected]/3.9.7/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/local/Cellar/[email protected]/3.9.7/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
    return future.result()
  File "/Users/xxxxx/projects/crypto-board/src/data/test.py", line 6, in main
    price = await exchange.listen_orderbook([cro.pairs.CRO_USDT])
TypeError: object async_generator can't be used in 'await' expression

I'm using:
Python 3.9.7
cryptocom-exchange: 0.9.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions