Implementation of the Sausage Links algorithm base Swinging Door in Python.
Project description
Sausage Links
Implementation of the Sausage Links algorithm base Swinging Door in Python.
Example of usage
>>> from datetime import datetime
>>> from pandas import read_csv, DataFrame
>>> df = DataFrame(
... [
... {
... "Date": datetime.strptime(date, "%Y-%m-%d"),
... "Price": value
... }
... for date, value in read_csv(
... "https://datahub.io/core/oil-prices/r/wti-daily.csv"
... ).values.tolist()
... ]
... )
>>> print(len(df))
9895
>>> df.plot(x="Date", y="Price")
>>> from sausage_links import sausage_links
>>> compress = DataFrame(
... list(
... {
... "Date": datetime.fromtimestamp(date),
... "Price": value
... }
... for date, value in sausage_links(
... iter(
... (date.timestamp(), value)
... for date, value in df.values.tolist()
... ), deviation=(1, .5), max_len=604_800,
... auto_dev_factor=200_000, ema_alpha=0.5
... )
... )
... )
>>> print(len(compress))
4177
>>> compress.plot(x="Date", y="Price")
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
sausage_links-1.0.0.tar.gz
(4.9 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sausage_links-1.0.0.tar.gz.
File metadata
- Download URL: sausage_links-1.0.0.tar.gz
- Upload date:
- Size: 4.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
834f33b491ab40d8c2f793a199b5480f19ee4b68b5155f8588009f8ae8accc82
|
|
| MD5 |
9cc6acff83c17ff668f5afe8cfb3ad01
|
|
| BLAKE2b-256 |
d0791e4f705cb50bcc58c9cbb47bb179ca738fba13c1ea3ad4ce015519ec08bf
|
File details
Details for the file sausage_links-1.0.0-py3-none-any.whl.
File metadata
- Download URL: sausage_links-1.0.0-py3-none-any.whl
- Upload date:
- Size: 5.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6aaaade62b773aecd09d457e0563bbf75f4121bbaa635f5bef055d5151df7663
|
|
| MD5 |
30a02a84a17d7c1b65e1d86a72a457be
|
|
| BLAKE2b-256 |
e74efc9b06f024380ce6d4aadeedd3506e501bd8b6e8d96f94bb023ae84c973b
|