Skip to content

Orderbook async streams are not working #265

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
apatrushev opened this issue Feb 12, 2020 · 2 comments
Closed

Orderbook async streams are not working #265

apatrushev opened this issue Feb 12, 2020 · 2 comments
Assignees
Labels

Comments

@apatrushev
Copy link

apatrushev commented Feb 12, 2020

Describe the bug
Orderbook async streams are not working. Stream do not provide any messages.

What version of dependencies are you using?

Python 3.7.5
aiohttp==3.6.2
aiohttp-sse-client==0.1.6
async-timeout==3.0.1
attrs==19.3.0
certifi==2019.11.28
cffi==1.14.0
chardet==3.0.4
crc16==0.1.1
idna==2.8
mnemonic==0.19
multidict==4.7.4
pycparser==2.19
PyNaCl==1.3.0
requests==2.22.0
six==1.14.0
stellar-base-sseclient==0.0.21
stellar-sdk==2.2.0
toml==0.10.0
urllib3==1.25.8
yarl==1.4.2

To Reproduce

import asyncio
import stellar_sdk as stellar


async def orderbook():
    async with stellar.Server(
        horizon_url='https://horizon.stellar.org',
        client=stellar.client.aiohttp_client.AiohttpClient()
    ) as server:
        xlm = stellar.Asset.native()
        bat = stellar.Asset('BAT', 'GBDEVU63Y6NTHJQQZIKVTC23NWLQVP3WJ2RI2OTSJTNYOIGICST6DUXR')
        async for book in server.orderbook(bat, xlm).stream():
            print(book)


if __name__ == "__main__":
    asyncio.run(orderbook())

Expected behavior
Sequence of order book messages printed to console.

Additional context
Code sample for javascript SDK

@apatrushev apatrushev added the bug label Feb 12, 2020
@apatrushev
Copy link
Author

apatrushev commented Feb 12, 2020

Probably the problem is somewhere here in aiohttp_client.py#L150. Orderbook events are sent by horizon without id and skipped by default.

@overcat overcat self-assigned this Feb 12, 2020
overcat added a commit that referenced this issue Feb 12, 2020
@overcat
Copy link
Member

overcat commented Feb 12, 2020

Thanks for your feedback, I have posted a fix and hope it is useful. If you have any questions, please feel free to ask.

 pip install stellar-sdk==2.2.1

https://pypi.org/project/stellar-sdk/2.2.1/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants