A convenient way to work with websocket data streams
Project description
A convenient way to work with information streaming from websockets, built on top of the Python iterator protocol.
When subscribing to a stream of qualified data I am usually interested in either the latest value i.e. the one I want when I am ready to do something with it or all the values since I last checked.
whereismysock also has a most subscriber which is all with an upper bound to the number of messages it keeps in memory (deleting the eldest first).
>>> from whereismysock import latest >>> usdjpy = latest("ws://toplevel/USDJPY") >>> next(usdjpy) ...>>> from whereismysock import all >>> nk225 = all("ws://trades/NK225") >>> next(nk225) ...
I like it because it makes “synchronising” different source of information super easy.
>>> hhi = latest("ws://toplevel/HHI") >>> hsi = latest("ws://toplevel/HSI") >>> next(zip(hhi, hsi)) ...
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file whereismysock-2019.6.0.tar.gz
.
File metadata
- Download URL: whereismysock-2019.6.0.tar.gz
- Upload date:
- Size: 2.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: Python-urllib/3.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8cafb54343eef1755ae874600eb9a16dde808bcf1dd4545ec03f8beb75f27e58 |
|
MD5 | f24d31772ea1542b0c690d34c322d741 |
|
BLAKE2b-256 | 789c8657e8a4cb8863f0e8213a9e779ca3ca51a413563aa0daaee8345d4dba61 |