Tyche Transforms
This package provides the transformation functions defined in MARKETS_INFO.md for Tyche market data pipelines,
operating on xarray DataArray inputs.
The intent is to keep the same implementations between local development and the Chainlink adapter.
Install
uv pip install tyche-transforms
For development:
uv pip install -e ".[test]"
Usage
import pandas as pd
import xarray as xr
from tyche_transforms.transforms import date_first, runlen_lt, sum_value
times = pd.date_range("2024-01-01", periods=4)
data = xr.DataArray([15.0, 10.0, 8.0, 11.0], dims="time", coords={"time": times})
print(sum_value(data))
print(date_first(data, threshold=9.0))
print(runlen_lt(data, threshold=9.0))
GitHub Actions
This repo includes a workflow that runs tests on every push/PR and publishes to PyPI when you push a tag
matching v* (for example v0.2.0). To enable publishing:
- Add a repository secret named
PYPI_API_TOKENcontaining your PyPI token. - Push a version tag:
git tag v0.2.0
git push origin v0.2.0
Transformation Functions
DataArray -> Scalar
SUM(0 args): sum over window -> scalar.AVG(0 args): average over window -> scalar.MAX(0 args): max over window -> scalar.INDEX_OF_MAX_VALUE(0 args): index of the max value -> scalar.MIN(0 args): min over window -> scalar.DATE_MAX(0 args): timestamp of the max value -> scalar (timestamp).DATE_FIRST:threshold(1 arg): timestamp of first value > threshold, or epochpd.Timestamp(0)if none -> scalar (timestamp).RUNLEN_LT:threshold(1 arg): longest run length where value < threshold -> scalar.RUNLEN_GT:threshold(1 arg): longest run length where value > threshold -> scalar.
Scalar -> Scalar
ABS(0 args): absolute value of a scalar -> scalar.SUBTRACT_V:threshold(1 arg): subtract a scalar to the given threshold -> scalar.
Metadata
Release files for tyche-transforms 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| tyche_transforms-0.2.0.tar.gz | 4.0 kB | Without provenance | Details for tyche_transforms-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| tyche_transforms-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for tyche_transforms-0.2.0-py3-none-any.whl |
Total release size: 8.0 kB
Release files / tyche_transforms-0.2.0.tar.gz
| Download URL | tyche_transforms-0.2.0.tar.gz |
|---|---|
| Size | 4.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cd229c7c1cb2b14c3e1e32c7d3a1961331384351b3a3a6bf0cfb9a0cec85e9f4
|
|
BLAKE2b-256 checksum How to use checksums |
c666f12b9f9543f65845af9d50e941810e818f5e9dbf9c13d9f1c68b71bf3dff
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / tyche_transforms-0.2.0-py3-none-any.whl
| Download URL | tyche_transforms-0.2.0-py3-none-any.whl |
|---|---|
| Size | 4.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1b929bc3a99d6ef17ac20b346dbb3999a98d9ee145d27e209499066cf541ee3e
|
|
BLAKE2b-256 checksum How to use checksums |
89bd065945074d26e95bc156cd27d2136430d08a9fa0771f1f4ae17121ee89fc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Security for tyche-transforms 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.