fpml-convert (Python)
Standard-library-only conversion between FpML interest-rate-swap XML and
plain JSON, in both directions. No lxml, no third-party JSON — just
xml.etree.ElementTree and json.
One projection mapping, also implemented as a JavaScript interpreter (for the Structile viewer) and a pure-STL C++17 converter; the three agree byte-for-byte on a shared test corpus. Downloads, the full version archive, and the mapping's precise rules: https://danieltuzes.github.io/fpml-convert/.
Install
pip install fpml-convert
No runtime dependencies. Python 3.8+.
Use
from fpml_convert import fpml_to_json, json_to_fpml
value = fpml_to_json(xml_text) # -> dict
xml_text2 = json_to_fpml(value) # -> schema-ordered FpML, round-trips at the value level
# CLI (direction inferred from the input, or forced with --to)
python -m fpml_convert swap.xml -o swap.json
python -m fpml_convert swap.json -o swap.xml
cat swap.xml | python -m fpml_convert - > swap.json
The mapping
- Element local name → object key; a tag repeated under one parent → an array in document order.
- Namespace prefixes and ElementTree Clark notation (
{uri}local) are both reduced to the local name, so the result is identical across a browserDOMParserand a server-side parser. - Attributes →
@-prefixed keys, before any child keys, ordered@id,@xsi:type,@href, then the rest.xsi:typeis kept verbatim. - A pure reference element (
href, no children) → the scalar«id»; Structile renders that as a link to the element whose@idmatches. - Typed lexical forms are preserved as strings, never coerced
(
1000000.00stays exactly that). - Every element the projection descends into is checked against a
supported-subset allowlist — an unknown element raises
FpmlUnsupportedErrorrather than projecting partially. - Serialization re-emits children in schema (
xs:sequence) order.
Scope
FpML 5.10 confirmation view, interest-rate swap dataDocument only. A
non-IR-swap document raises ValueError. FRA and other products widen the
allowlist in later releases. An FpML-AWG interchange-shape mode is planned.
License
Apache-2.0. The FpML example files used for testing are redistributed under the FpML Public License.
Metadata
Release files for fpml-convert 0.6.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| fpml_convert-0.6.3.tar.gz | 11.5 kB | Without provenance | Details for fpml_convert-0.6.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| fpml_convert-0.6.3-py3-none-any.whl | Python 3 | none | any | Details for fpml_convert-0.6.3-py3-none-any.whl |
Total release size: 23.6 kB
Release files / fpml_convert-0.6.3.tar.gz
| Download URL | fpml_convert-0.6.3.tar.gz |
|---|---|
| Size | 11.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
865bb7c74877f996cb3c98cf282dbcc17be73395ef9126fb5fd97ca51bdeb2a2
|
|
BLAKE2b-256 checksum How to use checksums |
c6897f5828590750e8c18c5a695bb4bde6d0a7c390c4d2c4de8ad18b32ee8460
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.13
|
Release files / fpml_convert-0.6.3-py3-none-any.whl
| Download URL | fpml_convert-0.6.3-py3-none-any.whl |
|---|---|
| Size | 12.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a43027fb20528d04a31d78d5d795084c3cd8ae1ec591383a23813fb1ea38b33b
|
|
BLAKE2b-256 checksum How to use checksums |
623c4c7f246edfaaf2dde6978d5129c0890a8dbfffd5ed936d9d98d74e54d1c2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.13
|
Security for fpml-convert 0.6.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.