Skip to main content

Trend lines generator

Usage example:

#! pip install trend-lines-generator
import requests
import mplfinance as mpf
from pandas import DataFrame, to_datetime

from trend_lines import generate_trend_lines, Side


def main():
    columns = [
        ("ts", "int"),
        ("volume_quote", "float64"),
        ("open", "float64"),
        ("high", "float64"),
        ("low", "float64"),
        ("close", "float64"),
    ]
    url = "https://api.gateio.ws/api/v4/spot/candlesticks?currency_pair=MOVR_USDT&interval=1h&limit=100"
    response = requests.get(url)

    rows = response.json()

    df = (
        DataFrame([r[: len(columns)] for r in rows], columns=[i[0] for i in columns])
        .astype(dict(columns))
        .set_index("ts")
    )
    df.index = to_datetime(df.index, unit="s")

    lines = generate_trend_lines(low_series=df["low"], high_series=df["high"])

    x1 = df.index[0]
    x2 = df.index[-1]

    mpf.plot(
        df,
        type="candle",
        tight_layout=True,
        alines={
            "alines": [((x1, line.get_y(x1)), (x2, line.get_y(x2))) for line in lines],
            "colors": ["g" if line.side == Side.LOW else "r" for line in lines],
        },
    )


if __name__ == "__main__":
    main()

trend lines

For each time in the serie:

trend lines daily

Metadata

Release files for trend-lines-generator 1.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for trend-lines-generator 1.0.3
File Size Uploaded Provenance
trend_lines_generator-1.0.3.tar.gz 6.9 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for trend-lines-generator 1.0.3
File Interpreter ABI Platform
trend_lines_generator-1.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 15.5 kB

Release files / trend_lines_generator-1.0.3.tar.gz

Download URL trend_lines_generator-1.0.3.tar.gz
Size 6.9 kB
Tags Source
SHA-256 checksum
How to use checksums
8f394fe47d5427d2dc8524e21602bf07f64460c45e9e4f95c52a75fb0460ae92
BLAKE2b-256 checksum
How to use checksums
4d2f6941e52853517f788c9a880259261bf947c7be0cd36f8601c45296ddeca0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.7.1 CPython/3.11.7 Darwin/23.3.0

Release files / trend_lines_generator-1.0.3-py3-none-any.whl

Download URL trend_lines_generator-1.0.3-py3-none-any.whl
Size 8.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
529d0fe449e0173cc90a538e0375db4b331c585afd455acc112436ceede94734
BLAKE2b-256 checksum
How to use checksums
53cd1b06653a7d0d0a8e2cf63754ff19afd4be63125595bfa804d09e9af4c9dc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.7.1 CPython/3.11.7 Darwin/23.3.0

Security for trend-lines-generator 1.0.3

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page