Skip to main content

PineForge Data

PyPI Python CI Documentation

Fetch normalized market data and run raw PineScript strategies through PineForge.

PineForge Data provides Python adapters for exchanges, CSV files, SQLite, and SQLAlchemy-compatible databases. Its backtest harness sends normalized OHLCV to the pineforge-release container, which transpiles the PineScript, compiles it, and runs pineforge-engine.

exchange / CSV / database
          ↓
    pineforge-data
          ↓
 pineforge-release container
          ↓
     backtest report

The provider layer is Python-only. You do not need a C++ compiler, Git submodules, or local engine and codegen checkouts.

Quick start

You need Python 3.11 or newer. Docker is required only for backtests; fetching and normalizing data does not use Docker.

1. Install an exchange provider

python -m pip install 'pineforge-data[ccxt]'

2. Fetch confirmed OHLCV

import asyncio

from pineforge_data import BarRequest, CcxtProvider


async def main() -> None:
    async with CcxtProvider("bitstamp") as provider:
        market = await provider.resolve_market("BTC/USD")
        bars = await provider.fetch_bars(
            BarRequest(
                instrument=market.instrument,
                timeframe="15m",
                start_ms=1_751_328_000_000,
                end_ms=1_751_414_400_000,
            )
        )
        print(bars[-1])


asyncio.run(main())

Symbols are resolved through the provider catalog. For example, CCXT spot BTC/USDT and linear swap BTC/USDT:USDT are distinct instruments with different contract metadata.

3. Backtest raw PineScript

Save a strategy as strategy.pine:

//@version=6
strategy("SMA cross", initial_capital=10000, default_qty_type=strategy.percent_of_equity, default_qty_value=10)

fast = ta.sma(close, 2)
slow = ta.sma(close, 4)

if ta.crossover(fast, slow)
    strategy.entry("Long", strategy.long)

if ta.crossunder(fast, slow)
    strategy.close("Long")

Then run:

pineforge-backtest \
  --pine strategy.pine \
  --provider ccxt \
  --venue bitstamp \
  --symbol BTC/USD \
  --timeframe 15m \
  --start 2025-07-01T00:00:00Z \
  --end 2025-07-08T00:00:00Z \
  --warmup-bars 100 \
  --output report.json \
  --pretty

The first run pulls the exact release and digest in DEFAULT_RELEASE_IMAGE. The runtime and server defaults advance together through a tested release PR; the release guide describes the automated gates. Results can differ between releases, notably for scripts that omit their capital or order size; the runtime image policy explains why and how to pin another release with --runtime-image. The JSON report includes trades, performance statistics, the equity curve, data provenance, and exact runtime versions. The strategy is compiled inside an isolated Docker container; the provider and its credentials remain on the host.

Bring your own data

PineForge does not require a fixed table definition. Local providers inspect headers or reflected database columns at runtime, infer common OHLCV names, and accept an explicit mapping when your schema uses different names.

Source Install Guide
CSV pip install pineforge-data CSV API
SQLite pip install pineforge-data SQLite API
SQLAlchemy database pip install 'pineforge-data[database]' plus a database driver SQLAlchemy API
CCXT exchange pip install 'pineforge-data[ccxt]' CCXT API

The same pineforge-backtest command supports --provider csv, sqlite, and sqlalchemy. See the backtesting guide for provider configuration, warmup behavior, strategy inputs, reports, and local versus remote execution.

Documentation

I want to… Read…
Install and run the first request Getting started
Look up Python classes and signatures API reference
Choose or configure a provider Provider catalog
Understand instruments, contracts, and bars Data model
Run and reproduce backtests Backtesting
Deploy the concurrent compile/backtest service FastAPI server
Implement a broker or exchange adapter Provider contract

Contributing

Community providers are welcome. Keep vendor SDKs and schemas inside the adapter, resolve instruments through the upstream market catalog, normalize timestamps to Unix milliseconds, and add deterministic offline tests.

git clone https://github.com/pineforge-4pass/pineforge-data.git
cd pineforge-data
python -m pip install -e '.[dev,ccxt,database-e2e,server,docs,release]'
ruff check .
mypy src
pytest
mkdocs build --strict

Run ./scripts/run_database_e2e.sh to seed corpus OHLCV into disposable SQLite, MySQL, and PostgreSQL databases and verify the public provider API against all three.

Read CONTRIBUTING.md for the provider contract, entry points, security rules, and full validation checklist.

Apache-2.0 licensed.

Metadata

Release files for pineforge-data 0.3.1

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

Source distribution (sdist)

Source distribution for pineforge-data 0.3.1
File Size Uploaded Provenance Actions
pineforge_data-0.3.1.tar.gz 169.9 kB With provenance Details for pineforge_data-0.3.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pineforge-data 0.3.1
File Interpreter ABI Platform Actions
pineforge_data-0.3.1-py3-none-any.whl Python 3 none any Details for pineforge_data-0.3.1-py3-none-any.whl

Total release size: 234.9 kB

Release files / pineforge_data-0.3.1.tar.gz

Download URL pineforge_data-0.3.1.tar.gz
Size 169.9 kB
Tags Source
SHA-256 checksum
How to use checksums
485154246807d7f2aa23c7054ea030082d1ceaaa19cc3c3f5f3c693b0e2641df
BLAKE2b-256 checksum
How to use checksums
3d1a25501984ad26e1742c2c6859300be0adefa89a61c0d963ff1b559f49c27d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 19, 2026.

Transparency log

Release files / pineforge_data-0.3.1-py3-none-any.whl

Download URL pineforge_data-0.3.1-py3-none-any.whl
Size 65.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7def570e210a808f73468aa32fe90c73373506a1faa294b8e3250fe38fafa9f0
BLAKE2b-256 checksum
How to use checksums
66a06f8bb34dbd3d765045c9d38af5b3c128cb91f9b9cebea68c52c1d57ece21
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 19, 2026.

Transparency log

Security for pineforge-data 0.3.1

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pineforge_data-0.3.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 19, 2026.

Transparency log

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