Skip to content

Conversation

@swechencheng
Copy link
Contributor

@swechencheng swechencheng commented Oct 15, 2025

This is inspired by #140

It adds a basic SSE client where users can subscribe to Avanza event stream.

Example usage:

import asyncio
from avanza import Avanza, AvanzaSSEClient

avanza = Avanza(
    {
        "username": "username",
        "password": "password",
        "totpSecret": "totpSecret",
    }
)

URL = "https://www.avanza.se/_push/quote-web-push/2026354"

async def on_market_maker_update(id, event, data):
    print(f"[{id}] [{event}] {data}")

async def main():
    client = SSEClient(avanza, URL)
    client.add_listener(on_market_maker_update)
    await client.start()

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

It's just a start to moving forward since legacy websocket is broken.
The future work would be integration of various Avanza APIs or functionality.

This is inspired by Qluxzz#140

It adds a basic SSE client where user can subscribe to Avanza event stream.

Example usage:
```
import asyncio
from avanza import Avanza, AvanzaSSEClient

avanza = Avanza(
    {
        "username": "username",
        "password": "password",
        "totpSecret": "totpSecret",
    }
)

URL = "https://www.avanza.se/_push/quote-web-push/2026354"

async def on_market_maker_update(id, event, data):
    print(f"[{id}] [{event}] {data}")

async def main():
    client = SSEClient(avanza, URL)
    client.add_listener(on_market_maker_update)
    await client.start()

if __name__ == "__main__":
    asyncio.run(main())
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant