Skip to main content

static_klines v0.1.8 Checked with mypy Vovk.ts

Type-safe, auto-generated client for the static-klines API — historical Binance spot klines served as pre-rendered static JSON. No rate limits, infinite cache lifetime, globally CDN'd.

License: MIT

# Install the package
pip install static_klines

KLinesAPI

KLinesAPI.get_symbols

List supported symbols

Returns the hardcoded list of Binance spot trading pairs covered by this cache. Same enum used by every symbol path parameter.

GET https://finom.github.io/static-klines/api/klines/symbols.json

from static_klines import KLinesAPI

response = KLinesAPI.get_symbols(
    api_root="https://finom.github.io/static-klines/api",
)

print(response)
[
    "BTCUSDT",
    "ETHUSDT",
    "BNBUSDT",
    "SOLUSDT",
    "XRPUSDT",
    "ADAUSDT",
    "DOGEUSDT",
    "AVAXUSDT",
    "LINKUSDT",
    "DOTUSDT"
]

KLinesAPI.get_start_dates

List valid startDates for an interval

Returns the ordered list of startDate values accepted by the candle endpoints for a given interval. Every value is a calendar-aligned UTC date; iterate in order to walk the full history.

GET https://finom.github.io/static-klines/api/klines/start-dates/{interval}.json

from static_klines import KLinesAPI

response = KLinesAPI.get_start_dates(
    params={
        # Binance kline interval code
        "interval": "15m"
    },
    api_root="https://finom.github.io/static-klines/api",
)

print(response)
[
    "2024-01-01",
    "2024-02-01",
    "2024-03-01",
    "2024-04-01"
]

KLinesAPI.get_klines_15_m

Get 15m klines window

Fully-closed Binance spot candles at the 15m interval. Each file covers exactly 1 week (Monday-aligned), anchored at the calendar boundary shown by startDate. Call GET /api/klines/start-dates/15m.json for the full list of valid startDates.

GET https://finom.github.io/static-klines/api/klines/15m/{symbol}/{startDate}.json

from static_klines import KLinesAPI

response = KLinesAPI.get_klines15m(
    params={
        # Trading pair (Binance spot symbol, hardcoded list of 10)
        "symbol": "BTCUSDT",
        # 15m window start date (Monday, UTC, YYYY-MM-DD). Window covers 7 days / 672 candles.
        "startDate": "2023-01-02"
    },
    api_root="https://finom.github.io/static-klines/api",
)

print(response)
[
    [
        1514764800000,
        "13715.65000000",
        "13818.55000000",
        "12750.00000000",
        "13380.00000000",
        "8609.91584400",
        1514851199999,
        "114799747.44197057",
        105595,
        "3961.93894600",
        "52809747.44038045",
        "0"
    ],
    [
        1514851200000,
        "13382.16000000",
        "15473.49000000",
        "12890.02000000",
        "14675.11000000",
        "20078.09211100",
        1514937599999,
        "275545340.79810440",
        197229,
        "9915.30471600",
        "136355703.49029400",
        "0"
    ]
]

KLinesAPI.get_klines_30_m

Get 30m klines window

Fully-closed Binance spot candles at the 30m interval. Each file covers exactly 2 weeks (Monday-aligned), anchored at the calendar boundary shown by startDate. Call GET /api/klines/start-dates/30m.json for the full list of valid startDates.

GET https://finom.github.io/static-klines/api/klines/30m/{symbol}/{startDate}.json

from static_klines import KLinesAPI

response = KLinesAPI.get_klines30m(
    params={
        # Trading pair (Binance spot symbol, hardcoded list of 10)
        "symbol": "BTCUSDT",
        # 30m window start date (Monday, UTC). Window covers 14 days / 672 candles.
        "startDate": "2022-01-03"
    },
    api_root="https://finom.github.io/static-klines/api",
)

print(response)
[
    [
        1514764800000,
        "13715.65000000",
        "13818.55000000",
        "12750.00000000",
        "13380.00000000",
        "8609.91584400",
        1514851199999,
        "114799747.44197057",
        105595,
        "3961.93894600",
        "52809747.44038045",
        "0"
    ],
    [
        1514851200000,
        "13382.16000000",
        "15473.49000000",
        "12890.02000000",
        "14675.11000000",
        "20078.09211100",
        1514937599999,
        "275545340.79810440",
        197229,
        "9915.30471600",
        "136355703.49029400",
        "0"
    ]
]

KLinesAPI.get_klines_1_h

Get 1h klines window

Fully-closed Binance spot candles at the 1h interval. Each file covers exactly 1 calendar month, anchored at the calendar boundary shown by startDate. Call GET /api/klines/start-dates/1h.json for the full list of valid startDates.

GET https://finom.github.io/static-klines/api/klines/1h/{symbol}/{startDate}.json

from static_klines import KLinesAPI

response = KLinesAPI.get_klines1h(
    params={
        # Trading pair (Binance spot symbol, hardcoded list of 10)
        "symbol": "BTCUSDT",
        # 1h window start date (1st of month, UTC). Window covers 1 calendar month.
        "startDate": "2018-01-01"
    },
    api_root="https://finom.github.io/static-klines/api",
)

print(response)
[
    [
        1514764800000,
        "13715.65000000",
        "13818.55000000",
        "12750.00000000",
        "13380.00000000",
        "8609.91584400",
        1514851199999,
        "114799747.44197057",
        105595,
        "3961.93894600",
        "52809747.44038045",
        "0"
    ],
    [
        1514851200000,
        "13382.16000000",
        "15473.49000000",
        "12890.02000000",
        "14675.11000000",
        "20078.09211100",
        1514937599999,
        "275545340.79810440",
        197229,
        "9915.30471600",
        "136355703.49029400",
        "0"
    ]
]

KLinesAPI.get_klines_2_h

Get 2h klines window

Fully-closed Binance spot candles at the 2h interval. Each file covers exactly 2 calendar months, anchored at the calendar boundary shown by startDate. Call GET /api/klines/start-dates/2h.json for the full list of valid startDates.

GET https://finom.github.io/static-klines/api/klines/2h/{symbol}/{startDate}.json

from static_klines import KLinesAPI

response = KLinesAPI.get_klines2h(
    params={
        # Trading pair (Binance spot symbol, hardcoded list of 10)
        "symbol": "BTCUSDT",
        # 2h window start date (UTC). Window covers 2 calendar months.
        "startDate": "2017-07-01"
    },
    api_root="https://finom.github.io/static-klines/api",
)

print(response)
[
    [
        1514764800000,
        "13715.65000000",
        "13818.55000000",
        "12750.00000000",
        "13380.00000000",
        "8609.91584400",
        1514851199999,
        "114799747.44197057",
        105595,
        "3961.93894600",
        "52809747.44038045",
        "0"
    ],
    [
        1514851200000,
        "13382.16000000",
        "15473.49000000",
        "12890.02000000",
        "14675.11000000",
        "20078.09211100",
        1514937599999,
        "275545340.79810440",
        197229,
        "9915.30471600",
        "136355703.49029400",
        "0"
    ]
]

KLinesAPI.get_klines_4_h

Get 4h klines window

Fully-closed Binance spot candles at the 4h interval. Each file covers exactly 1 calendar quarter, anchored at the calendar boundary shown by startDate. Call GET /api/klines/start-dates/4h.json for the full list of valid startDates.

GET https://finom.github.io/static-klines/api/klines/4h/{symbol}/{startDate}.json

from static_klines import KLinesAPI

response = KLinesAPI.get_klines4h(
    params={
        # Trading pair (Binance spot symbol, hardcoded list of 10)
        "symbol": "BTCUSDT",
        # 4h window start date (1st of Jan/Apr/Jul/Oct, UTC). Window covers 1 calendar quarter.
        "startDate": "2017-07-01"
    },
    api_root="https://finom.github.io/static-klines/api",
)

