avanza icon indicating copy to clipboard operation
avanza copied to clipboard

Add a skeleton SSE event listener

Open swechencheng opened this issue 3 months ago • 0 comments

This is inspired by https://github.com/Qluxzz/avanza/issues/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.

swechencheng avatar Oct 15 '25 19:10 swechencheng