pineforge-codegen 1.1.0__tar.gz → 1.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_codegen-1.1.0 → pineforge_codegen-1.2.0}/.gitignore +1 -0
- {pineforge_codegen-1.1.0 → pineforge_codegen-1.2.0}/CHANGELOG.md +238 -0
- {pineforge_codegen-1.1.0 → pineforge_codegen-1.2.0}/CONTRIBUTING.md +7 -6
- pineforge_codegen-1.2.0/LEGAL.md +42 -0
- pineforge_codegen-1.2.0/LICENSE +245 -0
- {pineforge_codegen-1.1.0 → pineforge_codegen-1.2.0}/PKG-INFO +263 -169
- {pineforge_codegen-1.1.0 → pineforge_codegen-1.2.0}/README.md +82 -36
- pineforge_codegen-1.2.0/VERSION +1 -0
- {pineforge_codegen-1.1.0 → pineforge_codegen-1.2.0}/docs/PUBLIC_CONTRACT.md +99 -5
- {pineforge_codegen-1.1.0 → pineforge_codegen-1.2.0}/docs/pine-cap-activation.md +4 -4
- {pineforge_codegen-1.1.0 → pineforge_codegen-1.2.0}/pineforge_codegen/__init__.py +1 -0
- {pineforge_codegen-1.1.0 → pineforge_codegen-1.2.0}/pineforge_codegen/codegen/base.py +38 -1
- pineforge_codegen-1.2.0/pineforge_codegen/codegen/capabilities.py +186 -0
- {pineforge_codegen-1.1.0 → pineforge_codegen-1.2.0}/pineforge_codegen/codegen/checked_settings.py +16 -3
- {pineforge_codegen-1.1.0 → pineforge_codegen-1.2.0}/pineforge_codegen/codegen/emit_top.py +2 -0
- {pineforge_codegen-1.1.0 → pineforge_codegen-1.2.0}/pineforge_codegen/codegen/helpers.py +1 -0
- pineforge_codegen-1.2.0/pineforge_codegen/diagnostic_codes.py +341 -0
- pineforge_codegen-1.2.0/pineforge_codegen/diagnostics_catalog.json +631 -0
- {pineforge_codegen-1.1.0 → pineforge_codegen-1.2.0}/pineforge_codegen/errors.py +23 -0
- {pineforge_codegen-1.1.0 → pineforge_codegen-1.2.0}/pineforge_codegen/external_requests.py +16 -0
- {pineforge_codegen-1.1.0 → pineforge_codegen-1.2.0}/pyproject.toml +2 -2
- pineforge_codegen-1.1.0/LEGAL.md +0 -32
- pineforge_codegen-1.1.0/LICENSE +0 -197
- pineforge_codegen-1.1.0/VERSION +0 -1
- {pineforge_codegen-1.1.0 → pineforge_codegen-1.2.0}/docs/codegen-coverage-gaps.md +0 -0
- {pineforge_codegen-1.1.0 → pineforge_codegen-1.2.0}/pineforge_codegen/analyzer/__init__.py +0 -0
- {pineforge_codegen-1.1.0 → pineforge_codegen-1.2.0}/pineforge_codegen/analyzer/base.py +0 -0
- {pineforge_codegen-1.1.0 → pineforge_codegen-1.2.0}/pineforge_codegen/analyzer/call_handlers.py +0 -0
- {pineforge_codegen-1.1.0 → pineforge_codegen-1.2.0}/pineforge_codegen/analyzer/contracts.py +0 -0
- {pineforge_codegen-1.1.0 → pineforge_codegen-1.2.0}/pineforge_codegen/analyzer/diagnostics.py +0 -0
- {pineforge_codegen-1.1.0 → pineforge_codegen-1.2.0}/pineforge_codegen/analyzer/tables.py +0 -0
- {pineforge_codegen-1.1.0 → pineforge_codegen-1.2.0}/pineforge_codegen/analyzer/types.py +0 -0
- {pineforge_codegen-1.1.0 → pineforge_codegen-1.2.0}/pineforge_codegen/ast_nodes.py +0 -0
- {pineforge_codegen-1.1.0 → pineforge_codegen-1.2.0}/pineforge_codegen/block_locals.py +0 -0
- {pineforge_codegen-1.1.0 → pineforge_codegen-1.2.0}/pineforge_codegen/builtin_keywords.py +0 -0
- {pineforge_codegen-1.1.0 → pineforge_codegen-1.2.0}/pineforge_codegen/codegen/__init__.py +0 -0
- {pineforge_codegen-1.1.0 → pineforge_codegen-1.2.0}/pineforge_codegen/codegen/collection_history.py +0 -0
- {pineforge_codegen-1.1.0 → pineforge_codegen-1.2.0}/pineforge_codegen/codegen/constant_fold.py +0 -0
- {pineforge_codegen-1.1.0 → pineforge_codegen-1.2.0}/pineforge_codegen/codegen/drawing.py +0 -0
- {pineforge_codegen-1.1.0 → pineforge_codegen-1.2.0}/pineforge_codegen/codegen/helpers_syminfo.py +0 -0
- {pineforge_codegen-1.1.0 → pineforge_codegen-1.2.0}/pineforge_codegen/codegen/host_members.py +0 -0
- {pineforge_codegen-1.1.0 → pineforge_codegen-1.2.0}/pineforge_codegen/codegen/input.py +0 -0
- {pineforge_codegen-1.1.0 → pineforge_codegen-1.2.0}/pineforge_codegen/codegen/security.py +0 -0
- {pineforge_codegen-1.1.0 → pineforge_codegen-1.2.0}/pineforge_codegen/codegen/session_market.py +0 -0
- {pineforge_codegen-1.1.0 → pineforge_codegen-1.2.0}/pineforge_codegen/codegen/ta.py +0 -0
- {pineforge_codegen-1.1.0 → pineforge_codegen-1.2.0}/pineforge_codegen/codegen/tables.py +0 -0
- {pineforge_codegen-1.1.0 → pineforge_codegen-1.2.0}/pineforge_codegen/codegen/tv_number_format.py +0 -0
- {pineforge_codegen-1.1.0 → pineforge_codegen-1.2.0}/pineforge_codegen/codegen/types.py +0 -0
- {pineforge_codegen-1.1.0 → pineforge_codegen-1.2.0}/pineforge_codegen/codegen/visit_call.py +0 -0
- {pineforge_codegen-1.1.0 → pineforge_codegen-1.2.0}/pineforge_codegen/codegen/visit_expr.py +0 -0
- {pineforge_codegen-1.1.0 → pineforge_codegen-1.2.0}/pineforge_codegen/codegen/visit_stmt.py +0 -0
- {pineforge_codegen-1.1.0 → pineforge_codegen-1.2.0}/pineforge_codegen/collection_history.py +0 -0
- {pineforge_codegen-1.1.0 → pineforge_codegen-1.2.0}/pineforge_codegen/finite_ta_length.py +0 -0
- {pineforge_codegen-1.1.0 → pineforge_codegen-1.2.0}/pineforge_codegen/lexer.py +0 -0
- {pineforge_codegen-1.1.0 → pineforge_codegen-1.2.0}/pineforge_codegen/library_inline.py +0 -0
- {pineforge_codegen-1.1.0 → pineforge_codegen-1.2.0}/pineforge_codegen/library_modules.py +0 -0
- {pineforge_codegen-1.1.0 → pineforge_codegen-1.2.0}/pineforge_codegen/library_v5.py +0 -0
- {pineforge_codegen-1.1.0 → pineforge_codegen-1.2.0}/pineforge_codegen/limits.py +0 -0
- {pineforge_codegen-1.1.0 → pineforge_codegen-1.2.0}/pineforge_codegen/method_binding.py +0 -0
- {pineforge_codegen-1.1.0 → pineforge_codegen-1.2.0}/pineforge_codegen/parser.py +0 -0
- {pineforge_codegen-1.1.0 → pineforge_codegen-1.2.0}/pineforge_codegen/pine_libraries.py +0 -0
- {pineforge_codegen-1.1.0 → pineforge_codegen-1.2.0}/pineforge_codegen/pine_spelling.py +0 -0
- {pineforge_codegen-1.1.0 → pineforge_codegen-1.2.0}/pineforge_codegen/pragmas.py +0 -0
- {pineforge_codegen-1.1.0 → pineforge_codegen-1.2.0}/pineforge_codegen/request_discovery.py +0 -0
- {pineforge_codegen-1.1.0 → pineforge_codegen-1.2.0}/pineforge_codegen/security_contexts.py +0 -0
- {pineforge_codegen-1.1.0 → pineforge_codegen-1.2.0}/pineforge_codegen/session_reads.py +0 -0
- {pineforge_codegen-1.1.0 → pineforge_codegen-1.2.0}/pineforge_codegen/signatures.py +0 -0
- {pineforge_codegen-1.1.0 → pineforge_codegen-1.2.0}/pineforge_codegen/support_checker.py +0 -0
- {pineforge_codegen-1.1.0 → pineforge_codegen-1.2.0}/pineforge_codegen/symbols.py +0 -0
- {pineforge_codegen-1.1.0 → pineforge_codegen-1.2.0}/pineforge_codegen/tokens.py +0 -0
- {pineforge_codegen-1.1.0 → pineforge_codegen-1.2.0}/pineforge_codegen/tv_input_choices.py +0 -0
|
@@ -20,6 +20,244 @@ supported as exact pairs; on the 0.x line they are independent. See the
|
|
|
20
20
|
the release commit. A prerelease note describes changes since the preceding
|
|
21
21
|
prerelease or stable tag; the final stable note consolidates the series.
|
|
22
22
|
|
|
23
|
+
## 1.2.0 — 2026-10-05
|
|
24
|
+
|
|
25
|
+
A minor release: generated strategy libraries gain the compiled execution
|
|
26
|
+
capability receipt that engine `v1.2.0` adds to the C ABI, every diagnostic
|
|
27
|
+
carries a stable code and named arguments, and the package is licensed under
|
|
28
|
+
the PineForge Source License 1.1. It covers the changes merged to `main` since
|
|
29
|
+
1.1.0:
|
|
30
|
+
[#167](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/167)
|
|
31
|
+
changes the emitted C++,
|
|
32
|
+
[#166](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/166)
|
|
33
|
+
adds diagnostic codes to the Python and JSON results and raises a script's
|
|
34
|
+
first error in source order again,
|
|
35
|
+
[#171](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/171)
|
|
36
|
+
classifies diagnostic codes in linear time, moves to the PineForge Source
|
|
37
|
+
License 1.1 and renders the README's scoreboard, and
|
|
38
|
+
[#168](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/168)
|
|
39
|
+
replaces the license. Codegen `1.2.0` supports only engine `v1.2.0`. Engine
|
|
40
|
+
`v1.2.0` defines `PF_CAPABILITIES_API_VERSION` (1) and declares two functions
|
|
41
|
+
in `<pineforge/pineforge.h>`
|
|
42
|
+
([pineforge-engine#332](https://github.com/pineforge-4pass/pineforge-engine/pull/332))
|
|
43
|
+
that the C++ of codegen 1.2.0 defines; the pair keeps C ABI version 4 and the
|
|
44
|
+
script ABI epoch `engine_script_run_v19`.
|
|
45
|
+
|
|
46
|
+
### Compatibility and migration
|
|
47
|
+
|
|
48
|
+
- Regenerate C++ with 1.2.0 and relink it against engine `v1.2.0`'s headers
|
|
49
|
+
and `libpineforge.a`. The C++ defines the capability functions only when the
|
|
50
|
+
engine's `pineforge/pineforge.h` defines both `PF_SETTINGS_API_VERSION` and
|
|
51
|
+
`PF_CAPABILITIES_API_VERSION`, as engine `v1.2.0`'s does. Against headers
|
|
52
|
+
without `PF_CAPABILITIES_API_VERSION`, such as engine `v1.1.0`'s, that block
|
|
53
|
+
compiles to nothing and the library has no receipt; this does not make such
|
|
54
|
+
a pair supported. C++ generated by 1.1.0 has no receipt either. Engine
|
|
55
|
+
`v1.2.0`'s live runner warns that it cannot prove a library without a
|
|
56
|
+
receipt eligible, and runs it (see "Compiled execution capabilities").
|
|
57
|
+
- Every generated C++ file changes: it gains the capability block. Beyond
|
|
58
|
+
that, the C++ does not change: for the engine's 325 public corpus sources
|
|
59
|
+
and this repository's 277 gate fixtures, each transpiled in a fresh process,
|
|
60
|
+
1.2.0's C++ with the capability block removed is 1.1.0's C++ byte for byte,
|
|
61
|
+
and the 13 fixtures the gate expects to be refused are refused with the same
|
|
62
|
+
message. A script name spelled `strategy_capabilities_api_version` or
|
|
63
|
+
`strategy_capabilities_receipt` is renamed in the C++ (for example
|
|
64
|
+
`pf_safe_strategy_capabilities_receipt`), so a script cannot shadow the new
|
|
65
|
+
functions; input keys are unaffected.
|
|
66
|
+
- The Python and JSON contract is additive: each `Diagnostic` gains the
|
|
67
|
+
properties `code` and `args`, `pineforge_codegen` exports
|
|
68
|
+
`diagnostics_catalog()` and `render_diagnostic()`, and each JSON diagnostic
|
|
69
|
+
of `gate/glue.py`'s `transpile_json` success and error envelopes gains the
|
|
70
|
+
keys `code` and `args` (see "Diagnostic codes"). No argument, result key or
|
|
71
|
+
envelope is removed or renamed: `transpile()` and `transpile_full()` keep
|
|
72
|
+
their signatures and result keys, the envelopes keep every key they had, and
|
|
73
|
+
each diagnostic keeps its `message`, `hint`, severity and location. One
|
|
74
|
+
result changes: the error raised for a script with errors in more than one
|
|
75
|
+
place (see "First error in source order").
|
|
76
|
+
- Report keys: the engine's Docker harness (`docker/run_json.py`, which the
|
|
77
|
+
`pineforge-release` image runs) is the same file in engine `v1.2.0` as in
|
|
78
|
+
`v1.1.0`, so no report key is added, removed or renamed;
|
|
79
|
+
`metrics.equity.sharpe_tv` and `sortino_tv` (`EQUITY_REPORT_KEYS`) are
|
|
80
|
+
unchanged, and the engine's ADR-0001 keeps serialized report keys as they
|
|
81
|
+
are. A report's fingerprint still differs between 1.1.0 and 1.2.0, since it
|
|
82
|
+
records the engine and codegen versions and the generated C++'s hash, and
|
|
83
|
+
the engine's Pine adapter changes since `v1.1.0` (such as
|
|
84
|
+
[pineforge-engine#330](https://github.com/pineforge-4pass/pineforge-engine/pull/330))
|
|
85
|
+
can change a run's trades.
|
|
86
|
+
- 1.2.0 is the first release under the PineForge Source License 1.1. Releases
|
|
87
|
+
up to and including 1.1.0 keep the license they shipped with (see
|
|
88
|
+
"License").
|
|
89
|
+
|
|
90
|
+
### Compiled execution capabilities
|
|
91
|
+
|
|
92
|
+
From [#167](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/167):
|
|
93
|
+
|
|
94
|
+
- Built against engine `v1.2.0`, a generated strategy library defines
|
|
95
|
+
`strategy_capabilities_api_version()`, which returns
|
|
96
|
+
`PF_CAPABILITIES_API_VERSION` (1), and `strategy_capabilities_receipt(s,
|
|
97
|
+
json, capacity, required, error, error_capacity)`, which writes the
|
|
98
|
+
strategy's capability receipt. It uses the statuses and the buffer protocol
|
|
99
|
+
of 1.1.0's `strategy_get_effective_settings`: called with a NULL buffer and
|
|
100
|
+
0, it returns `PF_SETTINGS_BUFFER_TOO_SMALL` and the size to allocate, the
|
|
101
|
+
NUL included; a short buffer gets an empty string, never partial JSON; a
|
|
102
|
+
NULL strategy returns `PF_SETTINGS_INVALID_ARGUMENT`; no exception gets
|
|
103
|
+
through. The base C ABI does not change.
|
|
104
|
+
- The receipt is canonical JSON (sorted keys, compact separators) written
|
|
105
|
+
into the C++ when it is generated, not read from a running strategy: every
|
|
106
|
+
handle returns the same bytes, before and after runs and setting changes.
|
|
107
|
+
Version 1 has the keys `version`, `declarations`, `requests`,
|
|
108
|
+
`requirements` and `unresolved`. `declarations` holds the `strategy()`
|
|
109
|
+
values of `calc_on_every_tick`, `calc_on_order_fills`,
|
|
110
|
+
`calc_on_every_history_tick`, `process_orders_on_close`,
|
|
111
|
+
`use_bar_magnifier`, `fill_orders_on_standard_ohlc`,
|
|
112
|
+
`backtest_fill_limits_assumption`, `currency`, `timeframe`,
|
|
113
|
+
`timeframe_gaps` and `dynamic_requests`, Pine's defaults where omitted;
|
|
114
|
+
positional arguments are read in Pine's parameter order. `requests` lists
|
|
115
|
+
each `request.security` and `request.security_lower_tf` site, recorded
|
|
116
|
+
request and request lowered to a run-time stop, with its function, symbol,
|
|
117
|
+
timeframe, lookahead, gaps, Heikin-Ashi flag and feed (`chart`,
|
|
118
|
+
`auxiliary`, `recorded` or `unpinned`). `requirements` says whether the
|
|
119
|
+
script needs other symbols' feeds, an FX curve (a `currency` other than
|
|
120
|
+
`currency.NONE`), recorded series or intrabar persistence (`varip`).
|
|
121
|
+
`unresolved` names what the receipt cannot state as a literal (a nonliteral
|
|
122
|
+
`strategy()` argument, a request's nonliteral timeframe or lookahead, a
|
|
123
|
+
request lowered to a run-time stop) and every use of `barstate.isrealtime`,
|
|
124
|
+
`timenow`, `barstate.islast`, `barstate.islastconfirmedhistory`,
|
|
125
|
+
`last_bar_index` and `last_bar_time`, in plots, labels and tables too. The
|
|
126
|
+
receipt proves declarations only, not that a stream computes what a batch
|
|
127
|
+
run computes.
|
|
128
|
+
- A host reads the receipt before it runs a strategy, to tell whether its
|
|
129
|
+
execution mode can honour what the strategy declares. Engine `v1.2.0`'s
|
|
130
|
+
live runner, `pineforge-live`, reads it before it opens its ledger
|
|
131
|
+
([pineforge-engine#332](https://github.com/pineforge-4pass/pineforge-engine/pull/332))
|
|
132
|
+
and refuses, naming the requirement, intrabar calculation
|
|
133
|
+
(`calc_on_every_tick`, `calc_on_order_fills`, `calc_on_every_history_tick`),
|
|
134
|
+
`process_orders_on_close`, the bar magnifier, standard-OHLC fills, nonzero
|
|
135
|
+
limit-fill verification, a `currency` or a `timeframe` declared in
|
|
136
|
+
`strategy()`, every true requirement, every request whatever its
|
|
137
|
+
timeframe, and every name in `unresolved`. A library without the
|
|
138
|
+
extension, such as one generated by 1.1.0, gets a warning that its
|
|
139
|
+
eligibility cannot be proved, and runs, its requests included. A batch run
|
|
140
|
+
does not read the receipt, and its computation is unchanged. The engine's
|
|
141
|
+
`docs/strategy-capabilities.md` gives the schema and the runner's policy,
|
|
142
|
+
and the
|
|
143
|
+
[public contract](docs/PUBLIC_CONTRACT.md#optional-compiled-execution-capabilities)
|
|
144
|
+
the codegen side.
|
|
145
|
+
|
|
146
|
+
### Diagnostic codes
|
|
147
|
+
|
|
148
|
+
From [#166](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/166):
|
|
149
|
+
|
|
150
|
+
- Every diagnostic carries a stable `code` (`PF-E1203` for an error,
|
|
151
|
+
`PF-W0412` for a warning) and `args`, the named raw values (identifiers,
|
|
152
|
+
types, keywords, numbers) its English `message` and `hint` were built from:
|
|
153
|
+
in `transpile_full(...)["diagnostics"]`, in `CompileError.diagnostics` and
|
|
154
|
+
in the JSON diagnostics of the `transpile_json` envelopes. They are read off
|
|
155
|
+
the diagnostic's text when first asked for, after the transpile, so the
|
|
156
|
+
emitted C++ does not depend on them; `message` and `hint` keep their text.
|
|
157
|
+
- `diagnostics_catalog()` returns the catalog, and `render_diagnostic(code,
|
|
158
|
+
args)` the English `(message, hint)` a code renders, equal to the
|
|
159
|
+
diagnostic's byte for byte. The catalog (schema
|
|
160
|
+
`pineforge-diagnostics-catalog/v1`, 628 codes) gives each code its
|
|
161
|
+
severity, area, ICU MessageFormat message and hint templates, argument
|
|
162
|
+
kinds and a one-line explanation, so an application can translate a
|
|
163
|
+
diagnostic by its code. It ships in the package as
|
|
164
|
+
`pineforge_codegen/diagnostics_catalog.json`, in
|
|
165
|
+
`@pineforge/codegen-pyodide` as the `./diagnostics_catalog.json` export,
|
|
166
|
+
and with the GitHub release as `diagnostics_catalog-v1.2.0.json`.
|
|
167
|
+
- A code is never removed or reused, and a changed meaning gets a new code
|
|
168
|
+
(`tests/fixtures/diagnostic_codes_pin.json`). See
|
|
169
|
+
[Diagnostic codes](docs/PUBLIC_CONTRACT.md#diagnostic-codes).
|
|
170
|
+
|
|
171
|
+
### First error in source order
|
|
172
|
+
|
|
173
|
+
- 1.1.0's settings metadata read every input's `defval`, `options`,
|
|
174
|
+
`minval`, `maxval` and `step` ahead of the script body, so an error there,
|
|
175
|
+
such as an unknown name in a later input's `minval`, was raised before an
|
|
176
|
+
error on an earlier line. 1.2.0 raises the script's first error in source
|
|
177
|
+
order again, as 1.0.1 did
|
|
178
|
+
([#166](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/166)).
|
|
179
|
+
The emitted C++ does not change.
|
|
180
|
+
|
|
181
|
+
### Security
|
|
182
|
+
|
|
183
|
+
- Classifying a diagnostic's code no longer stalls on crafted script text
|
|
184
|
+
([#171](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/171)).
|
|
185
|
+
As #166 merged it, the classifier matched each catalog template as a
|
|
186
|
+
backtracking regular expression over the message and hint, which carry text
|
|
187
|
+
the script spells: 1.8 KB of one template's text took 0.55 s to classify
|
|
188
|
+
and 3.4 KB took 23 s, a denial of service for `transpile_json`, which
|
|
189
|
+
classifies every diagnostic it returns, and for any host that reads
|
|
190
|
+
`code` or `args`. Classification now takes time linear in the text: the
|
|
191
|
+
same text grown to 6.6 MB classifies in milliseconds, with the same codes
|
|
192
|
+
and arguments. No release had the stall: it was on `main` from #166 to
|
|
193
|
+
#171, and 1.1.0 has no diagnostic codes.
|
|
194
|
+
|
|
195
|
+
### License
|
|
196
|
+
|
|
197
|
+
From [#168](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/168)
|
|
198
|
+
and [#171](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/171):
|
|
199
|
+
|
|
200
|
+
- 1.2.0 is the first release under the PineForge Source License 1.1, whose
|
|
201
|
+
licensor is pineforge, LLC. Releases up to and including 1.1.0 shipped
|
|
202
|
+
under "PineForge Codegen — License", the PolyForm Noncommercial License
|
|
203
|
+
1.0.0 with PineForge's supplemental sections, and copies of those releases
|
|
204
|
+
keep that license. The PineForge Source License is not a PolyForm license.
|
|
205
|
+
`LICENSE` is the controlling text; `LEGAL.md` summarizes it and is not
|
|
206
|
+
legal advice.
|
|
207
|
+
- The permitted purposes, free of charge, are noncommercial purposes,
|
|
208
|
+
personal uses, use by the noncommercial organizations `LICENSE` lists for
|
|
209
|
+
their teaching, research and other operations, and Personal Trading: a
|
|
210
|
+
natural person's research, development and backtesting of strategies and
|
|
211
|
+
execution of trades for their own account with their own capital, as
|
|
212
|
+
`LICENSE` defines them. Investment Management (managing, advising on or
|
|
213
|
+
trading investment capital, researching, developing or backtesting
|
|
214
|
+
strategies for it, or operating the software for others who do, whoever
|
|
215
|
+
the capital belongs to and whether or not for a fee) is Commercial Use for
|
|
216
|
+
every individual and every organization, noncommercial organizations
|
|
217
|
+
included, unless it is Personal Trading. So is any other use that is not a
|
|
218
|
+
permitted purpose, such as use by, for or on behalf of a company, fund,
|
|
219
|
+
partnership or other organization. Commercial Use needs a commercial
|
|
220
|
+
license from pineforge, LLC (enterprise@pineforge.dev).
|
|
221
|
+
- Distributing copies is not Commercial Use, except that distributing the
|
|
222
|
+
software, changed or not, embedded in or bundled with a product or service
|
|
223
|
+
made available to others is Commercial Use unless it is a permitted
|
|
224
|
+
purpose. That exception is what 1.1 adds to the PineForge Source License
|
|
225
|
+
1.0, which #168 put on `main` and no release carried.
|
|
226
|
+
- `LICENSE` defines Output: the code the software generates, such as the
|
|
227
|
+
C++ it generates from PineScript, and any program or library built from
|
|
228
|
+
it; backtest results, charts, reports and trade signals are not Output.
|
|
229
|
+
- Packaging: the PyPI classifier is `License :: Other/Proprietary License`
|
|
230
|
+
(it was `License :: Free for non-commercial use`), and
|
|
231
|
+
`@pineforge/codegen-pyodide`'s `package.json` says
|
|
232
|
+
`"license": "SEE LICENSE IN LICENSE"` (it said
|
|
233
|
+
`PolyForm-Noncommercial-1.0.0`) and the package contains `LICENSE`.
|
|
234
|
+
|
|
235
|
+
### Documentation
|
|
236
|
+
|
|
237
|
+
- The README's scoreboard of `main` renders from the facts tokens of
|
|
238
|
+
`pineforge-release` at 03b8dcc
|
|
239
|
+
([#171](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/171)):
|
|
240
|
+
baseline `pineforge-parity-baseline-20261004-engine-6b77f061` (engine
|
|
241
|
+
6b77f061, this repository at 285ac035), 7,970 excellent and 19 strong of
|
|
242
|
+
7,989 graded probes, none below strong.
|
|
243
|
+
Release 1.2.0 is graded on registry baseline
|
|
244
|
+
`pineforge-parity-baseline-20261005-engine-52292db9`: 7,970 excellent and
|
|
245
|
+
19 strong of 7,989 graded probes, none below strong, with engine 52292db9
|
|
246
|
+
([pineforge-engine#339](https://github.com/pineforge-4pass/pineforge-engine/pull/339)'s
|
|
247
|
+
merge), which v1.2.0 equals in behaviour, and this repository at 48e7a13b,
|
|
248
|
+
whose emitted C++ is codegen 1.2.0's: the release's remaining changes are
|
|
249
|
+
documentation.
|
|
250
|
+
- `docs/PUBLIC_CONTRACT.md` describes the capability functions
|
|
251
|
+
([#167](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/167))
|
|
252
|
+
and diagnostic codes
|
|
253
|
+
([#166](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/166)).
|
|
254
|
+
The README's License section and `LEGAL.md` name the PineForge Source
|
|
255
|
+
License and pineforge, LLC and give enterprise@pineforge.dev for commercial
|
|
256
|
+
licenses, and `CONTRIBUTING.md` names pineforge, LLC as the party a
|
|
257
|
+
Contributor License Agreement grants rights to
|
|
258
|
+
([#168](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/168),
|
|
259
|
+
[#171](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/171)).
|
|
260
|
+
|
|
23
261
|
## 1.1.0 — 2026-10-04
|
|
24
262
|
|
|
25
263
|
A minor release: generated strategy libraries gain the checked settings
|
|
@@ -4,7 +4,7 @@ This is the source-available PineScript v6 to C++ translator. Read the
|
|
|
4
4
|
[license and contribution terms](LEGAL.md) before sending a material change.
|
|
5
5
|
Contributions use the Developer Certificate of Origin: add a `Signed-off-by`
|
|
6
6
|
line with `git commit -s`. Material contributions also require a Contributor
|
|
7
|
-
License Agreement so
|
|
7
|
+
License Agreement so pineforge, LLC can include them in its commercial licenses;
|
|
8
8
|
contact luis@4pass.com.tw before opening a material pull request.
|
|
9
9
|
|
|
10
10
|
## Local setup
|
|
@@ -47,12 +47,13 @@ before treating a run as complete.
|
|
|
47
47
|
|
|
48
48
|
## Engine pairing
|
|
49
49
|
|
|
50
|
-
Codegen `main` is developed and tested against engine `main`. Codegen 1.
|
|
51
|
-
pairs with engine `v1.
|
|
50
|
+
Codegen `main` is developed and tested against engine `main`. Codegen 1.2.0
|
|
51
|
+
pairs with engine `v1.2.0`, the pair the
|
|
52
52
|
[`pineforge-release`](https://github.com/pineforge-4pass/pineforge-release)
|
|
53
|
-
image `1.
|
|
54
|
-
`1.0
|
|
55
|
-
|
|
53
|
+
image `1.2.0` ships, codegen 1.1.0 with engine `v1.1.0`, the pair of the image
|
|
54
|
+
`1.1.0`, codegen 1.0.1 with engine `v1.0.1`, the pair of the image `1.0.1`,
|
|
55
|
+
and codegen 1.0.0 with engine `v1.0.0`, the pair of the image `1.0.0`. On the
|
|
56
|
+
0.x line the two version lineages are independent:
|
|
56
57
|
the last 0.x release, codegen 0.10.4, pairs with engine `v0.13.1`, the pair
|
|
57
58
|
the `pineforge-release` image `0.1.25` ships.
|
|
58
59
|
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Legal information
|
|
2
|
+
|
|
3
|
+
Summary of licensing, third-party components, and trademarks for `pineforge-codegen`. **Not** legal advice; consult counsel for your use case.
|
|
4
|
+
|
|
5
|
+
## License
|
|
6
|
+
|
|
7
|
+
`pineforge-codegen` is **source-available**, **not** OSI "open source." It is distributed under the **PineForge Source License 1.1** — see [LICENSE](LICENSE), which is the controlling text.
|
|
8
|
+
|
|
9
|
+
- **Noncommercial use** — any noncommercial purpose, and use by a charitable organization, educational institution, public research organization, public safety or health organization, environmental protection organization or government institution for its teaching, research and other operations, is free.
|
|
10
|
+
- **Personal Trading** — free for a natural person to research, develop or backtest strategies and trade their **own** account with their **own** capital. Household, joint and retirement accounts and ordinary margin count as their own; a company's or fund's account does not, even a company they wholly own.
|
|
11
|
+
- **Investment management** — managing, advising on or trading investment capital, or researching strategies for it (a friend's, clients' or investors' capital, an endowment, a pension fund, a public fund, a foundation's treasury), is **Commercial Use for every individual and every organization**, noncommercial organizations included, except Personal Trading.
|
|
12
|
+
- **Commercial Use** — investment management and any other use that is not free, such as use by or for a company or fund, embedding the software or its output in a product or service for others, or operating a hosted/public-facing service with it, requires a **commercial license** (email **enterprise@pineforge.dev**; the commercial-license store is coming soon).
|
|
13
|
+
|
|
14
|
+
Describe this project as **"source-available"** rather than "open source." The runtime it targets, [`pineforge-engine`](https://github.com/pineforge-4pass/pineforge-engine), is separate and **Apache-2.0**.
|
|
15
|
+
|
|
16
|
+
Releases up to and including 1.1.0 were published under the license text that came with them (the PolyForm Noncommercial License 1.0.0 with a PineForge supplement); copies of those releases keep that license. The PineForge Source License 1.0 is a separate license and is not a PolyForm license.
|
|
17
|
+
|
|
18
|
+
The PineForge Source License 1.1 replaces 1.0 for the code on `main` and in future releases; it clarifies one point, that distributing the software or its output, changed or not, embedded in or bundled with a product or service made available to others is Commercial Use, not free distribution, unless it is for a permitted purpose.
|
|
19
|
+
|
|
20
|
+
## Copyright and licensor
|
|
21
|
+
|
|
22
|
+
The licensor is **pineforge, LLC**, a Delaware limited liability company. It holds the copyright in `pineforge-codegen`; the founder's rights in the software are assigned to it. Commercial licenses are granted by pineforge, LLC.
|
|
23
|
+
|
|
24
|
+
## What this repository is
|
|
25
|
+
|
|
26
|
+
A pure-Python PineScript v6 → C++ transpiler that emits source against the public PineForge engine C-ABI. It implements PineScript v6 from **TradingView's publicly published language documentation**; it does **not** incorporate TradingView proprietary source. Names like "PineScript v6" are used **nominatively** to describe the input language.
|
|
27
|
+
|
|
28
|
+
## Third-party components
|
|
29
|
+
|
|
30
|
+
The transpiler has **no runtime dependencies** (`transpile()` and `transpile_full()` are its supported Python entry points). Development/test extras declared in `pyproject.toml` (`pytest`, etc.) are under their own upstream licenses. The opt-in compile checks invoke a C++ compiler against the separately-licensed Apache-2.0 engine headers; they skip cleanly without an engine checkout.
|
|
31
|
+
|
|
32
|
+
## Trademarks and affiliation
|
|
33
|
+
|
|
34
|
+
**TradingView** and **PineScript** are trademarks of their respective owners. `pineforge-codegen` is **not** affiliated with, endorsed by, or certified by TradingView. References to "PineScript v6" and any compatibility/parity statements are **nominative** and factual — compatibility and technical testing only, not a partnership or certification.
|
|
35
|
+
|
|
36
|
+
## Contributions
|
|
37
|
+
|
|
38
|
+
Contributions are accepted under a Developer Certificate of Origin (`Signed-off-by`). Because this project is **dual-licensed** (source-available + a sold commercial license), material contributions require a Contributor License Agreement granting pineforge, LLC the right to include the contribution in its commercial licenses; otherwise it cannot be accepted. See [CONTRIBUTING.md](CONTRIBUTING.md) (or contact luis@4pass.com.tw) before opening a material PR.
|
|
39
|
+
|
|
40
|
+
## No warranty
|
|
41
|
+
|
|
42
|
+
Provided **"AS IS"**, without warranty of any kind, per the LICENSE's no-warranty / no-liability terms. Transpiler output and any downstream backtest results are **not** investment advice and carry no warranty of trading outcomes.
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
PineForge Source License 1.1
|
|
2
|
+
============================
|
|
3
|
+
|
|
4
|
+
Copyright 2025-2026 pineforge, LLC
|
|
5
|
+
|
|
6
|
+
Required Notice: Copyright 2025-2026 pineforge, LLC (https://github.com/pineforge-4pass/pineforge-codegen-oss)
|
|
7
|
+
|
|
8
|
+
The software is free of charge for the permitted purposes below, including
|
|
9
|
+
Personal Trading. Commercial Use, defined below, needs a separate commercial
|
|
10
|
+
license from the licensor.
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
## Acceptance
|
|
14
|
+
|
|
15
|
+
In order to get any license under these terms, you must agree to them as both
|
|
16
|
+
strict obligations and conditions to all your licenses.
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
## Copyright License
|
|
20
|
+
|
|
21
|
+
The licensor grants you a copyright license for the software to do everything
|
|
22
|
+
you might do with the software that would otherwise infringe the licensor's
|
|
23
|
+
copyright in it for any permitted purpose. However, you may only distribute
|
|
24
|
+
the software according to the Distribution License section, and make changes
|
|
25
|
+
or new works based on the software according to the Changes and New Works
|
|
26
|
+
License section.
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
## Distribution License
|
|
30
|
+
|
|
31
|
+
The licensor grants you an additional copyright license to distribute copies
|
|
32
|
+
of the software. Your license to distribute covers distributing the software
|
|
33
|
+
with changes and new works permitted by the Changes and New Works License
|
|
34
|
+
section. Unless it is a permitted purpose, distributing the software, changed
|
|
35
|
+
or not, embedded in or bundled with a product or service made available to
|
|
36
|
+
others is Commercial Use under (3) of the Commercial Use section, which your
|
|
37
|
+
license to distribute does not cover. Distributing copies under this section
|
|
38
|
+
is not Commercial Use, and it gives the people who get them no license beyond
|
|
39
|
+
these terms.
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
## Notices
|
|
43
|
+
|
|
44
|
+
You must ensure that anyone who gets a copy of any part of the software from
|
|
45
|
+
you also gets a copy of these terms or a link to them, as well as copies of
|
|
46
|
+
any plain-text lines beginning with `Required Notice:` that the licensor
|
|
47
|
+
provided with the software. For example:
|
|
48
|
+
|
|
49
|
+
> Required Notice: Copyright Yoyodyne, Inc. (http://example.com)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
## Changes and New Works License
|
|
53
|
+
|
|
54
|
+
The licensor grants you an additional copyright license to make changes and
|
|
55
|
+
new works based on the software for any permitted purpose.
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
## Patent License
|
|
59
|
+
|
|
60
|
+
The licensor grants you a patent license for the software that covers patent
|
|
61
|
+
claims the licensor can license, or becomes able to license, that you would
|
|
62
|
+
infringe by using the software for a permitted purpose.
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
## Permitted Purposes
|
|
66
|
+
|
|
67
|
+
Each of the following is a permitted purpose:
|
|
68
|
+
|
|
69
|
+
- **Noncommercial purposes.** Any noncommercial purpose.
|
|
70
|
+
|
|
71
|
+
- **Personal uses.** Personal use for research, experiment, and testing for
|
|
72
|
+
the benefit of public knowledge, personal study, private entertainment,
|
|
73
|
+
hobby projects, amateur pursuits, or religious observance, without any
|
|
74
|
+
anticipated commercial application.
|
|
75
|
+
|
|
76
|
+
- **Noncommercial organizations.** Use by any charitable organization,
|
|
77
|
+
educational institution, public research organization, public safety or
|
|
78
|
+
health organization, environmental protection organization, or government
|
|
79
|
+
institution for its teaching, research and other operations, regardless of
|
|
80
|
+
the source of funding or obligations resulting from the funding.
|
|
81
|
+
|
|
82
|
+
- **Personal Trading**, as defined in the next section.
|
|
83
|
+
|
|
84
|
+
Investment Management, defined in the Commercial Use section, is never a
|
|
85
|
+
permitted purpose, except as Personal Trading. That is so even when it is done
|
|
86
|
+
by a noncommercial organization or for a noncommercial purpose.
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
## Personal Trading
|
|
90
|
+
|
|
91
|
+
**Personal Trading** means use of the software by a natural person to do any
|
|
92
|
+
of the following, solely for trades that meet conditions (a) and (b) below:
|
|
93
|
+
research, develop or backtest trading strategies, or execute trades in
|
|
94
|
+
securities, derivatives, currencies, crypto-assets, commodities or other
|
|
95
|
+
financial instruments.
|
|
96
|
+
|
|
97
|
+
(a) The trades are, or will be, placed for that person's own account.
|
|
98
|
+
|
|
99
|
+
(b) The trades are, or will be, funded solely by that person's own
|
|
100
|
+
capital.
|
|
101
|
+
|
|
102
|
+
For Personal Trading:
|
|
103
|
+
|
|
104
|
+
- A person's **household** is that person, their spouse or domestic
|
|
105
|
+
partner, and their dependants.
|
|
106
|
+
|
|
107
|
+
- A person's **own account** includes an account held by the person alone
|
|
108
|
+
or jointly with members of their household; an account of a member of
|
|
109
|
+
their household; and a retirement, pension, education-savings or other
|
|
110
|
+
tax-advantaged account, or an account of a revocable trust, held for the
|
|
111
|
+
benefit of the person or members of their household.
|
|
112
|
+
|
|
113
|
+
- A person's **own capital** includes capital belonging to members of
|
|
114
|
+
their household, and capital borrowed in the ordinary course from a
|
|
115
|
+
broker, bank or other lender, such as margin, leverage or credit on a
|
|
116
|
+
trading account, for which the person or their household is liable.
|
|
117
|
+
Money the person has received outright, such as pay, a gift or an
|
|
118
|
+
inheritance, is the person's own capital.
|
|
119
|
+
|
|
120
|
+
- Trading in the person's own name, for their own account and with their
|
|
121
|
+
own capital, is Personal Trading even when it is the person's business
|
|
122
|
+
or livelihood.
|
|
123
|
+
|
|
124
|
+
- Publishing or teaching about the person's own Personal Trading,
|
|
125
|
+
including its results, is part of Personal Trading even when the person
|
|
126
|
+
is paid for it, as long as they do not give Output to others.
|
|
127
|
+
|
|
128
|
+
- An account of a company, partnership, fund, trust or other
|
|
129
|
+
organization, other than an account described under own account above,
|
|
130
|
+
is not the person's own account, even if the person wholly owns or
|
|
131
|
+
controls it.
|
|
132
|
+
|
|
133
|
+
- Capital that an employer, a proprietary-trading firm, a funded-trader
|
|
134
|
+
program or anyone else outside the person's household provides or
|
|
135
|
+
allocates to the person to trade, and that the provider still owns or
|
|
136
|
+
whose losses the provider bears, is not the person's own capital, even
|
|
137
|
+
if the person shares in the profits.
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
## Commercial Use
|
|
141
|
+
|
|
142
|
+
**Investment Management** means using the software to manage, advise on, or
|
|
143
|
+
trade investment capital; to research, develop or backtest strategies for
|
|
144
|
+
investment capital that you, or anyone you do the work for, manage, advise on
|
|
145
|
+
or trade; or to operate the software for others who do any of these things;
|
|
146
|
+
in each case whoever the capital belongs to and whether or not for a fee.
|
|
147
|
+
|
|
148
|
+
**Investment capital** means any money or other assets held for investment or
|
|
149
|
+
trading, including capital belonging to any other person or entity, such as a
|
|
150
|
+
friend or relative, clients or investors, an endowment, a pension or
|
|
151
|
+
retirement fund, a sovereign or other public fund, or the treasury or reserves
|
|
152
|
+
of a foundation or other organization.
|
|
153
|
+
|
|
154
|
+
**Commercial Use** means any use of the software that is not a permitted
|
|
155
|
+
purpose, other than distributing copies under the Distribution License
|
|
156
|
+
section. Investment Management is Commercial Use for every individual and
|
|
157
|
+
every organization, including the noncommercial organizations listed under
|
|
158
|
+
Permitted Purposes, whatever its purpose, unless it is Personal Trading.
|
|
159
|
+
Unless it is a permitted purpose, each of the following is also Commercial
|
|
160
|
+
Use:
|
|
161
|
+
|
|
162
|
+
(1) managing, advising on, or trading capital belonging to any other person
|
|
163
|
+
or entity, whether or not for a fee;
|
|
164
|
+
|
|
165
|
+
(2) use by, for, or on behalf of any company, fund, partnership, or other
|
|
166
|
+
organization, including use by an individual in the course of work for
|
|
167
|
+
such an organization;
|
|
168
|
+
|
|
169
|
+
(3) embedding the software or its Output, changed or not, into any product
|
|
170
|
+
or service made available to others, or distributing either bundled
|
|
171
|
+
with such a product or service, including using the software to
|
|
172
|
+
generate Output for such a product or service; and
|
|
173
|
+
|
|
174
|
+
(4) operating any hosted, software-as-a-service, or otherwise public-facing
|
|
175
|
+
service through which others can run the software or receive its
|
|
176
|
+
Output.
|
|
177
|
+
|
|
178
|
+
Commercial Use requires a separate commercial license from the licensor. To
|
|
179
|
+
obtain one, contact: enterprise@pineforge.dev
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
## Output
|
|
183
|
+
|
|
184
|
+
**Output** means code that the software generates, such as the C++ source
|
|
185
|
+
code it generates from PineScript, and any program or library built from that
|
|
186
|
+
code. Backtest results, charts, reports and trade signals are not Output.
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
## Fair Use
|
|
190
|
+
|
|
191
|
+
You may have "fair use" rights for the software under the law. These terms do
|
|
192
|
+
not limit them.
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
## No Other Rights
|
|
196
|
+
|
|
197
|
+
These terms do not allow you to sublicense or transfer any of your licenses
|
|
198
|
+
to anyone else, or prevent the licensor from granting licenses to anyone
|
|
199
|
+
else. These terms do not imply any other licenses.
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
## Patent Defense
|
|
203
|
+
|
|
204
|
+
If you make any written claim that the software infringes or contributes to
|
|
205
|
+
infringement of any patent, your patent license for the software granted
|
|
206
|
+
under these terms ends immediately. If your company makes such a claim, your
|
|
207
|
+
patent license ends immediately for work on behalf of your company.
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
## Violations
|
|
211
|
+
|
|
212
|
+
The first time you are notified in writing that you have violated any of
|
|
213
|
+
these terms, or done anything with the software not covered by your licenses,
|
|
214
|
+
your licenses can nonetheless continue if you come into full compliance with
|
|
215
|
+
these terms, and take practical steps to correct past violations, within 32
|
|
216
|
+
days of receiving notice. Otherwise, all your licenses end immediately.
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
## No Liability
|
|
220
|
+
|
|
221
|
+
***As far as the law allows, the software comes as is, without any warranty
|
|
222
|
+
or condition, and the licensor will not be liable to you for any damages
|
|
223
|
+
arising out of these terms or the use or nature of the software, under any
|
|
224
|
+
kind of legal claim.***
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
## Definitions
|
|
228
|
+
|
|
229
|
+
The **licensor** is pineforge, LLC, and the **software** is the software the
|
|
230
|
+
licensor makes available under these terms.
|
|
231
|
+
|
|
232
|
+
**You** refers to the individual or entity agreeing to these terms.
|
|
233
|
+
|
|
234
|
+
**Your company** is any legal entity, sole proprietorship, or other kind of
|
|
235
|
+
organization that you work for, plus all organizations that have control
|
|
236
|
+
over, are under the control of, or are under common control with that
|
|
237
|
+
organization. **Control** means ownership of substantially all the assets of
|
|
238
|
+
an entity, or the power to direct its management and policies by vote,
|
|
239
|
+
contract, or otherwise. Control can be direct or indirect.
|
|
240
|
+
|
|
241
|
+
**Your licenses** are all the licenses granted to you for the software under
|
|
242
|
+
these terms.
|
|
243
|
+
|
|
244
|
+
**Use** means anything you do with the software requiring one of your
|
|
245
|
+
licenses.
|