print(response)
[
    [
        1514764800000,
        "13715.65000000",
        "13818.55000000",
        "12750.00000000",
        "13380.00000000",
        "8609.91584400",
        1514851199999,
        "114799747.44197057",
        105595,
        "3961.93894600",
        "52809747.44038045",
        "0"
    ],
    [
        1514851200000,
        "13382.16000000",
        "15473.49000000",
        "12890.02000000",
        "14675.11000000",
        "20078.09211100",
        1514937599999,
        "275545340.79810440",
        197229,
        "9915.30471600",
        "136355703.49029400",
        "0"
    ]
]

KLinesAPI.get_klines_6_h

Get 6h klines window

Fully-closed Binance spot candles at the 6h interval. Each file covers exactly 6 months (Jan/Jul), anchored at the calendar boundary shown by startDate. Call GET /api/klines/start-dates/6h.json for the full list of valid startDates.

GET https://finom.github.io/static-klines/api/klines/6h/{symbol}/{startDate}.json

from static_klines import KLinesAPI

response = KLinesAPI.get_klines6h(
    params={
        # Trading pair (Binance spot symbol, hardcoded list of 10)
        "symbol": "BTCUSDT",
        # 6h window start date (1st of Jan/Jul, UTC). Window covers 6 calendar months.
        "startDate": "2017-07-01"
    },
    api_root="https://finom.github.io/static-klines/api",
)

print(response)
[
    [
        1514764800000,
        "13715.65000000",
        "13818.55000000",
        "12750.00000000",
        "13380.00000000",
        "8609.91584400",
        1514851199999,
        "114799747.44197057",
        105595,
        "3961.93894600",
        "52809747.44038045",
        "0"
    ],
    [
        1514851200000,
        "13382.16000000",
        "15473.49000000",
        "12890.02000000",
        "14675.11000000",
        "20078.09211100",
        1514937599999,
        "275545340.79810440",
        197229,
        "9915.30471600",
        "136355703.49029400",
        "0"
    ]
]

KLinesAPI.get_klines_8_h

Get 8h klines window

Fully-closed Binance spot candles at the 8h interval. Each file covers exactly 6 months (Jan/Jul), anchored at the calendar boundary shown by startDate. Call GET /api/klines/start-dates/8h.json for the full list of valid startDates.

GET https://finom.github.io/static-klines/api/klines/8h/{symbol}/{startDate}.json

from static_klines import KLinesAPI

response = KLinesAPI.get_klines8h(
    params={
        # Trading pair (Binance spot symbol, hardcoded list of 10)
        "symbol": "BTCUSDT",
        # 8h window start date (1st of Jan/Jul, UTC). Window covers 6 calendar months.
        "startDate": "2017-07-01"
    },
    api_root="https://finom.github.io/static-klines/api",
)

print(response)
[
    [
        1514764800000,
        "13715.65000000",
        "13818.55000000",
        "12750.00000000",
        "13380.00000000",
        "8609.91584400",
        1514851199999,
        "114799747.44197057",
        105595,
        "3961.93894600",
        "52809747.44038045",
        "0"
    ],
    [
        1514851200000,
        "13382.16000000",
        "15473.49000000",
        "12890.02000000",
        "14675.11000000",
        "20078.09211100",
        1514937599999,
        "275545340.79810440",
        197229,
        "9915.30471600",
        "136355703.49029400",
        "0"
    ]
]

KLinesAPI.get_klines_12_h

Get 12h klines window

Fully-closed Binance spot candles at the 12h interval. Each file covers exactly 1 calendar year, anchored at the calendar boundary shown by startDate. Call GET /api/klines/start-dates/12h.json for the full list of valid startDates.

GET https://finom.github.io/static-klines/api/klines/12h/{symbol}/{startDate}.json

from static_klines import KLinesAPI

response = KLinesAPI.get_klines12h(
    params={
        # Trading pair (Binance spot symbol, hardcoded list of 10)
        "symbol": "BTCUSDT",
        # 12h window start date (1st of Jan, UTC). Window covers 1 calendar year.
        "startDate": "2017-01-01"
    },
    api_root="https://finom.github.io/static-klines/api",
)

