morphiq-sdk 0.2.0__tar.gz → 0.2.1__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.
- {morphiq_sdk-0.2.0 → morphiq_sdk-0.2.1}/PKG-INFO +16 -15
- {morphiq_sdk-0.2.0 → morphiq_sdk-0.2.1}/README.md +15 -14
- {morphiq_sdk-0.2.0 → morphiq_sdk-0.2.1}/examples/analytics.py +3 -3
- {morphiq_sdk-0.2.0 → morphiq_sdk-0.2.1}/examples/analytics_async.py +3 -3
- {morphiq_sdk-0.2.0 → morphiq_sdk-0.2.1}/examples/batch_price.py +3 -3
- {morphiq_sdk-0.2.0 → morphiq_sdk-0.2.1}/examples/batch_price_async.py +3 -3
- {morphiq_sdk-0.2.0 → morphiq_sdk-0.2.1}/examples/chunked_price.py +3 -3
- {morphiq_sdk-0.2.0 → morphiq_sdk-0.2.1}/examples/chunked_price_async.py +3 -3
- {morphiq_sdk-0.2.0 → morphiq_sdk-0.2.1}/examples/cost_quote.py +5 -5
- {morphiq_sdk-0.2.0 → morphiq_sdk-0.2.1}/examples/greeks.py +2 -2
- {morphiq_sdk-0.2.0 → morphiq_sdk-0.2.1}/examples/greeks_async.py +2 -2
- {morphiq_sdk-0.2.0 → morphiq_sdk-0.2.1}/examples/greeks_standard.py +2 -2
- {morphiq_sdk-0.2.0 → morphiq_sdk-0.2.1}/examples/identify_regime.py +18 -2
- {morphiq_sdk-0.2.0 → morphiq_sdk-0.2.1}/examples/identify_regime_async.py +18 -2
- {morphiq_sdk-0.2.0 → morphiq_sdk-0.2.1}/examples/implied_volatility.py +2 -2
- {morphiq_sdk-0.2.0 → morphiq_sdk-0.2.1}/examples/implied_volatility_async.py +2 -2
- {morphiq_sdk-0.2.0 → morphiq_sdk-0.2.1}/examples/price_american.py +2 -2
- {morphiq_sdk-0.2.0 → morphiq_sdk-0.2.1}/examples/price_async.py +2 -2
- {morphiq_sdk-0.2.0 → morphiq_sdk-0.2.1}/examples/price_european.py +2 -2
- {morphiq_sdk-0.2.0 → morphiq_sdk-0.2.1}/examples/quickstart.py +2 -2
- {morphiq_sdk-0.2.0 → morphiq_sdk-0.2.1}/examples/tabular_price.py +3 -3
- {morphiq_sdk-0.2.0 → morphiq_sdk-0.2.1}/notebooks/cost/quotation.ipynb +6 -6
- {morphiq_sdk-0.2.0 → morphiq_sdk-0.2.1}/notebooks/pricing/options.ipynb +16 -16
- {morphiq_sdk-0.2.0 → morphiq_sdk-0.2.1}/notebooks/pricing/standard-five.ipynb +1 -1
- {morphiq_sdk-0.2.0 → morphiq_sdk-0.2.1}/notebooks/regime/identification.ipynb +29 -2
- {morphiq_sdk-0.2.0 → morphiq_sdk-0.2.1}/pyproject.toml +1 -1
- {morphiq_sdk-0.2.0 → morphiq_sdk-0.2.1}/src/morphiq_sdk/models.py +149 -7
- {morphiq_sdk-0.2.0 → morphiq_sdk-0.2.1}/src/morphiq_sdk/pandas.py +20 -10
- {morphiq_sdk-0.2.0 → morphiq_sdk-0.2.1}/src/morphiq_sdk/workflows.py +22 -7
- {morphiq_sdk-0.2.0 → morphiq_sdk-0.2.1}/.gitignore +0 -0
- {morphiq_sdk-0.2.0 → morphiq_sdk-0.2.1}/LICENSE +0 -0
- {morphiq_sdk-0.2.0 → morphiq_sdk-0.2.1}/examples/README.md +0 -0
- {morphiq_sdk-0.2.0 → morphiq_sdk-0.2.1}/examples/__init__.py +0 -0
- {morphiq_sdk-0.2.0 → morphiq_sdk-0.2.1}/examples/pricing_models.py +0 -0
- {morphiq_sdk-0.2.0 → morphiq_sdk-0.2.1}/examples/provider_regime.py +0 -0
- {morphiq_sdk-0.2.0 → morphiq_sdk-0.2.1}/notebooks/README.md +0 -0
- {morphiq_sdk-0.2.0 → morphiq_sdk-0.2.1}/notebooks/pricing/models.ipynb +0 -0
- {morphiq_sdk-0.2.0 → morphiq_sdk-0.2.1}/notebooks/start-here.ipynb +0 -0
- {morphiq_sdk-0.2.0 → morphiq_sdk-0.2.1}/src/morphiq_sdk/__init__.py +0 -0
- {morphiq_sdk-0.2.0 → morphiq_sdk-0.2.1}/src/morphiq_sdk/client.py +0 -0
- {morphiq_sdk-0.2.0 → morphiq_sdk-0.2.1}/src/morphiq_sdk/errors.py +0 -0
- {morphiq_sdk-0.2.0 → morphiq_sdk-0.2.1}/src/morphiq_sdk/market_data.py +0 -0
- {morphiq_sdk-0.2.0 → morphiq_sdk-0.2.1}/src/morphiq_sdk/py.typed +0 -0
- {morphiq_sdk-0.2.0 → morphiq_sdk-0.2.1}/src/morphiq_sdk_yahoo/__init__.py +0 -0
- {morphiq_sdk-0.2.0 → morphiq_sdk-0.2.1}/src/morphiq_sdk_yahoo/py.typed +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: morphiq-sdk
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.1
|
|
4
4
|
Summary: Option pricing, Greeks, implied volatility and market regime identification through a Python API client
|
|
5
5
|
Project-URL: Homepage, https://developers.morphiqlabs.com
|
|
6
6
|
Project-URL: Documentation, https://github.com/MorphIQ-Labs/morphiq-sdk-python/blob/main/docs/README.md
|
|
@@ -47,9 +47,10 @@ valuation, sensitivity analysis and market-regime identification.
|
|
|
47
47
|
See the [documentation index](https://github.com/MorphIQ-Labs/morphiq-sdk-python/blob/main/docs/README.md) for all feature guides and the
|
|
48
48
|
[Python API reference](https://github.com/MorphIQ-Labs/morphiq-sdk-python/blob/main/docs/API.md) for methods, models and errors.
|
|
49
49
|
|
|
50
|
-
This client targets API **v0.
|
|
51
|
-
standard-five Greeks, cost utilities and spend caps
|
|
52
|
-
|
|
50
|
+
This client targets API **v0.7.0**, including public model discovery,
|
|
51
|
+
standard-five Greeks, cost utilities and spend caps, preferred CU fields, and
|
|
52
|
+
typed regime crisis/volatility results. SDK 0.2.0 covers the routes but predates
|
|
53
|
+
the typed CU and regime additions; install the release containing this update.
|
|
53
54
|
See [model capabilities and migration](https://github.com/MorphIQ-Labs/morphiq-sdk-python/blob/main/docs/MODELS.md): BSM/BS1993 support batches
|
|
54
55
|
up to 100; QdFp and cash-dividend finite difference support single price and IV.
|
|
55
56
|
|
|
@@ -113,21 +114,19 @@ and prints the JSON response. Example response from the recorded synthetic fixtu
|
|
|
113
114
|
```json
|
|
114
115
|
{
|
|
115
116
|
"metadata": {
|
|
116
|
-
"request_id": "fr-
|
|
117
|
+
"request_id": "fr-18e88a7b3977d162-0000000000000002",
|
|
117
118
|
"api_version": "v1",
|
|
118
|
-
"engine_version": "0.
|
|
119
|
+
"engine_version": "0.45.0",
|
|
119
120
|
"engines": [
|
|
120
121
|
{
|
|
121
122
|
"name": "morphiq-risk",
|
|
122
|
-
"version": "0.
|
|
123
|
-
"revision": "
|
|
123
|
+
"version": "0.45.0",
|
|
124
|
+
"revision": "a4df4da57ff2d53a1f1146f1c4310f0e980a497a"
|
|
124
125
|
}
|
|
125
|
-
]
|
|
126
|
-
"units_charged": 1,
|
|
127
|
-
"compute_schedule_version": "2026-09-11"
|
|
126
|
+
]
|
|
128
127
|
},
|
|
129
128
|
"result": {
|
|
130
|
-
"price": 10.
|
|
129
|
+
"price": 10.450583572185565,
|
|
131
130
|
"exercise_style": "european",
|
|
132
131
|
"option_type": "call",
|
|
133
132
|
"pricing_model": "black_scholes_merton",
|
|
@@ -138,7 +137,7 @@ and prints the JSON response. Example response from the recorded synthetic fixtu
|
|
|
138
137
|
|
|
139
138
|
Your request ID and engine metadata will reflect the live service. This fixture
|
|
140
139
|
was recorded in open development mode; authenticated responses may also report
|
|
141
|
-
commercial charges in `metadata.
|
|
140
|
+
commercial charges in `metadata.cu_charged`. Keep the request ID for support.
|
|
142
141
|
See [the quickstart guide](https://github.com/MorphIQ-Labs/morphiq-sdk-python/blob/main/docs/QUICKSTART.md)
|
|
143
142
|
for input units, async usage, configuration and errors.
|
|
144
143
|
|
|
@@ -224,8 +223,10 @@ no real credentials; native API integration is opt-in. See
|
|
|
224
223
|
[CONTRIBUTING.md](https://github.com/MorphIQ-Labs/morphiq-sdk-python/blob/main/CONTRIBUTING.md) and [RELEASE.md](https://github.com/MorphIQ-Labs/morphiq-sdk-python/blob/main/RELEASE.md).
|
|
225
224
|
|
|
226
225
|
Clients make no automatic retries and do not follow redirects. A timeout
|
|
227
|
-
may leave work charged. Only `
|
|
228
|
-
Missing `
|
|
226
|
+
may leave work charged. Only `cu_quoted` and `cu_charged` report commercial CUs.
|
|
227
|
+
Missing `cu_charged` means unreported, not zero. The `fcu_*` names are deprecated
|
|
228
|
+
aliases with equal values; the SDK fills each name from the other, so older servers
|
|
229
|
+
that send only `fcu_*` still work. Explicit nulls remain unreported. The retired `units_charged` and
|
|
229
230
|
`compute_schedule_version` fields are optional; they remain accepted from older
|
|
230
231
|
deployments and are never used to calculate a charge.
|
|
231
232
|
|
|
@@ -11,9 +11,10 @@ valuation, sensitivity analysis and market-regime identification.
|
|
|
11
11
|
See the [documentation index](https://github.com/MorphIQ-Labs/morphiq-sdk-python/blob/main/docs/README.md) for all feature guides and the
|
|
12
12
|
[Python API reference](https://github.com/MorphIQ-Labs/morphiq-sdk-python/blob/main/docs/API.md) for methods, models and errors.
|
|
13
13
|
|
|
14
|
-
This client targets API **v0.
|
|
15
|
-
standard-five Greeks, cost utilities and spend caps
|
|
16
|
-
|
|
14
|
+
This client targets API **v0.7.0**, including public model discovery,
|
|
15
|
+
standard-five Greeks, cost utilities and spend caps, preferred CU fields, and
|
|
16
|
+
typed regime crisis/volatility results. SDK 0.2.0 covers the routes but predates
|
|
17
|
+
the typed CU and regime additions; install the release containing this update.
|
|
17
18
|
See [model capabilities and migration](https://github.com/MorphIQ-Labs/morphiq-sdk-python/blob/main/docs/MODELS.md): BSM/BS1993 support batches
|
|
18
19
|
up to 100; QdFp and cash-dividend finite difference support single price and IV.
|
|
19
20
|
|
|
@@ -77,21 +78,19 @@ and prints the JSON response. Example response from the recorded synthetic fixtu
|
|
|
77
78
|
```json
|
|
78
79
|
{
|
|
79
80
|
"metadata": {
|
|
80
|
-
"request_id": "fr-
|
|
81
|
+
"request_id": "fr-18e88a7b3977d162-0000000000000002",
|
|
81
82
|
"api_version": "v1",
|
|
82
|
-
"engine_version": "0.
|
|
83
|
+
"engine_version": "0.45.0",
|
|
83
84
|
"engines": [
|
|
84
85
|
{
|
|
85
86
|
"name": "morphiq-risk",
|
|
86
|
-
"version": "0.
|
|
87
|
-
"revision": "
|
|
87
|
+
"version": "0.45.0",
|
|
88
|
+
"revision": "a4df4da57ff2d53a1f1146f1c4310f0e980a497a"
|
|
88
89
|
}
|
|
89
|
-
]
|
|
90
|
-
"units_charged": 1,
|
|
91
|
-
"compute_schedule_version": "2026-09-11"
|
|
90
|
+
]
|
|
92
91
|
},
|
|
93
92
|
"result": {
|
|
94
|
-
"price": 10.
|
|
93
|
+
"price": 10.450583572185565,
|
|
95
94
|
"exercise_style": "european",
|
|
96
95
|
"option_type": "call",
|
|
97
96
|
"pricing_model": "black_scholes_merton",
|
|
@@ -102,7 +101,7 @@ and prints the JSON response. Example response from the recorded synthetic fixtu
|
|
|
102
101
|
|
|
103
102
|
Your request ID and engine metadata will reflect the live service. This fixture
|
|
104
103
|
was recorded in open development mode; authenticated responses may also report
|
|
105
|
-
commercial charges in `metadata.
|
|
104
|
+
commercial charges in `metadata.cu_charged`. Keep the request ID for support.
|
|
106
105
|
See [the quickstart guide](https://github.com/MorphIQ-Labs/morphiq-sdk-python/blob/main/docs/QUICKSTART.md)
|
|
107
106
|
for input units, async usage, configuration and errors.
|
|
108
107
|
|
|
@@ -188,8 +187,10 @@ no real credentials; native API integration is opt-in. See
|
|
|
188
187
|
[CONTRIBUTING.md](https://github.com/MorphIQ-Labs/morphiq-sdk-python/blob/main/CONTRIBUTING.md) and [RELEASE.md](https://github.com/MorphIQ-Labs/morphiq-sdk-python/blob/main/RELEASE.md).
|
|
189
188
|
|
|
190
189
|
Clients make no automatic retries and do not follow redirects. A timeout
|
|
191
|
-
may leave work charged. Only `
|
|
192
|
-
Missing `
|
|
190
|
+
may leave work charged. Only `cu_quoted` and `cu_charged` report commercial CUs.
|
|
191
|
+
Missing `cu_charged` means unreported, not zero. The `fcu_*` names are deprecated
|
|
192
|
+
aliases with equal values; the SDK fills each name from the other, so older servers
|
|
193
|
+
that send only `fcu_*` still work. Explicit nulls remain unreported. The retired `units_charged` and
|
|
193
194
|
`compute_schedule_version` fields are optional; they remain accepted from older
|
|
194
195
|
deployments and are never used to calculate a charge.
|
|
195
196
|
|
|
@@ -35,7 +35,7 @@ def main() -> None:
|
|
|
35
35
|
except APIError as error:
|
|
36
36
|
print(f"HTTP {error.status_code}: {error.code}: {error.message}", file=sys.stderr)
|
|
37
37
|
print(f"Request ID: {error.request_id}", file=sys.stderr)
|
|
38
|
-
charged = error.metadata.
|
|
38
|
+
charged = error.metadata.cu_charged if error.metadata else None
|
|
39
39
|
print(
|
|
40
40
|
f"Commercial CU charged: {charged if charged is not None else 'not reported'}",
|
|
41
41
|
file=sys.stderr,
|
|
@@ -47,7 +47,7 @@ def main() -> None:
|
|
|
47
47
|
"No complete response; execution and charges may be unknown. No retry."
|
|
48
48
|
) from None
|
|
49
49
|
except ResponseError as error:
|
|
50
|
-
charged = error.metadata.
|
|
50
|
+
charged = error.metadata.cu_charged if error.metadata else None
|
|
51
51
|
print(
|
|
52
52
|
f"Commercial CU charged: {charged if charged is not None else 'not reported'}",
|
|
53
53
|
file=sys.stderr,
|
|
@@ -84,7 +84,7 @@ def main() -> None:
|
|
|
84
84
|
for engine in response.metadata.engines:
|
|
85
85
|
print(f"Engine: {engine.name} {engine.version} ({engine.revision})")
|
|
86
86
|
# Missing commercial CU is unreported, not zero.
|
|
87
|
-
charged = response.metadata.
|
|
87
|
+
charged = response.metadata.cu_charged
|
|
88
88
|
print("Commercial CU charged:", charged if charged is not None else "not reported")
|
|
89
89
|
|
|
90
90
|
|
|
@@ -42,7 +42,7 @@ async def main() -> None:
|
|
|
42
42
|
except APIError as error:
|
|
43
43
|
print(f"HTTP {error.status_code}: {error.code}: {error.message}", file=sys.stderr)
|
|
44
44
|
print(f"Request ID: {error.request_id}", file=sys.stderr)
|
|
45
|
-
charged = error.metadata.
|
|
45
|
+
charged = error.metadata.cu_charged if error.metadata else None
|
|
46
46
|
print(
|
|
47
47
|
f"Commercial CU charged: {charged if charged is not None else 'not reported'}",
|
|
48
48
|
file=sys.stderr,
|
|
@@ -54,7 +54,7 @@ async def main() -> None:
|
|
|
54
54
|
"No complete response; execution and charges may be unknown. No retry."
|
|
55
55
|
) from None
|
|
56
56
|
except ResponseError as error:
|
|
57
|
-
charged = error.metadata.
|
|
57
|
+
charged = error.metadata.cu_charged if error.metadata else None
|
|
58
58
|
print(
|
|
59
59
|
f"Commercial CU charged: {charged if charged is not None else 'not reported'}",
|
|
60
60
|
file=sys.stderr,
|
|
@@ -91,7 +91,7 @@ async def main() -> None:
|
|
|
91
91
|
for engine in response.metadata.engines:
|
|
92
92
|
print(f"Engine: {engine.name} {engine.version} ({engine.revision})")
|
|
93
93
|
# Missing commercial CU is unreported, not zero.
|
|
94
|
-
charged = response.metadata.
|
|
94
|
+
charged = response.metadata.cu_charged
|
|
95
95
|
print("Commercial CU charged:", charged if charged is not None else "not reported")
|
|
96
96
|
|
|
97
97
|
|
|
@@ -60,7 +60,7 @@ def main() -> None:
|
|
|
60
60
|
print("No automatic retry or batch splitting.", file=sys.stderr)
|
|
61
61
|
print(f"HTTP {error.status_code}: {error.code}: {error.message}", file=sys.stderr)
|
|
62
62
|
print(f"Request ID: {error.request_id}", file=sys.stderr)
|
|
63
|
-
charged = error.metadata.
|
|
63
|
+
charged = error.metadata.cu_charged if error.metadata else None
|
|
64
64
|
print(
|
|
65
65
|
f"Commercial CU charged: {charged if charged is not None else 'not reported'}",
|
|
66
66
|
file=sys.stderr,
|
|
@@ -72,7 +72,7 @@ def main() -> None:
|
|
|
72
72
|
"No complete response; execution and charges may be unknown. No retry."
|
|
73
73
|
) from None
|
|
74
74
|
except ResponseError as error:
|
|
75
|
-
charged = error.metadata.
|
|
75
|
+
charged = error.metadata.cu_charged if error.metadata else None
|
|
76
76
|
print(
|
|
77
77
|
f"Commercial CU charged: {charged if charged is not None else 'not reported'}",
|
|
78
78
|
file=sys.stderr,
|
|
@@ -94,7 +94,7 @@ def main() -> None:
|
|
|
94
94
|
for engine in response.metadata.engines:
|
|
95
95
|
print(f"Engine: {engine.name} {engine.version} ({engine.revision})")
|
|
96
96
|
# Missing commercial CU is unreported, not zero.
|
|
97
|
-
charged = response.metadata.
|
|
97
|
+
charged = response.metadata.cu_charged
|
|
98
98
|
print("Commercial CU charged:", charged if charged is not None else "not reported")
|
|
99
99
|
|
|
100
100
|
|
|
@@ -61,7 +61,7 @@ async def main() -> None:
|
|
|
61
61
|
print("No automatic retry or batch splitting.", file=sys.stderr)
|
|
62
62
|
print(f"HTTP {error.status_code}: {error.code}: {error.message}", file=sys.stderr)
|
|
63
63
|
print(f"Request ID: {error.request_id}", file=sys.stderr)
|
|
64
|
-
charged = error.metadata.
|
|
64
|
+
charged = error.metadata.cu_charged if error.metadata else None
|
|
65
65
|
print(
|
|
66
66
|
f"Commercial CU charged: {charged if charged is not None else 'not reported'}",
|
|
67
67
|
file=sys.stderr,
|
|
@@ -73,7 +73,7 @@ async def main() -> None:
|
|
|
73
73
|
"No complete response; execution and charges may be unknown. No retry."
|
|
74
74
|
) from None
|
|
75
75
|
except ResponseError as error:
|
|
76
|
-
charged = error.metadata.
|
|
76
|
+
charged = error.metadata.cu_charged if error.metadata else None
|
|
77
77
|
print(
|
|
78
78
|
f"Commercial CU charged: {charged if charged is not None else 'not reported'}",
|
|
79
79
|
file=sys.stderr,
|
|
@@ -95,7 +95,7 @@ async def main() -> None:
|
|
|
95
95
|
for engine in response.metadata.engines:
|
|
96
96
|
print(f"Engine: {engine.name} {engine.version} ({engine.revision})")
|
|
97
97
|
# Missing commercial CU is unreported, not zero.
|
|
98
|
-
charged = response.metadata.
|
|
98
|
+
charged = response.metadata.cu_charged
|
|
99
99
|
print("Commercial CU charged:", charged if charged is not None else "not reported")
|
|
100
100
|
|
|
101
101
|
|
|
@@ -40,7 +40,7 @@ def main() -> None:
|
|
|
40
40
|
# Also runs on interruption; preserve partial results and unknown charges.
|
|
41
41
|
for attempt in workflow.attempts:
|
|
42
42
|
print(f"Input range [{attempt.start}, {attempt.stop}): {attempt.request_id}")
|
|
43
|
-
charge = attempt.
|
|
43
|
+
charge = attempt.cu_charged
|
|
44
44
|
print("Chunk CU:", charge if charge is not None else "not reported")
|
|
45
45
|
if attempt.response is None:
|
|
46
46
|
print("No validated results for this chunk; do not replay automatically.")
|
|
@@ -57,9 +57,9 @@ def main() -> None:
|
|
|
57
57
|
for engine in attempt.response.metadata.engines:
|
|
58
58
|
print("Engine:", engine.name, engine.version, engine.revision)
|
|
59
59
|
print("Workflow state:", workflow.state)
|
|
60
|
-
print("Reported CU subtotal:", workflow.
|
|
60
|
+
print("Reported CU subtotal:", workflow.reported_cu_charged)
|
|
61
61
|
print("Attempts with unknown CU:", workflow.unknown_charge_count)
|
|
62
|
-
total = workflow.
|
|
62
|
+
total = workflow.total_cu_charged
|
|
63
63
|
print("Whole-workflow CU:", total if total is not None else "unknown or incomplete")
|
|
64
64
|
print("Unattempted input ranges:", workflow.unattempted_ranges)
|
|
65
65
|
if workflow.state != "completed":
|
|
@@ -43,7 +43,7 @@ async def main(max_concurrency: int = 1) -> None:
|
|
|
43
43
|
# Also runs on interruption; preserve partial results and unknown charges.
|
|
44
44
|
for attempt in workflow.attempts:
|
|
45
45
|
print(f"Input range [{attempt.start}, {attempt.stop}): {attempt.request_id}")
|
|
46
|
-
charge = attempt.
|
|
46
|
+
charge = attempt.cu_charged
|
|
47
47
|
print("Chunk CU:", charge if charge is not None else "not reported")
|
|
48
48
|
if attempt.response is None:
|
|
49
49
|
print("No validated results for this chunk; do not replay automatically.")
|
|
@@ -60,9 +60,9 @@ async def main(max_concurrency: int = 1) -> None:
|
|
|
60
60
|
for engine in attempt.response.metadata.engines:
|
|
61
61
|
print("Engine:", engine.name, engine.version, engine.revision)
|
|
62
62
|
print("Workflow state:", workflow.state)
|
|
63
|
-
print("Reported CU subtotal:", workflow.
|
|
63
|
+
print("Reported CU subtotal:", workflow.reported_cu_charged)
|
|
64
64
|
print("Attempts with unknown CU:", workflow.unknown_charge_count)
|
|
65
|
-
total = workflow.
|
|
65
|
+
total = workflow.total_cu_charged
|
|
66
66
|
print("Whole-workflow CU:", total if total is not None else "unknown or incomplete")
|
|
67
67
|
print("Unattempted input ranges:", workflow.unattempted_ranges)
|
|
68
68
|
if workflow.state != "completed":
|
|
@@ -43,10 +43,10 @@ def main() -> None:
|
|
|
43
43
|
batch = BatchPriceRequest(requests=[request, request])
|
|
44
44
|
quote = client.quote(batch if args.batch else request)
|
|
45
45
|
print(quote.model_dump_json(indent=2))
|
|
46
|
-
print("Prospective execution CU:", quote.quote.
|
|
47
|
-
print("Utility CU charged:", quote.metadata.
|
|
46
|
+
print("Prospective execution CU:", quote.quote.total_cu)
|
|
47
|
+
print("Utility CU charged:", quote.metadata.cu_charged)
|
|
48
48
|
if args.execute:
|
|
49
|
-
ceiling = quote.quote.
|
|
49
|
+
ceiling = quote.quote.total_cu if args.max_cu is None else args.max_cu
|
|
50
50
|
response: PriceResponse | BatchPriceResponse
|
|
51
51
|
try:
|
|
52
52
|
if args.batch:
|
|
@@ -56,8 +56,8 @@ def main() -> None:
|
|
|
56
56
|
except APIError as error:
|
|
57
57
|
print(f"HTTP {error.status_code}: {error.code}", file=sys.stderr)
|
|
58
58
|
print("Request ID:", error.request_id, file=sys.stderr)
|
|
59
|
-
quoted = error.metadata.
|
|
60
|
-
charged = error.metadata.
|
|
59
|
+
quoted = error.metadata.cu_quoted if error.metadata else None
|
|
60
|
+
charged = error.metadata.cu_charged if error.metadata else None
|
|
61
61
|
print(
|
|
62
62
|
"Execution quote CU:",
|
|
63
63
|
quoted if quoted is not None else "not reported",
|
|
@@ -34,7 +34,7 @@ def main() -> None:
|
|
|
34
34
|
except APIError as error:
|
|
35
35
|
print(f"HTTP {error.status_code}: {error.code}: {error.message}", file=sys.stderr)
|
|
36
36
|
print(f"Request ID: {error.request_id}", file=sys.stderr)
|
|
37
|
-
charged = error.metadata.
|
|
37
|
+
charged = error.metadata.cu_charged if error.metadata else None
|
|
38
38
|
print(
|
|
39
39
|
f"Commercial CU charged: {charged if charged is not None else 'not reported'}",
|
|
40
40
|
file=sys.stderr,
|
|
@@ -73,7 +73,7 @@ def main() -> None:
|
|
|
73
73
|
for engine in response.metadata.engines:
|
|
74
74
|
print(f"Engine: {engine.name} {engine.version} ({engine.revision})")
|
|
75
75
|
# Missing commercial CU is unreported, not zero.
|
|
76
|
-
charged = response.metadata.
|
|
76
|
+
charged = response.metadata.cu_charged
|
|
77
77
|
print("Commercial CU charged:", charged if charged is not None else "not reported")
|
|
78
78
|
|
|
79
79
|
|
|
@@ -35,7 +35,7 @@ async def main() -> None:
|
|
|
35
35
|
except APIError as error:
|
|
36
36
|
print(f"HTTP {error.status_code}: {error.code}: {error.message}", file=sys.stderr)
|
|
37
37
|
print(f"Request ID: {error.request_id}", file=sys.stderr)
|
|
38
|
-
charged = error.metadata.
|
|
38
|
+
charged = error.metadata.cu_charged if error.metadata else None
|
|
39
39
|
print(
|
|
40
40
|
f"Commercial CU charged: {charged if charged is not None else 'not reported'}",
|
|
41
41
|
file=sys.stderr,
|
|
@@ -74,7 +74,7 @@ async def main() -> None:
|
|
|
74
74
|
for engine in response.metadata.engines:
|
|
75
75
|
print(f"Engine: {engine.name} {engine.version} ({engine.revision})")
|
|
76
76
|
# Missing commercial CU is unreported, not zero.
|
|
77
|
-
charged = response.metadata.
|
|
77
|
+
charged = response.metadata.cu_charged
|
|
78
78
|
print("Commercial CU charged:", charged if charged is not None else "not reported")
|
|
79
79
|
|
|
80
80
|
|
|
@@ -34,7 +34,7 @@ def main() -> None:
|
|
|
34
34
|
except APIError as error:
|
|
35
35
|
print(f"HTTP {error.status_code}: {error.code}: {error.message}", file=sys.stderr)
|
|
36
36
|
print(f"Request ID: {error.request_id}", file=sys.stderr)
|
|
37
|
-
charged = error.metadata.
|
|
37
|
+
charged = error.metadata.cu_charged if error.metadata else None
|
|
38
38
|
print(
|
|
39
39
|
f"Commercial CU charged: {charged if charged is not None else 'not reported'}",
|
|
40
40
|
file=sys.stderr,
|
|
@@ -68,7 +68,7 @@ def main() -> None:
|
|
|
68
68
|
for engine in response.metadata.engines:
|
|
69
69
|
print(f"Engine: {engine.name} {engine.version} ({engine.revision})")
|
|
70
70
|
# Missing commercial CU is unreported, not zero.
|
|
71
|
-
charged = response.metadata.
|
|
71
|
+
charged = response.metadata.cu_charged
|
|
72
72
|
print("Commercial CU charged:", charged if charged is not None else "not reported")
|
|
73
73
|
|
|
74
74
|
|
|
@@ -52,7 +52,7 @@ def main() -> None:
|
|
|
52
52
|
except APIError as error:
|
|
53
53
|
print(f"HTTP {error.status_code}: {error.code}: {error.message}", file=sys.stderr)
|
|
54
54
|
print(f"Request ID: {error.request_id}", file=sys.stderr)
|
|
55
|
-
charged = error.metadata.
|
|
55
|
+
charged = error.metadata.cu_charged if error.metadata else None
|
|
56
56
|
print(
|
|
57
57
|
f"Commercial CU charged: {charged if charged is not None else 'not reported'}",
|
|
58
58
|
file=sys.stderr,
|
|
@@ -83,6 +83,22 @@ def main() -> None:
|
|
|
83
83
|
else:
|
|
84
84
|
print(f" Reason: {head.reason_code}")
|
|
85
85
|
|
|
86
|
+
volatility = response.result.volatility
|
|
87
|
+
if volatility is not None:
|
|
88
|
+
print("Volatility:", volatility.status)
|
|
89
|
+
if volatility.status == "available":
|
|
90
|
+
print(" Label:", volatility.prediction.label)
|
|
91
|
+
else:
|
|
92
|
+
print(" Reason:", volatility.reason_code)
|
|
93
|
+
crisis = response.result.crisis
|
|
94
|
+
if crisis is not None:
|
|
95
|
+
print("Crisis:", crisis.status)
|
|
96
|
+
if crisis.status == "unavailable":
|
|
97
|
+
print(" Reason:", crisis.reason_code)
|
|
98
|
+
else:
|
|
99
|
+
print(" Linear readout (not a probability):", crisis.score)
|
|
100
|
+
print(" Episode start price index:", crisis.episode_start_price_index)
|
|
101
|
+
|
|
86
102
|
# Scores are uncalibrated softmax values, not probabilities or p-values.
|
|
87
103
|
# Do not multiply heads. LOWER_VOL/HIGHER_VOL are relative model states,
|
|
88
104
|
# not historical volatility levels or price directions.
|
|
@@ -99,7 +115,7 @@ def main() -> None:
|
|
|
99
115
|
print("Request ID:", metadata.request_id)
|
|
100
116
|
for engine in metadata.engines:
|
|
101
117
|
print(f"Engine: {engine.name} {engine.version} ({engine.revision})")
|
|
102
|
-
charged = metadata.
|
|
118
|
+
charged = metadata.cu_charged
|
|
103
119
|
print("Commercial CU charged:", charged if charged is not None else "not reported")
|
|
104
120
|
|
|
105
121
|
|
|
@@ -53,7 +53,7 @@ async def main() -> None:
|
|
|
53
53
|
except APIError as error:
|
|
54
54
|
print(f"HTTP {error.status_code}: {error.code}: {error.message}", file=sys.stderr)
|
|
55
55
|
print(f"Request ID: {error.request_id}", file=sys.stderr)
|
|
56
|
-
charged = error.metadata.
|
|
56
|
+
charged = error.metadata.cu_charged if error.metadata else None
|
|
57
57
|
print(
|
|
58
58
|
f"Commercial CU charged: {charged if charged is not None else 'not reported'}",
|
|
59
59
|
file=sys.stderr,
|
|
@@ -84,6 +84,22 @@ async def main() -> None:
|
|
|
84
84
|
else:
|
|
85
85
|
print(f" Reason: {head.reason_code}")
|
|
86
86
|
|
|
87
|
+
volatility = response.result.volatility
|
|
88
|
+
if volatility is not None:
|
|
89
|
+
print("Volatility:", volatility.status)
|
|
90
|
+
if volatility.status == "available":
|
|
91
|
+
print(" Label:", volatility.prediction.label)
|
|
92
|
+
else:
|
|
93
|
+
print(" Reason:", volatility.reason_code)
|
|
94
|
+
crisis = response.result.crisis
|
|
95
|
+
if crisis is not None:
|
|
96
|
+
print("Crisis:", crisis.status)
|
|
97
|
+
if crisis.status == "unavailable":
|
|
98
|
+
print(" Reason:", crisis.reason_code)
|
|
99
|
+
else:
|
|
100
|
+
print(" Linear readout (not a probability):", crisis.score)
|
|
101
|
+
print(" Episode start price index:", crisis.episode_start_price_index)
|
|
102
|
+
|
|
87
103
|
# Scores are uncalibrated softmax values, not probabilities or p-values.
|
|
88
104
|
# Do not multiply heads. LOWER_VOL/HIGHER_VOL are relative model states,
|
|
89
105
|
# not historical volatility levels or price directions.
|
|
@@ -100,7 +116,7 @@ async def main() -> None:
|
|
|
100
116
|
print("Request ID:", metadata.request_id)
|
|
101
117
|
for engine in metadata.engines:
|
|
102
118
|
print(f"Engine: {engine.name} {engine.version} ({engine.revision})")
|
|
103
|
-
charged = metadata.
|
|
119
|
+
charged = metadata.cu_charged
|
|
104
120
|
print("Commercial CU charged:", charged if charged is not None else "not reported")
|
|
105
121
|
|
|
106
122
|
|
|
@@ -34,7 +34,7 @@ def main() -> None:
|
|
|
34
34
|
except APIError as error:
|
|
35
35
|
print(f"HTTP {error.status_code}: {error.code}: {error.message}", file=sys.stderr)
|
|
36
36
|
print(f"Request ID: {error.request_id}", file=sys.stderr)
|
|
37
|
-
charged = error.metadata.
|
|
37
|
+
charged = error.metadata.cu_charged if error.metadata else None
|
|
38
38
|
print(
|
|
39
39
|
f"Commercial CU charged: {charged if charged is not None else 'not reported'}",
|
|
40
40
|
file=sys.stderr,
|
|
@@ -62,7 +62,7 @@ def main() -> None:
|
|
|
62
62
|
for engine in response.metadata.engines:
|
|
63
63
|
print(f"Engine: {engine.name} {engine.version} ({engine.revision})")
|
|
64
64
|
# Missing commercial CU is unreported, not zero.
|
|
65
|
-
charged = response.metadata.
|
|
65
|
+
charged = response.metadata.cu_charged
|
|
66
66
|
print("Commercial CU charged:", charged if charged is not None else "not reported")
|
|
67
67
|
|
|
68
68
|
|
|
@@ -41,7 +41,7 @@ async def main() -> None:
|
|
|
41
41
|
except APIError as error:
|
|
42
42
|
print(f"HTTP {error.status_code}: {error.code}: {error.message}", file=sys.stderr)
|
|
43
43
|
print(f"Request ID: {error.request_id}", file=sys.stderr)
|
|
44
|
-
charged = error.metadata.
|
|
44
|
+
charged = error.metadata.cu_charged if error.metadata else None
|
|
45
45
|
print(
|
|
46
46
|
f"Commercial CU charged: {charged if charged is not None else 'not reported'}",
|
|
47
47
|
file=sys.stderr,
|
|
@@ -69,7 +69,7 @@ async def main() -> None:
|
|
|
69
69
|
for engine in response.metadata.engines:
|
|
70
70
|
print(f"Engine: {engine.name} {engine.version} ({engine.revision})")
|
|
71
71
|
# Missing commercial CU is unreported, not zero.
|
|
72
|
-
charged = response.metadata.
|
|
72
|
+
charged = response.metadata.cu_charged
|
|
73
73
|
print("Commercial CU charged:", charged if charged is not None else "not reported")
|
|
74
74
|
|
|
75
75
|
|
|
@@ -34,7 +34,7 @@ def main() -> None:
|
|
|
34
34
|
except APIError as error:
|
|
35
35
|
print(f"HTTP {error.status_code}: {error.code}: {error.message}", file=sys.stderr)
|
|
36
36
|
print(f"Request ID: {error.request_id}", file=sys.stderr)
|
|
37
|
-
charged = error.metadata.
|
|
37
|
+
charged = error.metadata.cu_charged if error.metadata else None
|
|
38
38
|
print(
|
|
39
39
|
f"Commercial CU charged: {charged if charged is not None else 'not reported'}",
|
|
40
40
|
file=sys.stderr,
|
|
@@ -56,7 +56,7 @@ def main() -> None:
|
|
|
56
56
|
for engine in response.metadata.engines:
|
|
57
57
|
print(f"Engine: {engine.name} {engine.version} ({engine.revision})")
|
|
58
58
|
# Missing commercial CU is unreported, not zero.
|
|
59
|
-
charged = response.metadata.
|
|
59
|
+
charged = response.metadata.cu_charged
|
|
60
60
|
print("Commercial CU charged:", charged if charged is not None else "not reported")
|
|
61
61
|
|
|
62
62
|
|
|
@@ -52,12 +52,12 @@ async def main() -> None:
|
|
|
52
52
|
for engine in response.metadata.engines:
|
|
53
53
|
print(f"Engine: {engine.name} {engine.version} ({engine.revision})")
|
|
54
54
|
# Missing commercial CU is unreported, not zero.
|
|
55
|
-
charged = response.metadata.
|
|
55
|
+
charged = response.metadata.cu_charged
|
|
56
56
|
print("Commercial CU charged:", charged if charged is not None else "not reported")
|
|
57
57
|
except APIError as error:
|
|
58
58
|
print(f"HTTP {error.status_code}: {error.code}: {error.message}", file=sys.stderr)
|
|
59
59
|
print(f"Request ID: {error.request_id}", file=sys.stderr)
|
|
60
|
-
charged = error.metadata.
|
|
60
|
+
charged = error.metadata.cu_charged if error.metadata else None
|
|
61
61
|
print(
|
|
62
62
|
f"Commercial CU charged: {charged if charged is not None else 'not reported'}",
|
|
63
63
|
file=sys.stderr,
|
|
@@ -34,7 +34,7 @@ def main() -> None:
|
|
|
34
34
|
except APIError as error:
|
|
35
35
|
print(f"HTTP {error.status_code}: {error.code}: {error.message}", file=sys.stderr)
|
|
36
36
|
print(f"Request ID: {error.request_id}", file=sys.stderr)
|
|
37
|
-
charged = error.metadata.
|
|
37
|
+
charged = error.metadata.cu_charged if error.metadata else None
|
|
38
38
|
print(
|
|
39
39
|
f"Commercial CU charged: {charged if charged is not None else 'not reported'}",
|
|
40
40
|
file=sys.stderr,
|
|
@@ -56,7 +56,7 @@ def main() -> None:
|
|
|
56
56
|
for engine in response.metadata.engines:
|
|
57
57
|
print(f"Engine: {engine.name} {engine.version} ({engine.revision})")
|
|
58
58
|
# Missing commercial CU is unreported, not zero.
|
|
59
|
-
charged = response.metadata.
|
|
59
|
+
charged = response.metadata.cu_charged
|
|
60
60
|
print("Commercial CU charged:", charged if charged is not None else "not reported")
|
|
61
61
|
|
|
62
62
|
|
|
@@ -51,12 +51,12 @@ def main() -> None:
|
|
|
51
51
|
for engine in response.metadata.engines:
|
|
52
52
|
print(f"Engine: {engine.name} {engine.version} ({engine.revision})")
|
|
53
53
|
# Missing commercial CU is unreported, not zero.
|
|
54
|
-
charged = response.metadata.
|
|
54
|
+
charged = response.metadata.cu_charged
|
|
55
55
|
print("Commercial CU charged:", charged if charged is not None else "not reported")
|
|
56
56
|
except APIError as error:
|
|
57
57
|
print(f"HTTP {error.status_code}: {error.code}: {error.message}", file=sys.stderr)
|
|
58
58
|
print(f"Request ID: {error.request_id}", file=sys.stderr)
|
|
59
|
-
charged = error.metadata.
|
|
59
|
+
charged = error.metadata.cu_charged if error.metadata else None
|
|
60
60
|
print(
|
|
61
61
|
f"Commercial CU charged: {charged if charged is not None else 'not reported'}",
|
|
62
62
|
file=sys.stderr,
|
|
@@ -48,13 +48,13 @@ def main() -> None:
|
|
|
48
48
|
print(frames.results[columns].to_string(index=False))
|
|
49
49
|
# Charges belong to requests, never to individual option rows.
|
|
50
50
|
print(
|
|
51
|
-
frames.requests[["request_index", "status", "request_id", "
|
|
51
|
+
frames.requests[["request_index", "status", "request_id", "cu_charged"]].to_string(
|
|
52
52
|
index=False
|
|
53
53
|
)
|
|
54
54
|
)
|
|
55
|
-
print("Reported CU subtotal:", frames.
|
|
55
|
+
print("Reported CU subtotal:", frames.reported_cu_charged)
|
|
56
56
|
print("Attempts with unknown CU:", frames.unknown_charge_count)
|
|
57
|
-
total = frames.
|
|
57
|
+
total = frames.total_cu_charged
|
|
58
58
|
print("Whole-workflow CU:", total if total is not None else "unknown or incomplete")
|
|
59
59
|
if workflow.state != "completed":
|
|
60
60
|
raise SystemExit(1)
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"Set `MORPHIQ_API_KEY` before opening Jupyter, or enter it in the masked setup prompt.\n",
|
|
18
18
|
"Use a deployment supporting cost utilities. Quote again after changing inputs.\n",
|
|
19
19
|
"\n",
|
|
20
|
-
"Read the output: `
|
|
20
|
+
"Read the output: `total_cu` is the prospective execution charge; the utility\n",
|
|
21
21
|
"charge printed below it is zero. Rate lines group work by billing class. A minimum\n",
|
|
22
22
|
"is a floor on the whole request, not an extra fee. The Max CU control limits the\n",
|
|
23
23
|
"next execution only. A 409 `cost_limit_exceeded` refusal commits no charge; review\n",
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"\n",
|
|
77
77
|
"def show_error(error):\n",
|
|
78
78
|
" if isinstance(error, APIError):\n",
|
|
79
|
-
" charged = error.metadata.
|
|
79
|
+
" charged = error.metadata.cu_charged if error.metadata else \"unknown\"\n",
|
|
80
80
|
" print(f\"API refused: {error.status_code}; {error.code}; charged CU: {charged}\")\n",
|
|
81
81
|
" else:\n",
|
|
82
82
|
" print(str(error))\n",
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
" with MorphIQ(api_key=api_key) as client:\n",
|
|
90
90
|
" response = client.cost_schedule(operation=\"price\")\n",
|
|
91
91
|
" print(response.schedule.model_dump_json(indent=2))\n",
|
|
92
|
-
" print(\"Utility CU charged:\", response.metadata.
|
|
92
|
+
" print(\"Utility CU charged:\", response.metadata.cu_charged)\n",
|
|
93
93
|
" except (APIError, TransportError, ValueError) as error:\n",
|
|
94
94
|
" show_error(error)\n",
|
|
95
95
|
"\n",
|
|
@@ -105,11 +105,11 @@
|
|
|
105
105
|
" with MorphIQ(api_key=api_key) as client:\n",
|
|
106
106
|
" response = client.quote(request)\n",
|
|
107
107
|
" last_quote, quoted_request = response, request.to_wire()\n",
|
|
108
|
-
" maximum.value = response.quote.
|
|
108
|
+
" maximum.value = response.quote.total_cu\n",
|
|
109
109
|
" execute_button.disabled = False\n",
|
|
110
110
|
" print(response.quote.model_dump_json(indent=2))\n",
|
|
111
111
|
" print(\"Selected models:\", response.resolved_models)\n",
|
|
112
|
-
" print(\"Utility CU charged:\", response.metadata.
|
|
112
|
+
" print(\"Utility CU charged:\", response.metadata.cu_charged)\n",
|
|
113
113
|
" print(\"Execution is a separate action. Adjust Max CU if desired.\")\n",
|
|
114
114
|
" except (APIError, TransportError, ValueError) as error:\n",
|
|
115
115
|
" show_error(error)\n",
|
|
@@ -127,7 +127,7 @@
|
|
|
127
127
|
" with MorphIQ(api_key=api_key) as client:\n",
|
|
128
128
|
" last_result = client.price(request, max_cu=maximum.value)\n",
|
|
129
129
|
" print(\"Price:\", last_result.result.price)\n",
|
|
130
|
-
" print(\"CU charged:\", last_result.metadata.
|
|
130
|
+
" print(\"CU charged:\", last_result.metadata.cu_charged)\n",
|
|
131
131
|
" except (APIError, TransportError, ValueError) as error:\n",
|
|
132
132
|
" show_error(error)\n",
|
|
133
133
|
"\n",
|