pineforge-data 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pineforge_data-0.2.0/.dockerignore +8 -0
- pineforge_data-0.2.0/.github/release.yml +22 -0
- pineforge_data-0.2.0/.github/workflows/ci.yml +43 -0
- pineforge_data-0.2.0/.github/workflows/docs.yml +48 -0
- pineforge_data-0.2.0/.github/workflows/release.yml +231 -0
- pineforge_data-0.2.0/.gitignore +11 -0
- pineforge_data-0.2.0/CONTRIBUTING.md +82 -0
- pineforge_data-0.2.0/LICENSE +201 -0
- pineforge_data-0.2.0/PKG-INFO +364 -0
- pineforge_data-0.2.0/README.md +318 -0
- pineforge_data-0.2.0/docker/server.Dockerfile +43 -0
- pineforge_data-0.2.0/docs/api/backtesting.md +31 -0
- pineforge_data-0.2.0/docs/api/index.md +43 -0
- pineforge_data-0.2.0/docs/api/models.md +6 -0
- pineforge_data-0.2.0/docs/api/providers.md +55 -0
- pineforge_data-0.2.0/docs/api/requests.md +6 -0
- pineforge_data-0.2.0/docs/api/server.md +17 -0
- pineforge_data-0.2.0/docs/api/streaming.md +17 -0
- pineforge_data-0.2.0/docs/backtesting.md +212 -0
- pineforge_data-0.2.0/docs/data-model.md +139 -0
- pineforge_data-0.2.0/docs/getting-started.md +108 -0
- pineforge_data-0.2.0/docs/index.md +59 -0
- pineforge_data-0.2.0/docs/provider-contract.md +98 -0
- pineforge_data-0.2.0/docs/providers/ccxt.md +184 -0
- pineforge_data-0.2.0/docs/providers/csv.md +139 -0
- pineforge_data-0.2.0/docs/providers/sqlalchemy.md +161 -0
- pineforge_data-0.2.0/docs/providers/sqlite.md +131 -0
- pineforge_data-0.2.0/docs/providers/tabular-schema.md +152 -0
- pineforge_data-0.2.0/docs/providers.md +145 -0
- pineforge_data-0.2.0/docs/releasing.md +87 -0
- pineforge_data-0.2.0/docs/server.md +86 -0
- pineforge_data-0.2.0/mkdocs.yml +97 -0
- pineforge_data-0.2.0/pyproject.toml +83 -0
- pineforge_data-0.2.0/scripts/backtest.py +9 -0
- pineforge_data-0.2.0/scripts/bump_version.py +110 -0
- pineforge_data-0.2.0/scripts/verify_release.py +55 -0
- pineforge_data-0.2.0/src/pineforge_data/__init__.py +124 -0
- pineforge_data-0.2.0/src/pineforge_data/backtest.py +552 -0
- pineforge_data-0.2.0/src/pineforge_data/cli/__init__.py +1 -0
- pineforge_data-0.2.0/src/pineforge_data/cli/backtest.py +354 -0
- pineforge_data-0.2.0/src/pineforge_data/compile_cache.py +171 -0
- pineforge_data-0.2.0/src/pineforge_data/docker_runtime.py +226 -0
- pineforge_data-0.2.0/src/pineforge_data/engine.py +185 -0
- pineforge_data-0.2.0/src/pineforge_data/errors.py +5 -0
- pineforge_data-0.2.0/src/pineforge_data/models.py +199 -0
- pineforge_data-0.2.0/src/pineforge_data/providers/__init__.py +69 -0
- pineforge_data-0.2.0/src/pineforge_data/providers/base.py +51 -0
- pineforge_data-0.2.0/src/pineforge_data/providers/ccxt.py +411 -0
- pineforge_data-0.2.0/src/pineforge_data/providers/local.py +207 -0
- pineforge_data-0.2.0/src/pineforge_data/providers/registry.py +252 -0
- pineforge_data-0.2.0/src/pineforge_data/providers/sqlalchemy.py +138 -0
- pineforge_data-0.2.0/src/pineforge_data/providers/tabular.py +530 -0
- pineforge_data-0.2.0/src/pineforge_data/py.typed +1 -0
- pineforge_data-0.2.0/src/pineforge_data/release_contract.py +153 -0
- pineforge_data-0.2.0/src/pineforge_data/requests.py +87 -0
- pineforge_data-0.2.0/src/pineforge_data/server.py +646 -0
- pineforge_data-0.2.0/src/pineforge_data/server_client.py +142 -0
- pineforge_data-0.2.0/tests/fixtures/sma_cross.pine +11 -0
- pineforge_data-0.2.0/tests/test_backtest.py +338 -0
- pineforge_data-0.2.0/tests/test_ccxt.py +282 -0
- pineforge_data-0.2.0/tests/test_compile_cache.py +62 -0
- pineforge_data-0.2.0/tests/test_docker_integration.py +165 -0
- pineforge_data-0.2.0/tests/test_docker_runtime.py +58 -0
- pineforge_data-0.2.0/tests/test_documentation.py +29 -0
- pineforge_data-0.2.0/tests/test_engine.py +108 -0
- pineforge_data-0.2.0/tests/test_models.py +121 -0
- pineforge_data-0.2.0/tests/test_providers.py +88 -0
- pineforge_data-0.2.0/tests/test_release.py +103 -0
- pineforge_data-0.2.0/tests/test_release_contract.py +86 -0
- pineforge_data-0.2.0/tests/test_server.py +175 -0
- pineforge_data-0.2.0/tests/test_server_client.py +77 -0
- pineforge_data-0.2.0/tests/test_tabular_providers.py +312 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
changelog:
|
|
2
|
+
exclude:
|
|
3
|
+
labels:
|
|
4
|
+
- skip-changelog
|
|
5
|
+
categories:
|
|
6
|
+
- title: Breaking changes
|
|
7
|
+
labels:
|
|
8
|
+
- breaking-change
|
|
9
|
+
- title: Features
|
|
10
|
+
labels:
|
|
11
|
+
- enhancement
|
|
12
|
+
- feature
|
|
13
|
+
- title: Fixes
|
|
14
|
+
labels:
|
|
15
|
+
- bug
|
|
16
|
+
- fix
|
|
17
|
+
- title: Documentation
|
|
18
|
+
labels:
|
|
19
|
+
- documentation
|
|
20
|
+
- title: Other merged changes
|
|
21
|
+
labels:
|
|
22
|
+
- "*"
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
test:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
strategy:
|
|
15
|
+
fail-fast: false
|
|
16
|
+
matrix:
|
|
17
|
+
python-version: ["3.11", "3.12", "3.13"]
|
|
18
|
+
steps:
|
|
19
|
+
- uses: actions/checkout@v7
|
|
20
|
+
- uses: actions/setup-python@v6
|
|
21
|
+
with:
|
|
22
|
+
python-version: ${{ matrix.python-version }}
|
|
23
|
+
cache: pip
|
|
24
|
+
- run: python -m pip install --upgrade pip
|
|
25
|
+
- run: python -m pip install -e '.[dev,ccxt,release]'
|
|
26
|
+
- run: ruff check .
|
|
27
|
+
- run: mypy src
|
|
28
|
+
- run: pytest
|
|
29
|
+
- if: matrix.python-version == '3.13'
|
|
30
|
+
run: python -m build
|
|
31
|
+
- if: matrix.python-version == '3.13'
|
|
32
|
+
run: python -m twine check --strict dist/*
|
|
33
|
+
|
|
34
|
+
docker:
|
|
35
|
+
runs-on: ubuntu-latest
|
|
36
|
+
steps:
|
|
37
|
+
- uses: actions/checkout@v7
|
|
38
|
+
- uses: actions/setup-python@v6
|
|
39
|
+
with:
|
|
40
|
+
python-version: "3.13"
|
|
41
|
+
cache: pip
|
|
42
|
+
- run: python -m pip install -e '.[dev]'
|
|
43
|
+
- run: PINEFORGE_DOCKER_TEST=1 pytest tests/test_docker_integration.py
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
name: Documentation
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
workflow_dispatch:
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
contents: read
|
|
11
|
+
|
|
12
|
+
concurrency:
|
|
13
|
+
group: pages-${{ github.ref }}
|
|
14
|
+
cancel-in-progress: true
|
|
15
|
+
|
|
16
|
+
jobs:
|
|
17
|
+
build:
|
|
18
|
+
runs-on: ubuntu-latest
|
|
19
|
+
steps:
|
|
20
|
+
- uses: actions/checkout@v7
|
|
21
|
+
- uses: actions/setup-python@v6
|
|
22
|
+
with:
|
|
23
|
+
python-version: "3.13"
|
|
24
|
+
cache: pip
|
|
25
|
+
- run: python -m pip install --upgrade pip
|
|
26
|
+
- run: python -m pip install -e '.[docs]'
|
|
27
|
+
- run: mkdocs build --strict
|
|
28
|
+
- if: github.event_name != 'pull_request'
|
|
29
|
+
uses: actions/configure-pages@v5
|
|
30
|
+
- if: github.event_name != 'pull_request'
|
|
31
|
+
uses: actions/upload-pages-artifact@v4
|
|
32
|
+
with:
|
|
33
|
+
path: site
|
|
34
|
+
|
|
35
|
+
deploy:
|
|
36
|
+
if: github.event_name != 'pull_request'
|
|
37
|
+
needs: build
|
|
38
|
+
runs-on: ubuntu-latest
|
|
39
|
+
environment:
|
|
40
|
+
name: github-pages
|
|
41
|
+
url: ${{ steps.deployment.outputs.page_url }}
|
|
42
|
+
permissions:
|
|
43
|
+
pages: write
|
|
44
|
+
id-token: write
|
|
45
|
+
steps:
|
|
46
|
+
- name: Deploy GitHub Pages
|
|
47
|
+
id: deployment
|
|
48
|
+
uses: actions/deploy-pages@v4
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
inputs:
|
|
6
|
+
bump:
|
|
7
|
+
description: Semantic version component to increment
|
|
8
|
+
required: true
|
|
9
|
+
default: patch
|
|
10
|
+
type: choice
|
|
11
|
+
options:
|
|
12
|
+
- patch
|
|
13
|
+
- minor
|
|
14
|
+
- major
|
|
15
|
+
|
|
16
|
+
permissions:
|
|
17
|
+
contents: read
|
|
18
|
+
|
|
19
|
+
concurrency:
|
|
20
|
+
group: release
|
|
21
|
+
cancel-in-progress: false
|
|
22
|
+
|
|
23
|
+
jobs:
|
|
24
|
+
prepare:
|
|
25
|
+
runs-on: ubuntu-latest
|
|
26
|
+
permissions:
|
|
27
|
+
contents: write
|
|
28
|
+
issues: write
|
|
29
|
+
pull-requests: write
|
|
30
|
+
outputs:
|
|
31
|
+
published: ${{ steps.release.outputs.published }}
|
|
32
|
+
sha: ${{ steps.release.outputs.sha }}
|
|
33
|
+
tag: ${{ steps.release.outputs.tag }}
|
|
34
|
+
version: ${{ steps.release.outputs.version }}
|
|
35
|
+
steps:
|
|
36
|
+
- uses: actions/checkout@v7
|
|
37
|
+
with:
|
|
38
|
+
fetch-depth: 0
|
|
39
|
+
ref: ${{ github.sha }}
|
|
40
|
+
- uses: actions/setup-python@v6
|
|
41
|
+
with:
|
|
42
|
+
python-version: "3.13"
|
|
43
|
+
- name: Create and merge version bump
|
|
44
|
+
id: release
|
|
45
|
+
env:
|
|
46
|
+
BUMP: ${{ inputs.bump }}
|
|
47
|
+
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
|
|
48
|
+
GH_TOKEN: ${{ github.token }}
|
|
49
|
+
GH_REPO: ${{ github.repository }}
|
|
50
|
+
run: |
|
|
51
|
+
set -euo pipefail
|
|
52
|
+
if [[ "$GITHUB_REF_NAME" != "$DEFAULT_BRANCH" ]]; then
|
|
53
|
+
echo "Release must be dispatched from $DEFAULT_BRANCH, not $GITHUB_REF_NAME" >&2
|
|
54
|
+
exit 1
|
|
55
|
+
fi
|
|
56
|
+
|
|
57
|
+
current_version="$(python scripts/bump_version.py current)"
|
|
58
|
+
version="$(python scripts/bump_version.py "$BUMP")"
|
|
59
|
+
tag="v$version"
|
|
60
|
+
git fetch origin "$DEFAULT_BRANCH" --tags
|
|
61
|
+
|
|
62
|
+
if sha="$(git rev-list -n 1 "$tag" 2>/dev/null)" && [[ -n "$sha" ]]; then
|
|
63
|
+
echo "Reusing existing tag $tag at $sha"
|
|
64
|
+
else
|
|
65
|
+
git show "origin/$DEFAULT_BRANCH:pyproject.toml" > "$RUNNER_TEMP/main-pyproject.toml"
|
|
66
|
+
main_version="$(python scripts/bump_version.py current --pyproject "$RUNNER_TEMP/main-pyproject.toml")"
|
|
67
|
+
if [[ "$main_version" == "$version" ]]; then
|
|
68
|
+
sha="$(git rev-parse "origin/$DEFAULT_BRANCH")"
|
|
69
|
+
echo "Reusing version bump already merged at $sha"
|
|
70
|
+
elif [[ "$main_version" != "$current_version" ]]; then
|
|
71
|
+
echo "main moved from version $current_version to $main_version; dispatch again" >&2
|
|
72
|
+
exit 1
|
|
73
|
+
else
|
|
74
|
+
branch="release/$tag-$GITHUB_RUN_ID"
|
|
75
|
+
git switch --create "$branch" "origin/$DEFAULT_BRANCH"
|
|
76
|
+
written_version="$(python scripts/bump_version.py "$BUMP" --write)"
|
|
77
|
+
[[ "$written_version" == "$version" ]]
|
|
78
|
+
git config user.name "github-actions[bot]"
|
|
79
|
+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
|
80
|
+
git add pyproject.toml
|
|
81
|
+
git commit -m "Release $tag"
|
|
82
|
+
head_sha="$(git rev-parse HEAD)"
|
|
83
|
+
git push --set-upstream origin "$branch"
|
|
84
|
+
|
|
85
|
+
gh label create skip-changelog \
|
|
86
|
+
--description "Exclude this PR from generated release notes" \
|
|
87
|
+
--color "ededed" \
|
|
88
|
+
--force
|
|
89
|
+
pr_url="$(gh pr create \
|
|
90
|
+
--base "$DEFAULT_BRANCH" \
|
|
91
|
+
--head "$branch" \
|
|
92
|
+
--title "Release $tag" \
|
|
93
|
+
--body "Automated **$BUMP** version bump from $current_version to $version.")"
|
|
94
|
+
pr_number="${pr_url##*/}"
|
|
95
|
+
gh pr edit "$pr_number" --add-label skip-changelog
|
|
96
|
+
mergeable=UNKNOWN
|
|
97
|
+
for _attempt in {1..30}; do
|
|
98
|
+
mergeable="$(gh pr view "$pr_number" --json mergeable --jq ".mergeable")"
|
|
99
|
+
[[ "$mergeable" == "MERGEABLE" ]] && break
|
|
100
|
+
if [[ "$mergeable" == "CONFLICTING" ]]; then
|
|
101
|
+
echo "Release PR $pr_number conflicts with $DEFAULT_BRANCH" >&2
|
|
102
|
+
exit 1
|
|
103
|
+
fi
|
|
104
|
+
sleep 2
|
|
105
|
+
done
|
|
106
|
+
if [[ "$mergeable" != "MERGEABLE" ]]; then
|
|
107
|
+
echo "Release PR $pr_number did not become mergeable" >&2
|
|
108
|
+
exit 1
|
|
109
|
+
fi
|
|
110
|
+
gh pr merge "$pr_number" \
|
|
111
|
+
--squash \
|
|
112
|
+
--delete-branch \
|
|
113
|
+
--match-head-commit "$head_sha" \
|
|
114
|
+
--subject "Release $tag" \
|
|
115
|
+
--body "Automated semantic version bump."
|
|
116
|
+
sha="$(gh pr view "$pr_number" --json mergeCommit --jq ".mergeCommit.oid")"
|
|
117
|
+
fi
|
|
118
|
+
fi
|
|
119
|
+
|
|
120
|
+
pypi_status="$(curl \
|
|
121
|
+
--silent \
|
|
122
|
+
--output /dev/null \
|
|
123
|
+
--write-out '%{http_code}' \
|
|
124
|
+
--retry 3 \
|
|
125
|
+
--retry-all-errors \
|
|
126
|
+
"https://pypi.org/pypi/pineforge-data/$version/json")"
|
|
127
|
+
case "$pypi_status" in
|
|
128
|
+
200) published=true ;;
|
|
129
|
+
404) published=false ;;
|
|
130
|
+
*)
|
|
131
|
+
echo "Unexpected PyPI status $pypi_status while checking $version" >&2
|
|
132
|
+
exit 1
|
|
133
|
+
;;
|
|
134
|
+
esac
|
|
135
|
+
|
|
136
|
+
{
|
|
137
|
+
echo "published=$published"
|
|
138
|
+
echo "sha=$sha"
|
|
139
|
+
echo "tag=$tag"
|
|
140
|
+
echo "version=$version"
|
|
141
|
+
} >> "$GITHUB_OUTPUT"
|
|
142
|
+
printf "Prepared %s at %s (already on PyPI: %s).\n" \
|
|
143
|
+
"$tag" "$sha" "$published" >> "$GITHUB_STEP_SUMMARY"
|
|
144
|
+
|
|
145
|
+
build:
|
|
146
|
+
if: needs.prepare.outputs.published != 'true'
|
|
147
|
+
needs: prepare
|
|
148
|
+
runs-on: ubuntu-latest
|
|
149
|
+
steps:
|
|
150
|
+
- uses: actions/checkout@v7
|
|
151
|
+
with:
|
|
152
|
+
ref: ${{ needs.prepare.outputs.sha }}
|
|
153
|
+
persist-credentials: false
|
|
154
|
+
- uses: actions/setup-python@v6
|
|
155
|
+
with:
|
|
156
|
+
python-version: "3.13"
|
|
157
|
+
cache: pip
|
|
158
|
+
- run: python -m pip install --upgrade pip
|
|
159
|
+
- run: python -m pip install -e '.[dev,ccxt,release]'
|
|
160
|
+
- name: Verify release tag and source
|
|
161
|
+
run: python scripts/verify_release.py "${{ needs.prepare.outputs.tag }}"
|
|
162
|
+
- name: Run static and unit checks
|
|
163
|
+
run: |
|
|
164
|
+
ruff check .
|
|
165
|
+
mypy src
|
|
166
|
+
pytest
|
|
167
|
+
- name: Run Docker integration checks
|
|
168
|
+
run: PINEFORGE_DOCKER_TEST=1 pytest tests/test_docker_integration.py
|
|
169
|
+
- name: Build wheel and source distribution
|
|
170
|
+
run: python -m build
|
|
171
|
+
- name: Check distribution metadata
|
|
172
|
+
run: python -m twine check --strict dist/*
|
|
173
|
+
- name: Install wheel in a clean environment
|
|
174
|
+
run: |
|
|
175
|
+
python -m venv /tmp/pineforge-wheel
|
|
176
|
+
/tmp/pineforge-wheel/bin/python -m pip install dist/*.whl
|
|
177
|
+
/tmp/pineforge-wheel/bin/python -c "import pineforge_data; assert 'Bar' in pineforge_data.__all__"
|
|
178
|
+
- name: Upload validated distributions
|
|
179
|
+
uses: actions/upload-artifact@v5
|
|
180
|
+
with:
|
|
181
|
+
name: python-package-distributions
|
|
182
|
+
path: dist/
|
|
183
|
+
if-no-files-found: error
|
|
184
|
+
|
|
185
|
+
github-release:
|
|
186
|
+
if: needs.prepare.outputs.published != 'true'
|
|
187
|
+
needs:
|
|
188
|
+
- prepare
|
|
189
|
+
- build
|
|
190
|
+
runs-on: ubuntu-latest
|
|
191
|
+
permissions:
|
|
192
|
+
contents: write
|
|
193
|
+
steps:
|
|
194
|
+
- name: Create GitHub Release with generated notes
|
|
195
|
+
env:
|
|
196
|
+
GH_TOKEN: ${{ github.token }}
|
|
197
|
+
GH_REPO: ${{ github.repository }}
|
|
198
|
+
SHA: ${{ needs.prepare.outputs.sha }}
|
|
199
|
+
TAG: ${{ needs.prepare.outputs.tag }}
|
|
200
|
+
run: |
|
|
201
|
+
set -euo pipefail
|
|
202
|
+
if gh release view "$TAG" >/dev/null 2>&1; then
|
|
203
|
+
echo "GitHub Release $TAG already exists"
|
|
204
|
+
else
|
|
205
|
+
gh release create "$TAG" \
|
|
206
|
+
--target "$SHA" \
|
|
207
|
+
--title "pineforge-data $TAG" \
|
|
208
|
+
--generate-notes \
|
|
209
|
+
--latest
|
|
210
|
+
fi
|
|
211
|
+
|
|
212
|
+
publish:
|
|
213
|
+
if: needs.prepare.outputs.published != 'true'
|
|
214
|
+
needs:
|
|
215
|
+
- prepare
|
|
216
|
+
- build
|
|
217
|
+
- github-release
|
|
218
|
+
runs-on: ubuntu-latest
|
|
219
|
+
environment:
|
|
220
|
+
name: pypi
|
|
221
|
+
url: https://pypi.org/project/pineforge-data/
|
|
222
|
+
permissions:
|
|
223
|
+
id-token: write
|
|
224
|
+
steps:
|
|
225
|
+
- name: Download validated distributions
|
|
226
|
+
uses: actions/download-artifact@v6
|
|
227
|
+
with:
|
|
228
|
+
name: python-package-distributions
|
|
229
|
+
path: dist/
|
|
230
|
+
- name: Publish to PyPI with Trusted Publishing
|
|
231
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
Community data providers are the reason this repository exists. Keep the core
|
|
4
|
+
contracts small and put vendor behavior behind Python provider modules. This
|
|
5
|
+
repository does not accept a separate C++ provider implementation surface.
|
|
6
|
+
|
|
7
|
+
User-facing architecture and API guides are indexed in
|
|
8
|
+
[docs/index.md](docs/index.md). Update the applicable guide when changing public
|
|
9
|
+
models, provider behavior, CLI options, report fields, runtime channels, or
|
|
10
|
+
server/cache semantics.
|
|
11
|
+
|
|
12
|
+
Docker is required for raw-Pine integration work. Engine and codegen are
|
|
13
|
+
consumed only through the pinned `pineforge-release` image; do not add source
|
|
14
|
+
submodules or duplicate their build logic here.
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
docker version
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Provider checklist
|
|
21
|
+
|
|
22
|
+
- Implement `MarketDataProvider` for backtest-compatible adapters; live-trade
|
|
23
|
+
and macro support remain separate optional protocols.
|
|
24
|
+
- Resolve exact normalized symbols from the upstream market catalog. Do not
|
|
25
|
+
infer base, quote, settlement currency, or contract terms by parsing symbols.
|
|
26
|
+
- Preserve both the normalized symbol and the provider-native `provider_id`.
|
|
27
|
+
- Represent spot/cash/CFD/swap/future/option separately and populate derivative
|
|
28
|
+
contract size, linear/inverse flags, expiry, strike, and option type when the
|
|
29
|
+
upstream supplies them.
|
|
30
|
+
- Normalize all timestamps to Unix milliseconds.
|
|
31
|
+
- Preserve the source name and normalized instrument on every record.
|
|
32
|
+
- Keep credentials out of logs and exception messages; prefer authorization
|
|
33
|
+
headers when the upstream API supports them.
|
|
34
|
+
- Make retries, timeouts, and rate limits explicit.
|
|
35
|
+
- Add offline fixture tests. CI must not require network access or API keys.
|
|
36
|
+
- Declare provider-specific libraries as optional dependencies.
|
|
37
|
+
- Keep local/database adapters read-only, validate mapped identifiers against
|
|
38
|
+
reflected metadata, and bind query values instead of accepting raw SQL.
|
|
39
|
+
- Keep provider-specific request parameters inside the adapter rather than
|
|
40
|
+
extending the normalized records.
|
|
41
|
+
- Never make `pineforge-engine` depend on this package.
|
|
42
|
+
|
|
43
|
+
Adapters may be contributed in-tree or shipped by another Python package. An
|
|
44
|
+
external package registers a factory without changing this repository's CLI:
|
|
45
|
+
|
|
46
|
+
```toml
|
|
47
|
+
[project.entry-points."pineforge_data.providers"]
|
|
48
|
+
example = "example_pineforge:provider_factory"
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
The callable receives `(venue, config)` and returns a structural
|
|
52
|
+
`MarketDataProvider`. See [docs/provider-contract.md](docs/provider-contract.md)
|
|
53
|
+
for the normalized model and a complete skeleton.
|
|
54
|
+
|
|
55
|
+
Every provider must have a second-level API guide at
|
|
56
|
+
`docs/providers/<provider>.md` and a catalog row in
|
|
57
|
+
`docs/providers.md`. Keep provider-specific installation, constructor,
|
|
58
|
+
configuration, behavior, errors, and limitations out of the catalog page.
|
|
59
|
+
|
|
60
|
+
## Determinism and macro vintages
|
|
61
|
+
|
|
62
|
+
Historical results must be reproducible. Cache or snapshot mutable upstream
|
|
63
|
+
responses when exact replay matters. Macroeconomic values require both the
|
|
64
|
+
original release timestamp and the timestamp at which a particular vintage
|
|
65
|
+
became available; using today's revised value in an old backtest is lookahead.
|
|
66
|
+
|
|
67
|
+
## Checks
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
python -m pip install -e '.[dev,ccxt,database,server,docs,release]'
|
|
71
|
+
ruff check .
|
|
72
|
+
mypy src
|
|
73
|
+
pytest
|
|
74
|
+
mkdocs build --strict
|
|
75
|
+
python -m build
|
|
76
|
+
python -m twine check dist/*
|
|
77
|
+
PINEFORGE_DOCKER_TEST=1 pytest tests/test_docker_integration.py
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Maintainers should follow the version, tag, artifact, and Trusted Publishing
|
|
81
|
+
steps in the [release guide](docs/releasing.md). Contributors cannot publish a
|
|
82
|
+
package from a pull request.
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 PineForge contributors
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|