print(response)
[
    [
        1514764800000,
        "13715.65000000",
        "13818.55000000",
        "12750.00000000",
        "13380.00000000",
        "8609.91584400",
        1514851199999,
        "114799747.44197057",
        105595,
        "3961.93894600",
        "52809747.44038045",
        "0"
    ],
    [
        1514851200000,
        "13382.16000000",
        "15473.49000000",
        "12890.02000000",
        "14675.11000000",
        "20078.09211100",
        1514937599999,
        "275545340.79810440",
        197229,
        "9915.30471600",
        "136355703.49029400",
        "0"
    ]
]

KLinesAPI.get_klines_1_d

Get 1d klines window

Fully-closed Binance spot candles at the 1d interval. Each file covers exactly 2 calendar years, anchored at the calendar boundary shown by startDate. Call GET /api/klines/start-dates/1d.json for the full list of valid startDates.

GET https://finom.github.io/static-klines/api/klines/1d/{symbol}/{startDate}.json

from static_klines import KLinesAPI

response = KLinesAPI.get_klines1d(
    params={
        # Trading pair (Binance spot symbol, hardcoded list of 10)
        "symbol": "BTCUSDT",
        # 1d window start date (1st of Jan, even years, UTC). Window covers 2 calendar years.
        "startDate": "2016-01-01"
    },
    api_root="https://finom.github.io/static-klines/api",
)

print(response)
[
    [
        1514764800000,
        "13715.65000000",
        "13818.55000000",
        "12750.00000000",
        "13380.00000000",
        "8609.91584400",
        1514851199999,
        "114799747.44197057",
        105595,
        "3961.93894600",
        "52809747.44038045",
        "0"
    ],
    [
        1514851200000,
        "13382.16000000",
        "15473.49000000",
        "12890.02000000",
        "14675.11000000",
        "20078.09211100",
        1514937599999,
        "275545340.79810440",
        197229,
        "9915.30471600",
        "136355703.49029400",
        "0"
    ]
]

KLinesAPI.get_klines_3_d

Get 3d klines window

Fully-closed Binance spot candles at the 3d interval. Each file covers exactly 5 calendar years, anchored at the calendar boundary shown by startDate. Call GET /api/klines/start-dates/3d.json for the full list of valid startDates.

GET https://finom.github.io/static-klines/api/klines/3d/{symbol}/{startDate}.json

from static_klines import KLinesAPI

response = KLinesAPI.get_klines3d(
    params={
        # Trading pair (Binance spot symbol, hardcoded list of 10)
        "symbol": "BTCUSDT",
        # 3d window start date (1st of Jan, every 5 years, UTC). Window covers 5 calendar years.
        "startDate": "2015-01-01"
    },
    api_root="https://finom.github.io/static-klines/api",
)

print(response)
[
    [
        1514764800000,
        "13715.65000000",
        "13818.55000000",
        "12750.00000000",
        "13380.00000000",
        "8609.91584400",
        1514851199999,
        "114799747.44197057",
        105595,
        "3961.93894600",
        "52809747.44038045",
        "0"
    ],
    [
        1514851200000,
        "13382.16000000",
        "15473.49000000",
        "12890.02000000",
        "14675.11000000",
        "20078.09211100",
        1514937599999,
        "275545340.79810440",
        197229,
        "9915.30471600",
        "136355703.49029400",
        "0"
    ]
]

KLinesAPI.get_klines_1_w

Get 1w klines window

Fully-closed Binance spot candles at the 1w interval. Each file covers exactly 10 calendar years, anchored at the calendar boundary shown by startDate. Call GET /api/klines/start-dates/1w.json for the full list of valid startDates.

GET https://finom.github.io/static-klines/api/klines/1w/{symbol}/{startDate}.json

from static_klines import KLinesAPI

