-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathphase14_service_loop.json
More file actions
265 lines (265 loc) · 8.99 KB
/
Copy pathphase14_service_loop.json
File metadata and controls
265 lines (265 loc) · 8.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
{
"cython_cpp_recommendation": "Cython/C++ is not justified yet. The measured bottleneck remains in facade/report/preparation layers. Phase 14C added opt-in cache threading and report-level controls; larger real service-loop profiles should come before any Cython/C++ decision.",
"decomposition": {
"native_event": {
"backend": "native_event",
"bars": 360,
"orders": 120,
"profile": "phase14b",
"stages": [
{
"backend": "native_event",
"notes": "validate_datetime + align OHLC/funding",
"percent_of_profile": 39.877008194125814,
"profile": "phase14b",
"repeats": 2,
"seconds": 0.002686557942070067,
"stage": "data_normalization"
},
{
"backend": "native_event",
"notes": "build contiguous market arrays",
"percent_of_profile": 23.447176395706094,
"profile": "phase14b",
"repeats": 2,
"seconds": 0.001579662086442113,
"stage": "pandas_to_ndarray"
},
{
"backend": "native_event",
"notes": "compile orders with vectorized timestamp mapping",
"percent_of_profile": 11.059133161521158,
"profile": "phase14b",
"repeats": 2,
"seconds": 0.000745065975934267,
"stage": "order_array_construction"
},
{
"backend": "native_event",
"notes": "compiled _engine_event_v1 only",
"percent_of_profile": 0.863562245453643,
"profile": "phase14b",
"repeats": 2,
"seconds": 5.817913915961981e-05,
"stage": "pure_numba_kernel"
},
{
"backend": "native_event",
"notes": "order report + Series/DataFrame/BacktestResultV2",
"percent_of_profile": 24.753120003193292,
"profile": "phase14b",
"repeats": 2,
"seconds": 0.00166764494497329,
"stage": "result_report_construction"
}
],
"symbols": 4,
"total_seconds": 0.006737110088579357
},
"native_portfolio": {
"bar_symbols": 1440,
"notes": "Prepared-array cache targets WFO/service loops. Pure Numba kernel remains separated from pandas normalization and report construction.",
"repeats": 2,
"rows": 360,
"stages": {
"array_preparation_seconds": 0.005381554015912116,
"array_preparation_share_pct": 21.028710470172022,
"full_facade_seconds": 0.025591459940187633,
"prepared_reuse_facade_seconds": 0.022129982942715287,
"prepared_reuse_speedup": 1.1564157101445842,
"pure_kernel_share_pct": 0.18371145782621087,
"pure_numba_kernel_seconds": 4.701444413512945e-05,
"report_construction_estimate_seconds": 0.020162891480140388,
"report_construction_share_pct": 78.78757807200176
},
"status": "pass",
"symbols": 4
},
"native_vectorized": {
"backend": "native_vectorized",
"bars": 360,
"orders": 120,
"profile": "phase14b",
"stages": [
{
"backend": "native_vectorized",
"notes": "validate_datetime + align OHLC/signals/funding",
"percent_of_profile": 51.87375795375464,
"profile": "phase14b",
"repeats": 2,
"seconds": 0.0034934490686282516,
"stage": "data_normalization"
},
{
"backend": "native_vectorized",
"notes": "build contiguous market/signal arrays",
"percent_of_profile": 29.391058397561075,
"profile": "phase14b",
"repeats": 2,
"seconds": 0.001979346969164908,
"stage": "pandas_to_ndarray"
},
{
"backend": "native_vectorized",
"notes": "compute fast signal_notional target-unit matrix",
"percent_of_profile": 0.1114105607254627,
"profile": "phase14b",
"repeats": 2,
"seconds": 7.502967491745949e-06,
"stage": "target_sizing"
},
{
"backend": "native_vectorized",
"notes": "compiled _engine_units_v2 only",
"percent_of_profile": 0.4642198890789888,
"profile": "phase14b",
"repeats": 2,
"seconds": 3.1262985430657864e-05,
"stage": "pure_numba_kernel"
},
{
"backend": "native_vectorized",
"notes": "Series/DataFrame/BacktestResultV2 construction",
"percent_of_profile": 18.15955319887983,
"profile": "phase14b",
"repeats": 2,
"seconds": 0.0012229589046910405,
"stage": "result_report_construction"
}
],
"symbols": 4,
"total_seconds": 0.006734520895406604
}
},
"folds": 1,
"next_optimization_targets": [
"native_vectorized: `data_normalization` (51.9%)",
"native_event: `data_normalization` (39.9%)",
"native_portfolio: `report_construction_estimate` (78.8%)",
"Next step should be real workload profiling before considering Cython/C++; Phase 14C moved the main cache/report controls into opt-in APIs."
],
"order_count": 120,
"parity": {
"arbitrage_package_sweep": true,
"native_event_replay": true,
"portfolio_wfo": true,
"report_heavy_vs_light": true,
"single_symbol_wfo": true
},
"repeats": 2,
"rows": 360,
"service_loops": {
"arbitrage_package_sweep": {
"audit_status": "pass",
"full_seconds": 0.07462308299727738,
"max_equity_diff": 0.0,
"max_package_residual": 1.2736478538499796e-11,
"notes": "compares native-event arbitrage package cold vs prepared market-array replay; vectorized parity remains audited",
"parity_passed": true,
"parity_status": "pass",
"peak_memory_mb": 0.9488792419433594,
"prepared_equity_diff": 0.0,
"prepared_seconds": 0.06632716755848378,
"speedup": 1.1250756777979205
},
"native_event_replay": {
"cold_seconds": 0.009586586616933346,
"equity_diff": 0.0,
"notes": "prepared replay reuses market arrays and compiled order arrays",
"orders": 120,
"parity_passed": true,
"peak_memory_mb": 0.17985248565673828,
"positions_diff": 0.0,
"prepared_seconds": 0.004569042124785483,
"speedup": 2.0981611364293205
},
"portfolio_wfo": {
"cache_metadata": {
"available": true,
"backend": "native_portfolio",
"enabled": true,
"fallback_runs": 0,
"market_cache_entries": 2,
"market_cache_hits": 6,
"market_cache_misses": 2,
"prepared_runs": 8,
"prepared_scoring_report_level": "minimal",
"target_mode": "portfolio"
},
"final_equity_diff": 0.0,
"full_seconds": 0.4395257671130821,
"notes": "compares uncached vs prepared portfolio WFO endpoint scoring",
"objective_diff": 0.0,
"parity_passed": true,
"peak_memory_mb": 0.7784252166748047,
"prepared_seconds": 0.32566470850724727,
"speedup": 1.3496266424683871
},
"report_heavy_vs_light": {
"equity_diff": 0.0,
"full_reports": [
"accepted_notional_report",
"accepted_units_report",
"exposure_report",
"fills_report",
"funding_rates_report",
"order_report",
"orders_report",
"portfolio_contract_report",
"positions_report",
"rebalance_report",
"risk_contribution_report",
"risk_volatility_report",
"symbol_pnl_report",
"target_notional_report",
"target_units_report"
],
"full_seconds": 0.04100000998005271,
"light_seconds": 0.023349451483227313,
"minimal_reports_omitted": [
"target_notional_report",
"accepted_notional_report",
"exposure_report",
"funding_rates_report",
"risk_volatility_report",
"risk_contribution_report",
"symbol_pnl_report",
"kernel_symbol_pnl",
"rebalance_report"
],
"notes": "compares native-portfolio report_level='full' vs 'minimal' construction with core accounting parity",
"parity_passed": true,
"peak_memory_mb": 0.9158792495727539,
"position_diff": 0.0,
"speedup": 1.7559303270787487
},
"single_symbol_wfo": {
"best_params": {
"threshold": 0.6000000000000001
},
"cache_metadata": {
"available": true,
"backend": "native_vectorized",
"enabled": true,
"fallback_runs": 0,
"market_cache_entries": 7,
"market_cache_hits": 21,
"market_cache_misses": 7,
"prepared_runs": 28,
"prepared_scoring_report_level": "minimal",
"target_mode": "signal_notional"
},
"final_equity_diff": 0.0,
"full_seconds": 1.0071885475190356,
"notes": "compares uncached vs prepared single-symbol native-vectorized WFO endpoint scoring",
"objective_diff": 0.0,
"parity_passed": true,
"peak_memory_mb": 0.426666259765625,
"prepared_seconds": 0.8834504844853655,
"speedup": 1.1400622504675528
}
},
"status": "pass",
"symbols": 4,
"trials": 4
}