response = KLinesAPI.get_klines1w(
    params={
        # Trading pair (Binance spot symbol, hardcoded list of 10)
        "symbol": "BTCUSDT",
        # 1w window start date (1st of Jan, every 10 years, UTC). Window covers 10 calendar years.
        "startDate": "2010-01-01"
    },
    api_root="https://finom.github.io/static-klines/api",
)

print(response)
[
    [
        1514764800000,
        "13715.65000000",
        "13818.55000000",
        "12750.00000000",
        "13380.00000000",
        "8609.91584400",
        1514851199999,
        "114799747.44197057",
        105595,
        "3961.93894600",
        "52809747.44038045",
        "0"
    ],
    [
        1514851200000,
        "13382.16000000",
        "15473.49000000",
        "12890.02000000",
        "14675.11000000",
        "20078.09211100",
        1514937599999,
        "275545340.79810440",
        197229,
        "9915.30471600",
        "136355703.49029400",
        "0"
    ]
]

KLinesAPI.get_klines_1_m

Get 1M klines window

Fully-closed Binance spot candles at the 1M interval. Each file covers exactly 10 calendar years, anchored at the calendar boundary shown by startDate. Call GET /api/klines/start-dates/1M.json for the full list of valid startDates.

GET https://finom.github.io/static-klines/api/klines/1M/{symbol}/{startDate}.json

from static_klines import KLinesAPI

response = KLinesAPI.get_klines1_m(
    params={
        # Trading pair (Binance spot symbol, hardcoded list of 10)
        "symbol": "BTCUSDT",
        # 1M window start date (1st of Jan, every 10 years, UTC). Window covers 10 calendar years of monthly candles.
        "startDate": "2010-01-01"
    },
    api_root="https://finom.github.io/static-klines/api",
)

print(response)
[
    [
        1514764800000,
        "13715.65000000",
        "13818.55000000",
        "12750.00000000",
        "13380.00000000",
        "8609.91584400",
        1514851199999,
        "114799747.44197057",
        105595,
        "3961.93894600",
        "52809747.44038045",
        "0"
    ],
    [
        1514851200000,
        "13382.16000000",
        "15473.49000000",
        "12890.02000000",
        "14675.11000000",
        "20078.09211100",
        1514937599999,
        "275545340.79810440",
        197229,
        "9915.30471600",
        "136355703.49029400",
        "0"
    ]
]

OpenAPI

OpenAPI.get_spec

OpenAPI 3.1 specification

Full OpenAPI document describing this API. Served at the API root so GET /api returns the spec directly.

GET https://finom.github.io/static-klines/api

from static_klines import OpenAPI

response = OpenAPI.get_spec(
    api_root="https://finom.github.io/static-klines/api",
)

Metadata

Release files for static-klines 0.1.8

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

Source distribution (sdist)

Source distribution for static-klines 0.1.8
File Size Uploaded Provenance
static_klines-0.1.8.tar.gz 23.6 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for static-klines 0.1.8
File Interpreter ABI Platform
static_klines-0.1.8-py3-none-any.whl Python 3 none any Details

Total release size: 48.0 kB

Release files / static_klines-0.1.8.tar.gz

Download URL static_klines-0.1.8.tar.gz
Size 23.6 kB
Tags Source
SHA-256 checksum
How to use checksums
5c38bfd0caf5b21b284c7e97e44b4adb030bfa8bd9fbf2aa063a33868af2f10d
BLAKE2b-256 checksum
How to use checksums
f34e741a045d95071e144309b067a9261cbd82ab2f262538f64dd9096dbc3b48
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / static_klines-0.1.8-py3-none-any.whl

Download URL static_klines-0.1.8-py3-none-any.whl
Size 24.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0ade260ad9a7881f40e73557d60eb1fef159be55c44074ad97fc651f5819cd5f
BLAKE2b-256 checksum
How to use checksums
b5eafb939a22a79a7c731bbb019f5bb81c7e734703b220a0273ccf12f92b91a8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Security for static-klines 0.1.8

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