@reyaxyz/strategy-format 0.0.0-stage → 0.3.0

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.
@@ -0,0 +1,1758 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "title": "Document",
4
+ "description": "A v3 strategy document.",
5
+ "type": "object",
6
+ "properties": {
7
+ "actions": {
8
+ "description": "Actions.",
9
+ "type": "object",
10
+ "additionalProperties": {
11
+ "$ref": "#/$defs/Action"
12
+ },
13
+ "minProperties": 1,
14
+ "propertyNames": {
15
+ "pattern": "^a_[1-9][0-9]{0,19}$"
16
+ }
17
+ },
18
+ "lists": {
19
+ "description": "Market lists.",
20
+ "type": "array",
21
+ "items": {
22
+ "$ref": "#/$defs/ListBlock"
23
+ },
24
+ "minItems": 1
25
+ },
26
+ "max_loss_rusd": {
27
+ "description": "The strategy's loss limit.",
28
+ "type": "string",
29
+ "pattern": "^(0|[1-9][0-9]*)(\\.[0-9]*[1-9])?$"
30
+ },
31
+ "on_liquidation": {
32
+ "description": "What liquidation does to the strategy.",
33
+ "$ref": "#/$defs/OnLiquidation"
34
+ },
35
+ "on_margin_skip": {
36
+ "description": "What a margin skip does to the strategy.",
37
+ "$ref": "#/$defs/OnMarginSkip"
38
+ },
39
+ "rules": {
40
+ "description": "Rules.",
41
+ "type": "object",
42
+ "additionalProperties": {
43
+ "$ref": "#/$defs/Rule"
44
+ },
45
+ "minProperties": 1,
46
+ "propertyNames": {
47
+ "pattern": "^r_[1-9][0-9]{0,19}$"
48
+ }
49
+ },
50
+ "schema": {
51
+ "description": "Always `reya.workflow/3`.",
52
+ "const": "reya.workflow/3"
53
+ },
54
+ "series": {
55
+ "description": "Outside series pins.",
56
+ "type": "object",
57
+ "additionalProperties": {
58
+ "$ref": "#/$defs/SeriesPin"
59
+ },
60
+ "minProperties": 1,
61
+ "propertyNames": {
62
+ "pattern": "^se_[1-9][0-9]{0,19}$"
63
+ }
64
+ },
65
+ "start": {
66
+ "description": "The start state.",
67
+ "$ref": "#/$defs/BlockId"
68
+ },
69
+ "states": {
70
+ "description": "States.",
71
+ "type": "object",
72
+ "additionalProperties": {
73
+ "$ref": "#/$defs/State"
74
+ },
75
+ "minProperties": 1,
76
+ "propertyNames": {
77
+ "pattern": "^st_[1-9][0-9]{0,19}$"
78
+ }
79
+ }
80
+ },
81
+ "additionalProperties": false,
82
+ "required": [
83
+ "schema",
84
+ "on_liquidation",
85
+ "on_margin_skip",
86
+ "start",
87
+ "states"
88
+ ],
89
+ "$defs": {
90
+ "Action": {
91
+ "description": "An action.",
92
+ "oneOf": [
93
+ {
94
+ "description": "An immediate order.",
95
+ "type": "object",
96
+ "properties": {
97
+ "kind": {
98
+ "type": "string",
99
+ "const": "order"
100
+ },
101
+ "market": {
102
+ "description": "The market; absent = the row's.",
103
+ "type": "string",
104
+ "pattern": "^[A-Z0-9]{1,32}$"
105
+ },
106
+ "max_slippage_bps": {
107
+ "description": "Required, 1..=10,000, capped by the market's band (M).",
108
+ "type": "integer",
109
+ "format": "uint32",
110
+ "maximum": 10000,
111
+ "minimum": 1
112
+ },
113
+ "side": {
114
+ "description": "Buy, sell, or the row's side.",
115
+ "$ref": "#/$defs/SideSpec"
116
+ },
117
+ "size": {
118
+ "description": "The size.",
119
+ "$ref": "#/$defs/Size"
120
+ }
121
+ },
122
+ "additionalProperties": false,
123
+ "required": [
124
+ "kind",
125
+ "side",
126
+ "size",
127
+ "max_slippage_bps"
128
+ ]
129
+ },
130
+ {
131
+ "description": "Resting limit orders.",
132
+ "type": "object",
133
+ "properties": {
134
+ "keep": {
135
+ "description": "`true` keeps the orders across state exits; `false` is refused.",
136
+ "enum": [
137
+ true
138
+ ]
139
+ },
140
+ "kind": {
141
+ "type": "string",
142
+ "const": "limit_orders"
143
+ },
144
+ "orders": {
145
+ "description": "At most 50 orders.",
146
+ "type": "array",
147
+ "items": {
148
+ "$ref": "#/$defs/RestingOrder"
149
+ },
150
+ "maxItems": 50,
151
+ "minItems": 1
152
+ }
153
+ },
154
+ "additionalProperties": false,
155
+ "required": [
156
+ "kind",
157
+ "orders"
158
+ ]
159
+ },
160
+ {
161
+ "description": "Closes the strategy's share.",
162
+ "type": "object",
163
+ "properties": {
164
+ "kind": {
165
+ "type": "string",
166
+ "const": "close"
167
+ },
168
+ "market": {
169
+ "description": "The market; absent = the row's.",
170
+ "type": "string",
171
+ "pattern": "^[A-Z0-9]{1,32}$"
172
+ }
173
+ },
174
+ "additionalProperties": false,
175
+ "required": [
176
+ "kind"
177
+ ]
178
+ },
179
+ {
180
+ "description": "Reduces the strategy's share.",
181
+ "type": "object",
182
+ "properties": {
183
+ "by": {
184
+ "description": "By a size or a percentage.",
185
+ "$ref": "#/$defs/ReduceBy"
186
+ },
187
+ "kind": {
188
+ "type": "string",
189
+ "const": "reduce"
190
+ },
191
+ "market": {
192
+ "description": "The market; absent = the row's.",
193
+ "type": "string",
194
+ "pattern": "^[A-Z0-9]{1,32}$"
195
+ }
196
+ },
197
+ "additionalProperties": false,
198
+ "required": [
199
+ "kind",
200
+ "by"
201
+ ]
202
+ },
203
+ {
204
+ "description": "Closes every instance of a list (gated `close_set`).",
205
+ "type": "object",
206
+ "properties": {
207
+ "kind": {
208
+ "type": "string",
209
+ "const": "close_set"
210
+ },
211
+ "list": {
212
+ "description": "The list.",
213
+ "$ref": "#/$defs/BlockId"
214
+ }
215
+ },
216
+ "additionalProperties": false,
217
+ "required": [
218
+ "kind",
219
+ "list"
220
+ ]
221
+ },
222
+ {
223
+ "description": "Rebalances a list (gated `rebalance`).",
224
+ "type": "object",
225
+ "properties": {
226
+ "kind": {
227
+ "type": "string",
228
+ "const": "rebalance"
229
+ },
230
+ "list": {
231
+ "description": "The list.",
232
+ "$ref": "#/$defs/BlockId"
233
+ },
234
+ "total_rusd": {
235
+ "description": "The total; absent = the account value.",
236
+ "type": "string",
237
+ "pattern": "^(0|[1-9][0-9]*)(\\.[0-9]*[1-9])?$"
238
+ },
239
+ "weights": {
240
+ "description": "The weights; the first matching row wins.",
241
+ "type": "array",
242
+ "items": {
243
+ "$ref": "#/$defs/WeightRow"
244
+ },
245
+ "minItems": 1
246
+ }
247
+ },
248
+ "additionalProperties": false,
249
+ "required": [
250
+ "kind",
251
+ "list",
252
+ "weights"
253
+ ]
254
+ },
255
+ {
256
+ "description": "Moves a stop level (gated `move_stop`).",
257
+ "type": "object",
258
+ "properties": {
259
+ "kind": {
260
+ "type": "string",
261
+ "const": "move_stop"
262
+ },
263
+ "level": {
264
+ "description": "The level.",
265
+ "$ref": "#/$defs/BlockId"
266
+ },
267
+ "rule": {
268
+ "description": "The stop rule.",
269
+ "$ref": "#/$defs/BlockId"
270
+ },
271
+ "to": {
272
+ "description": "Where to.",
273
+ "$ref": "#/$defs/Level"
274
+ }
275
+ },
276
+ "additionalProperties": false,
277
+ "required": [
278
+ "kind",
279
+ "rule",
280
+ "level",
281
+ "to"
282
+ ]
283
+ }
284
+ ]
285
+ },
286
+ "BlockId": {
287
+ "description": "A block id. Serialises as the string.",
288
+ "type": "string",
289
+ "maxLength": 23,
290
+ "pattern": "^(st|r|a|o|l|m|lv|w|se|oo)_([1-9][0-9]{0,18}|1[0-7][0-9]{18}|18[0-3][0-9]{17}|184[0-3][0-9]{16}|1844[0-5][0-9]{15}|18446[0-6][0-9]{14}|184467[0-3][0-9]{13}|1844674[0-3][0-9]{12}|184467440[0-6][0-9]{10}|1844674407[0-2][0-9]{9}|18446744073[0-6][0-9]{8}|1844674407370[0-8][0-9]{6}|18446744073709[0-4][0-9]{5}|184467440737095[0-4][0-9]{4}|18446744073709550[0-9]{3}|18446744073709551[0-5][0-9]{2}|1844674407370955160[0-9]|1844674407370955161[0-4]|18446744073709551615)$"
291
+ },
292
+ "Cadence": {
293
+ "description": "An `at` cadence.",
294
+ "type": "string",
295
+ "enum": [
296
+ "daily",
297
+ "weekly"
298
+ ]
299
+ },
300
+ "Direction": {
301
+ "description": "A crossing direction.",
302
+ "type": "string",
303
+ "enum": [
304
+ "up",
305
+ "down"
306
+ ]
307
+ },
308
+ "Expr": {
309
+ "description": "An expression node.",
310
+ "oneOf": [
311
+ {
312
+ "description": "A constant.",
313
+ "type": "object",
314
+ "properties": {
315
+ "kind": {
316
+ "type": "string",
317
+ "const": "num"
318
+ },
319
+ "value": {
320
+ "description": "The value, a canonical signed decimal.",
321
+ "type": "string",
322
+ "pattern": "^-?(0|[1-9][0-9]*)(\\.[0-9]*[1-9])?$"
323
+ }
324
+ },
325
+ "additionalProperties": false,
326
+ "required": [
327
+ "kind",
328
+ "value"
329
+ ]
330
+ },
331
+ {
332
+ "description": "An exchange series, in the row's market or the named one.",
333
+ "type": "object",
334
+ "properties": {
335
+ "kind": {
336
+ "type": "string",
337
+ "const": "series"
338
+ },
339
+ "market": {
340
+ "description": "The market; absent = the row's market.",
341
+ "type": "string",
342
+ "pattern": "^[A-Z0-9]{1,32}$"
343
+ },
344
+ "series": {
345
+ "description": "The series.",
346
+ "$ref": "#/$defs/SeriesName"
347
+ }
348
+ },
349
+ "additionalProperties": false,
350
+ "required": [
351
+ "kind",
352
+ "series"
353
+ ]
354
+ },
355
+ {
356
+ "description": "An outside series pin.",
357
+ "type": "object",
358
+ "properties": {
359
+ "kind": {
360
+ "type": "string",
361
+ "const": "outside"
362
+ },
363
+ "series": {
364
+ "description": "The pin.",
365
+ "$ref": "#/$defs/BlockId"
366
+ }
367
+ },
368
+ "additionalProperties": false,
369
+ "required": [
370
+ "kind",
371
+ "series"
372
+ ]
373
+ },
374
+ {
375
+ "description": "One of a list row's `reads`.",
376
+ "type": "object",
377
+ "properties": {
378
+ "index": {
379
+ "description": "0..=3.",
380
+ "type": "integer",
381
+ "format": "uint8",
382
+ "maximum": 3,
383
+ "minimum": 0
384
+ },
385
+ "kind": {
386
+ "type": "string",
387
+ "const": "row"
388
+ },
389
+ "row": {
390
+ "description": "Always `\"reads\"`.",
391
+ "$ref": "#/$defs/RowReads"
392
+ }
393
+ },
394
+ "additionalProperties": false,
395
+ "required": [
396
+ "kind",
397
+ "row",
398
+ "index"
399
+ ]
400
+ },
401
+ {
402
+ "description": "A strategy or account input.",
403
+ "type": "object",
404
+ "properties": {
405
+ "head": {
406
+ "description": "A12: the loop head for `rounds`, `wins`, `losses` (only those in the\nfirst release; anywhere else `head` is ill-typed).",
407
+ "$ref": "#/$defs/BlockId"
408
+ },
409
+ "kind": {
410
+ "type": "string",
411
+ "const": "input"
412
+ },
413
+ "market": {
414
+ "description": "The market; absent = the row's market (or total for `pnl`).",
415
+ "type": "string",
416
+ "pattern": "^[A-Z0-9]{1,32}$"
417
+ },
418
+ "name": {
419
+ "description": "The input.",
420
+ "$ref": "#/$defs/InputName"
421
+ },
422
+ "of": {
423
+ "description": "A7: the series `remembered` keeps.",
424
+ "$ref": "#/$defs/Expr"
425
+ },
426
+ "remember_anchor": {
427
+ "description": "A7: when `remembered` takes its value.",
428
+ "$ref": "#/$defs/RememberAnchor"
429
+ }
430
+ },
431
+ "additionalProperties": false,
432
+ "required": [
433
+ "kind",
434
+ "name"
435
+ ]
436
+ },
437
+ {
438
+ "description": "An operator: `neg` and `not` take 1 arg, every other op exactly 2.",
439
+ "type": "object",
440
+ "properties": {
441
+ "args": {
442
+ "description": "The operands.",
443
+ "type": "array",
444
+ "items": {
445
+ "$ref": "#/$defs/Expr"
446
+ }
447
+ },
448
+ "kind": {
449
+ "type": "string",
450
+ "const": "op"
451
+ },
452
+ "op": {
453
+ "description": "The operator.",
454
+ "$ref": "#/$defs/OpName"
455
+ }
456
+ },
457
+ "additionalProperties": false,
458
+ "required": [
459
+ "kind",
460
+ "op",
461
+ "args"
462
+ ]
463
+ },
464
+ {
465
+ "description": "A function.",
466
+ "type": "object",
467
+ "properties": {
468
+ "ago_secs": {
469
+ "description": "A4: `value_ago` look-back, 1..=2,592,000.",
470
+ "type": "integer",
471
+ "format": "uint32",
472
+ "maximum": 2592000,
473
+ "minimum": 1
474
+ },
475
+ "anchor": {
476
+ "description": "A3: window anchor; absent = a plain rolling window.",
477
+ "$ref": "#/$defs/FnAnchor"
478
+ },
479
+ "args": {
480
+ "description": "The arguments.",
481
+ "type": "array",
482
+ "items": {
483
+ "$ref": "#/$defs/Expr"
484
+ }
485
+ },
486
+ "fn": {
487
+ "description": "The function.",
488
+ "$ref": "#/$defs/FnName"
489
+ },
490
+ "interval_secs": {
491
+ "description": "A1: bar interval; absent = the minute grid.",
492
+ "type": "integer",
493
+ "enum": [
494
+ 3600,
495
+ 86400
496
+ ],
497
+ "maximum": 9007199254740991
498
+ },
499
+ "kind": {
500
+ "type": "string",
501
+ "const": "fn"
502
+ },
503
+ "period": {
504
+ "description": "A2: period, >= 2; required on `ema`, `rsi`, `atr`.",
505
+ "type": "integer",
506
+ "format": "uint32",
507
+ "maximum": 4294967295,
508
+ "minimum": 2
509
+ },
510
+ "window_secs": {
511
+ "description": "The window.",
512
+ "type": "integer",
513
+ "format": "uint64",
514
+ "maximum": 9007199254740991,
515
+ "minimum": 0
516
+ }
517
+ },
518
+ "additionalProperties": false,
519
+ "required": [
520
+ "kind",
521
+ "fn",
522
+ "args"
523
+ ]
524
+ }
525
+ ]
526
+ },
527
+ "FinalOutcome": {
528
+ "description": "A final state's outcome.",
529
+ "type": "string",
530
+ "enum": [
531
+ "done",
532
+ "hold"
533
+ ]
534
+ },
535
+ "FnAnchor": {
536
+ "description": "A3 window anchor.",
537
+ "type": "string",
538
+ "enum": [
539
+ "utc_midnight",
540
+ "state_entry"
541
+ ]
542
+ },
543
+ "FnName": {
544
+ "description": "Functions (the five list aggregates are reserved names, refused by\n`expr_not_supported`).",
545
+ "type": "string",
546
+ "enum": [
547
+ "sma",
548
+ "ema",
549
+ "high",
550
+ "low",
551
+ "stdev",
552
+ "pct_change",
553
+ "corr",
554
+ "value_ago",
555
+ "rsi",
556
+ "atr",
557
+ "n_of_m",
558
+ "if_else",
559
+ "count_in_state",
560
+ "sum",
561
+ "any",
562
+ "max_over",
563
+ "min_over"
564
+ ]
565
+ },
566
+ "InputName": {
567
+ "description": "Input names (`own_pnl` retired, Addendum H).",
568
+ "type": "string",
569
+ "enum": [
570
+ "balance",
571
+ "position",
572
+ "entry",
573
+ "rounds",
574
+ "wins",
575
+ "losses",
576
+ "consecutive_losses",
577
+ "last_round_pnl",
578
+ "pnl",
579
+ "high_since_state_entry",
580
+ "low_since_state_entry",
581
+ "remembered"
582
+ ]
583
+ },
584
+ "Label": {
585
+ "description": "A pin's label, as the trader saw it.",
586
+ "type": "object",
587
+ "properties": {
588
+ "ends": {
589
+ "description": "When the market ends, unix seconds.",
590
+ "type": "integer",
591
+ "format": "uint64",
592
+ "maximum": 9007199254740991,
593
+ "minimum": 0
594
+ },
595
+ "outcome": {
596
+ "description": "The outcome.",
597
+ "type": "string",
598
+ "maxLength": 256
599
+ },
600
+ "question": {
601
+ "description": "The question.",
602
+ "type": "string",
603
+ "maxLength": 256
604
+ }
605
+ },
606
+ "additionalProperties": false,
607
+ "required": [
608
+ "question",
609
+ "outcome",
610
+ "ends"
611
+ ]
612
+ },
613
+ "Level": {
614
+ "description": "A stop level's trigger price.",
615
+ "oneOf": [
616
+ {
617
+ "description": "A fixed price (E9).",
618
+ "type": "object",
619
+ "properties": {
620
+ "kind": {
621
+ "type": "string",
622
+ "const": "price"
623
+ },
624
+ "price": {
625
+ "description": "The price.",
626
+ "type": "string",
627
+ "pattern": "^(0|[1-9][0-9]*)(\\.[0-9]*[1-9])?$"
628
+ }
629
+ },
630
+ "additionalProperties": false,
631
+ "required": [
632
+ "kind",
633
+ "price"
634
+ ]
635
+ },
636
+ {
637
+ "description": "Relative to the entry: exactly one of `pct`, `distance` (P\n`one_of_violated`).",
638
+ "type": "object",
639
+ "properties": {
640
+ "distance": {
641
+ "description": "Price distance from the entry.",
642
+ "type": "string",
643
+ "pattern": "^(0|[1-9][0-9]*)(\\.[0-9]*[1-9])?$"
644
+ },
645
+ "kind": {
646
+ "type": "string",
647
+ "const": "from_entry"
648
+ },
649
+ "pct": {
650
+ "description": "Percent of the entry.",
651
+ "type": "string",
652
+ "pattern": "^(0|[1-9][0-9]*)(\\.[0-9]*[1-9])?$"
653
+ }
654
+ },
655
+ "additionalProperties": false,
656
+ "required": [
657
+ "kind"
658
+ ]
659
+ },
660
+ {
661
+ "description": "Trailing (gated `stop_trailing`).",
662
+ "type": "object",
663
+ "properties": {
664
+ "activation": {
665
+ "description": "The price that starts the trail.",
666
+ "type": "string",
667
+ "pattern": "^(0|[1-9][0-9]*)(\\.[0-9]*[1-9])?$"
668
+ },
669
+ "distance": {
670
+ "description": "Price trail.",
671
+ "type": "string",
672
+ "pattern": "^(0|[1-9][0-9]*)(\\.[0-9]*[1-9])?$"
673
+ },
674
+ "kind": {
675
+ "type": "string",
676
+ "const": "trailing"
677
+ },
678
+ "pct": {
679
+ "description": "Percent trail.",
680
+ "type": "string",
681
+ "pattern": "^(0|[1-9][0-9]*)(\\.[0-9]*[1-9])?$"
682
+ }
683
+ },
684
+ "additionalProperties": false,
685
+ "required": [
686
+ "kind"
687
+ ]
688
+ },
689
+ {
690
+ "description": "An expression level (gated `level_expr`).",
691
+ "type": "object",
692
+ "properties": {
693
+ "kind": {
694
+ "type": "string",
695
+ "const": "expr"
696
+ },
697
+ "value": {
698
+ "description": "The level.",
699
+ "$ref": "#/$defs/Expr"
700
+ }
701
+ },
702
+ "additionalProperties": false,
703
+ "required": [
704
+ "kind",
705
+ "value"
706
+ ]
707
+ }
708
+ ]
709
+ },
710
+ "ListBlock": {
711
+ "description": "A market list.",
712
+ "oneOf": [
713
+ {
714
+ "description": "A fixed list of rows.",
715
+ "type": "object",
716
+ "properties": {
717
+ "id": {
718
+ "description": "The list id.",
719
+ "$ref": "#/$defs/BlockId"
720
+ },
721
+ "kind": {
722
+ "type": "string",
723
+ "const": "fixed"
724
+ },
725
+ "members": {
726
+ "description": "The rows.",
727
+ "type": "array",
728
+ "items": {
729
+ "$ref": "#/$defs/Row"
730
+ },
731
+ "minItems": 1
732
+ },
733
+ "start": {
734
+ "description": "Each instance's start state.",
735
+ "$ref": "#/$defs/BlockId"
736
+ }
737
+ },
738
+ "additionalProperties": false,
739
+ "required": [
740
+ "kind",
741
+ "id",
742
+ "start",
743
+ "members"
744
+ ]
745
+ },
746
+ {
747
+ "description": "A filtered list (gated `list_filter`).",
748
+ "type": "object",
749
+ "properties": {
750
+ "from": {
751
+ "description": "Candidate markets; absent = every trading market.",
752
+ "type": "array",
753
+ "items": {
754
+ "type": "string",
755
+ "pattern": "^[A-Z0-9]{1,32}$"
756
+ },
757
+ "minItems": 1
758
+ },
759
+ "id": {
760
+ "description": "The list id.",
761
+ "$ref": "#/$defs/BlockId"
762
+ },
763
+ "kind": {
764
+ "type": "string",
765
+ "const": "filter"
766
+ },
767
+ "max_size": {
768
+ "description": "The size bound, >= 1.",
769
+ "type": "integer",
770
+ "format": "uint32",
771
+ "maximum": 4294967295,
772
+ "minimum": 1
773
+ },
774
+ "start": {
775
+ "description": "Each instance's start state.",
776
+ "$ref": "#/$defs/BlockId"
777
+ },
778
+ "where": {
779
+ "description": "The filter.",
780
+ "$ref": "#/$defs/Expr"
781
+ }
782
+ },
783
+ "additionalProperties": false,
784
+ "required": [
785
+ "kind",
786
+ "id",
787
+ "start",
788
+ "where",
789
+ "max_size"
790
+ ]
791
+ },
792
+ {
793
+ "description": "A ranked list (gated `list_rank`).",
794
+ "type": "object",
795
+ "properties": {
796
+ "by": {
797
+ "description": "The ranking key.",
798
+ "$ref": "#/$defs/Expr"
799
+ },
800
+ "from": {
801
+ "description": "Candidate markets; absent = every trading market.",
802
+ "type": "array",
803
+ "items": {
804
+ "type": "string",
805
+ "pattern": "^[A-Z0-9]{1,32}$"
806
+ },
807
+ "minItems": 1
808
+ },
809
+ "id": {
810
+ "description": "The list id.",
811
+ "$ref": "#/$defs/BlockId"
812
+ },
813
+ "kind": {
814
+ "type": "string",
815
+ "const": "rank"
816
+ },
817
+ "order": {
818
+ "description": "Descending or ascending.",
819
+ "$ref": "#/$defs/RankOrder"
820
+ },
821
+ "start": {
822
+ "description": "Each instance's start state.",
823
+ "$ref": "#/$defs/BlockId"
824
+ },
825
+ "top": {
826
+ "description": "How many, >= 1.",
827
+ "type": "integer",
828
+ "format": "uint32",
829
+ "maximum": 4294967295,
830
+ "minimum": 1
831
+ }
832
+ },
833
+ "additionalProperties": false,
834
+ "required": [
835
+ "kind",
836
+ "id",
837
+ "start",
838
+ "by",
839
+ "top",
840
+ "order"
841
+ ]
842
+ }
843
+ ]
844
+ },
845
+ "OnLiquidation": {
846
+ "description": "`on_liquidation`.",
847
+ "oneOf": [
848
+ {
849
+ "type": "string",
850
+ "enum": [
851
+ "close_and_end"
852
+ ]
853
+ },
854
+ {
855
+ "description": "Gated `on_liquidation_carry_on`.",
856
+ "type": "string",
857
+ "const": "carry_on"
858
+ }
859
+ ]
860
+ },
861
+ "OnMarginSkip": {
862
+ "description": "`on_margin_skip`.",
863
+ "oneOf": [
864
+ {
865
+ "type": "string",
866
+ "enum": [
867
+ "keep_running"
868
+ ]
869
+ },
870
+ {
871
+ "description": "Gated `on_margin_skip_stop`.",
872
+ "type": "string",
873
+ "const": "stop"
874
+ }
875
+ ]
876
+ },
877
+ "OpName": {
878
+ "description": "Operators.",
879
+ "type": "string",
880
+ "enum": [
881
+ "add",
882
+ "sub",
883
+ "mul",
884
+ "div",
885
+ "neg",
886
+ "gt",
887
+ "ge",
888
+ "lt",
889
+ "le",
890
+ "eq",
891
+ "ne",
892
+ "and",
893
+ "or",
894
+ "not"
895
+ ]
896
+ },
897
+ "Polymarket": {
898
+ "description": "The prediction source.",
899
+ "oneOf": [
900
+ {
901
+ "description": "`\"polymarket\"`.",
902
+ "type": "string",
903
+ "const": "polymarket"
904
+ }
905
+ ]
906
+ },
907
+ "PriceSpec": {
908
+ "oneOf": [
909
+ {
910
+ "type": "object",
911
+ "properties": {
912
+ "fixed": {
913
+ "type": "string",
914
+ "pattern": "^(0|[1-9][0-9]*)(\\.[0-9]*[1-9])?$"
915
+ }
916
+ },
917
+ "additionalProperties": false,
918
+ "required": [
919
+ "fixed"
920
+ ]
921
+ },
922
+ {
923
+ "type": "object",
924
+ "properties": {
925
+ "offset_bps": {
926
+ "type": "integer",
927
+ "maximum": 9007199254740991
928
+ }
929
+ },
930
+ "additionalProperties": false,
931
+ "required": [
932
+ "offset_bps"
933
+ ]
934
+ },
935
+ {
936
+ "type": "object",
937
+ "properties": {
938
+ "expr": {
939
+ "$ref": "#/$defs/Expr"
940
+ }
941
+ },
942
+ "additionalProperties": false,
943
+ "required": [
944
+ "expr"
945
+ ]
946
+ }
947
+ ]
948
+ },
949
+ "RankOrder": {
950
+ "description": "A rank order.",
951
+ "type": "string",
952
+ "enum": [
953
+ "desc",
954
+ "asc"
955
+ ]
956
+ },
957
+ "ReduceBy": {
958
+ "oneOf": [
959
+ {
960
+ "type": "object",
961
+ "properties": {
962
+ "rusd": {
963
+ "type": "string",
964
+ "pattern": "^(0|[1-9][0-9]*)(\\.[0-9]*[1-9])?$"
965
+ }
966
+ },
967
+ "additionalProperties": false,
968
+ "required": [
969
+ "rusd"
970
+ ]
971
+ },
972
+ {
973
+ "type": "object",
974
+ "properties": {
975
+ "qty": {
976
+ "type": "string",
977
+ "pattern": "^(0|[1-9][0-9]*)(\\.[0-9]*[1-9])?$"
978
+ }
979
+ },
980
+ "additionalProperties": false,
981
+ "required": [
982
+ "qty"
983
+ ]
984
+ },
985
+ {
986
+ "type": "object",
987
+ "properties": {
988
+ "expr": {
989
+ "$ref": "#/$defs/Expr"
990
+ }
991
+ },
992
+ "additionalProperties": false,
993
+ "required": [
994
+ "expr"
995
+ ]
996
+ },
997
+ {
998
+ "type": "object",
999
+ "properties": {
1000
+ "row": {
1001
+ "const": "size"
1002
+ }
1003
+ },
1004
+ "additionalProperties": false,
1005
+ "required": [
1006
+ "row"
1007
+ ]
1008
+ },
1009
+ {
1010
+ "type": "object",
1011
+ "properties": {
1012
+ "pct": {
1013
+ "type": "string",
1014
+ "pattern": "^(0|[1-9][0-9]*)(\\.[0-9]*[1-9])?$"
1015
+ }
1016
+ },
1017
+ "additionalProperties": false,
1018
+ "required": [
1019
+ "pct"
1020
+ ]
1021
+ }
1022
+ ]
1023
+ },
1024
+ "RememberAnchor": {
1025
+ "description": "When `remembered` takes its value.",
1026
+ "type": "string",
1027
+ "enum": [
1028
+ "start",
1029
+ "state_entry"
1030
+ ]
1031
+ },
1032
+ "RestingOrder": {
1033
+ "description": "A resting order.",
1034
+ "type": "object",
1035
+ "properties": {
1036
+ "id": {
1037
+ "description": "The order id.",
1038
+ "$ref": "#/$defs/BlockId"
1039
+ },
1040
+ "market": {
1041
+ "description": "The market; absent = the row's.",
1042
+ "type": "string",
1043
+ "pattern": "^[A-Z0-9]{1,32}$"
1044
+ },
1045
+ "price": {
1046
+ "description": "The limit price.",
1047
+ "$ref": "#/$defs/PriceSpec"
1048
+ },
1049
+ "side": {
1050
+ "description": "The side.",
1051
+ "$ref": "#/$defs/SideSpec"
1052
+ },
1053
+ "size": {
1054
+ "description": "The size.",
1055
+ "$ref": "#/$defs/Size"
1056
+ },
1057
+ "taker_ok": {
1058
+ "description": "`true` lets the order take; absent = post-only.",
1059
+ "enum": [
1060
+ true
1061
+ ]
1062
+ }
1063
+ },
1064
+ "additionalProperties": false,
1065
+ "required": [
1066
+ "id",
1067
+ "side",
1068
+ "size",
1069
+ "price"
1070
+ ]
1071
+ },
1072
+ "Row": {
1073
+ "description": "A fixed list's row.",
1074
+ "type": "object",
1075
+ "properties": {
1076
+ "id": {
1077
+ "description": "The row id.",
1078
+ "$ref": "#/$defs/BlockId"
1079
+ },
1080
+ "market": {
1081
+ "description": "The market.",
1082
+ "type": "string",
1083
+ "pattern": "^[A-Z0-9]{1,32}$"
1084
+ },
1085
+ "reads": {
1086
+ "description": "Outside series the row reads, by `row` index.",
1087
+ "type": "array",
1088
+ "items": {
1089
+ "$ref": "#/$defs/BlockId"
1090
+ },
1091
+ "maxItems": 4,
1092
+ "minItems": 1
1093
+ },
1094
+ "side": {
1095
+ "description": "The row's side (`buy` or `sell` only).",
1096
+ "$ref": "#/$defs/SideSpec"
1097
+ },
1098
+ "size": {
1099
+ "description": "The row's size.",
1100
+ "$ref": "#/$defs/Size"
1101
+ }
1102
+ },
1103
+ "additionalProperties": false,
1104
+ "required": [
1105
+ "id",
1106
+ "market"
1107
+ ]
1108
+ },
1109
+ "RowReads": {
1110
+ "description": "The constant `\"reads\"` of a row reference.",
1111
+ "oneOf": [
1112
+ {
1113
+ "description": "`\"reads\"`.",
1114
+ "type": "string",
1115
+ "const": "reads"
1116
+ }
1117
+ ]
1118
+ },
1119
+ "Rule": {
1120
+ "description": "A rule: `when` it fires, `if` it holds, `do` the actions, `go` to a\nstate.",
1121
+ "type": "object",
1122
+ "properties": {
1123
+ "do": {
1124
+ "description": "The actions.",
1125
+ "type": "array",
1126
+ "items": {
1127
+ "$ref": "#/$defs/BlockId"
1128
+ },
1129
+ "minItems": 1
1130
+ },
1131
+ "go": {
1132
+ "description": "The next state.",
1133
+ "$ref": "#/$defs/BlockId"
1134
+ },
1135
+ "if": {
1136
+ "description": "The condition.",
1137
+ "$ref": "#/$defs/Expr"
1138
+ },
1139
+ "when": {
1140
+ "description": "The trigger.",
1141
+ "$ref": "#/$defs/Trigger"
1142
+ }
1143
+ },
1144
+ "additionalProperties": false,
1145
+ "required": [
1146
+ "when",
1147
+ "go"
1148
+ ]
1149
+ },
1150
+ "SeriesName": {
1151
+ "description": "Exchange series names.",
1152
+ "type": "string",
1153
+ "enum": [
1154
+ "mark",
1155
+ "funding_rate",
1156
+ "funding_rate_avg_15m",
1157
+ "funding_paid",
1158
+ "volume",
1159
+ "open_interest",
1160
+ "spread",
1161
+ "depth",
1162
+ "trades"
1163
+ ]
1164
+ },
1165
+ "SeriesPin": {
1166
+ "description": "An outside series pin.",
1167
+ "oneOf": [
1168
+ {
1169
+ "description": "A prediction market's odds.",
1170
+ "type": "object",
1171
+ "properties": {
1172
+ "kind": {
1173
+ "type": "string",
1174
+ "const": "prediction"
1175
+ },
1176
+ "label": {
1177
+ "description": "What the trader saw.",
1178
+ "$ref": "#/$defs/Label"
1179
+ },
1180
+ "market": {
1181
+ "description": "The source's market id.",
1182
+ "type": "string",
1183
+ "maxLength": 256
1184
+ },
1185
+ "outcome": {
1186
+ "description": "The outcome tracked.",
1187
+ "type": "string",
1188
+ "maxLength": 256
1189
+ },
1190
+ "source": {
1191
+ "description": "The source.",
1192
+ "$ref": "#/$defs/Polymarket"
1193
+ }
1194
+ },
1195
+ "additionalProperties": false,
1196
+ "required": [
1197
+ "kind",
1198
+ "source",
1199
+ "market",
1200
+ "outcome",
1201
+ "label"
1202
+ ]
1203
+ }
1204
+ ]
1205
+ },
1206
+ "SideSpec": {
1207
+ "oneOf": [
1208
+ {
1209
+ "enum": [
1210
+ "buy",
1211
+ "sell"
1212
+ ]
1213
+ },
1214
+ {
1215
+ "type": "object",
1216
+ "properties": {
1217
+ "row": {
1218
+ "const": "side"
1219
+ }
1220
+ },
1221
+ "additionalProperties": false,
1222
+ "required": [
1223
+ "row"
1224
+ ]
1225
+ }
1226
+ ]
1227
+ },
1228
+ "Size": {
1229
+ "oneOf": [
1230
+ {
1231
+ "type": "object",
1232
+ "properties": {
1233
+ "rusd": {
1234
+ "type": "string",
1235
+ "pattern": "^(0|[1-9][0-9]*)(\\.[0-9]*[1-9])?$"
1236
+ }
1237
+ },
1238
+ "additionalProperties": false,
1239
+ "required": [
1240
+ "rusd"
1241
+ ]
1242
+ },
1243
+ {
1244
+ "type": "object",
1245
+ "properties": {
1246
+ "qty": {
1247
+ "type": "string",
1248
+ "pattern": "^(0|[1-9][0-9]*)(\\.[0-9]*[1-9])?$"
1249
+ }
1250
+ },
1251
+ "additionalProperties": false,
1252
+ "required": [
1253
+ "qty"
1254
+ ]
1255
+ },
1256
+ {
1257
+ "type": "object",
1258
+ "properties": {
1259
+ "expr": {
1260
+ "$ref": "#/$defs/Expr"
1261
+ }
1262
+ },
1263
+ "additionalProperties": false,
1264
+ "required": [
1265
+ "expr"
1266
+ ]
1267
+ },
1268
+ {
1269
+ "type": "object",
1270
+ "properties": {
1271
+ "row": {
1272
+ "const": "size"
1273
+ }
1274
+ },
1275
+ "additionalProperties": false,
1276
+ "required": [
1277
+ "row"
1278
+ ]
1279
+ }
1280
+ ]
1281
+ },
1282
+ "State": {
1283
+ "description": "A state.",
1284
+ "oneOf": [
1285
+ {
1286
+ "description": "A plain state.",
1287
+ "type": "object",
1288
+ "properties": {
1289
+ "in_list": {
1290
+ "description": "The list whose instances run this state.",
1291
+ "$ref": "#/$defs/BlockId"
1292
+ },
1293
+ "kind": {
1294
+ "type": "string",
1295
+ "const": "normal"
1296
+ },
1297
+ "name": {
1298
+ "description": "Display name.",
1299
+ "type": "string",
1300
+ "maxLength": 256,
1301
+ "pattern": "^[ -~]+$"
1302
+ },
1303
+ "on": {
1304
+ "description": "Rules, in priority order.",
1305
+ "type": "array",
1306
+ "items": {
1307
+ "$ref": "#/$defs/BlockId"
1308
+ },
1309
+ "minItems": 1
1310
+ }
1311
+ },
1312
+ "additionalProperties": false,
1313
+ "required": [
1314
+ "kind"
1315
+ ]
1316
+ },
1317
+ {
1318
+ "description": "A loop head; `rounds` and `then` both or neither (P).",
1319
+ "type": "object",
1320
+ "properties": {
1321
+ "in_list": {
1322
+ "description": "The list whose instances run this state.",
1323
+ "$ref": "#/$defs/BlockId"
1324
+ },
1325
+ "kind": {
1326
+ "type": "string",
1327
+ "const": "loop_head"
1328
+ },
1329
+ "name": {
1330
+ "description": "Display name.",
1331
+ "type": "string",
1332
+ "maxLength": 256,
1333
+ "pattern": "^[ -~]+$"
1334
+ },
1335
+ "on": {
1336
+ "description": "Rules, in priority order.",
1337
+ "type": "array",
1338
+ "items": {
1339
+ "$ref": "#/$defs/BlockId"
1340
+ },
1341
+ "minItems": 1
1342
+ },
1343
+ "rounds": {
1344
+ "description": "Round limit, 1..=100.",
1345
+ "type": "integer",
1346
+ "format": "uint32",
1347
+ "maximum": 9007199254740991,
1348
+ "minimum": 0
1349
+ },
1350
+ "then": {
1351
+ "description": "Where the loop goes after its last round.",
1352
+ "$ref": "#/$defs/BlockId"
1353
+ }
1354
+ },
1355
+ "additionalProperties": false,
1356
+ "required": [
1357
+ "kind"
1358
+ ]
1359
+ },
1360
+ {
1361
+ "description": "An end state.",
1362
+ "type": "object",
1363
+ "properties": {
1364
+ "in_list": {
1365
+ "description": "The list whose instances run this state.",
1366
+ "$ref": "#/$defs/BlockId"
1367
+ },
1368
+ "kind": {
1369
+ "type": "string",
1370
+ "const": "final"
1371
+ },
1372
+ "name": {
1373
+ "description": "Display name.",
1374
+ "type": "string",
1375
+ "maxLength": 256,
1376
+ "pattern": "^[ -~]+$"
1377
+ },
1378
+ "on": {
1379
+ "description": "Protective rules only.",
1380
+ "type": "array",
1381
+ "items": {
1382
+ "$ref": "#/$defs/BlockId"
1383
+ },
1384
+ "minItems": 1
1385
+ },
1386
+ "outcome": {
1387
+ "description": "`done` or `hold`.",
1388
+ "$ref": "#/$defs/FinalOutcome"
1389
+ }
1390
+ },
1391
+ "additionalProperties": false,
1392
+ "required": [
1393
+ "kind",
1394
+ "outcome"
1395
+ ]
1396
+ }
1397
+ ]
1398
+ },
1399
+ "StopLevel": {
1400
+ "description": "One stop or take-profit level.",
1401
+ "type": "object",
1402
+ "properties": {
1403
+ "at": {
1404
+ "description": "Where it triggers.",
1405
+ "$ref": "#/$defs/Level"
1406
+ },
1407
+ "id": {
1408
+ "description": "The level id.",
1409
+ "$ref": "#/$defs/BlockId"
1410
+ },
1411
+ "size": {
1412
+ "description": "How much it closes; absent = all (a sized level is gated `stop_ladder`).",
1413
+ "$ref": "#/$defs/Size"
1414
+ }
1415
+ },
1416
+ "additionalProperties": false,
1417
+ "required": [
1418
+ "id",
1419
+ "at"
1420
+ ]
1421
+ },
1422
+ "Trigger": {
1423
+ "description": "A rule's trigger.",
1424
+ "oneOf": [
1425
+ {
1426
+ "description": "When the state is entered at Start.",
1427
+ "type": "object",
1428
+ "properties": {
1429
+ "kind": {
1430
+ "type": "string",
1431
+ "const": "start"
1432
+ }
1433
+ },
1434
+ "additionalProperties": false,
1435
+ "required": [
1436
+ "kind"
1437
+ ]
1438
+ },
1439
+ {
1440
+ "description": "`value` crosses `level` in `direction`; re-arms after moving back by\n`band` (> 0; absent = 0).",
1441
+ "type": "object",
1442
+ "properties": {
1443
+ "band": {
1444
+ "description": "The re-arm band.",
1445
+ "type": "string",
1446
+ "pattern": "^(0\\.[0-9]*[1-9]|[1-9][0-9]*(\\.[0-9]*[1-9])?)$"
1447
+ },
1448
+ "direction": {
1449
+ "description": "Up or down.",
1450
+ "$ref": "#/$defs/Direction"
1451
+ },
1452
+ "kind": {
1453
+ "type": "string",
1454
+ "const": "cross"
1455
+ },
1456
+ "level": {
1457
+ "description": "The level.",
1458
+ "$ref": "#/$defs/Expr"
1459
+ },
1460
+ "value": {
1461
+ "description": "The value.",
1462
+ "$ref": "#/$defs/Expr"
1463
+ }
1464
+ },
1465
+ "additionalProperties": false,
1466
+ "required": [
1467
+ "kind",
1468
+ "value",
1469
+ "direction",
1470
+ "level"
1471
+ ]
1472
+ },
1473
+ {
1474
+ "description": "Every `period_secs`.",
1475
+ "type": "object",
1476
+ "properties": {
1477
+ "anchor": {
1478
+ "description": "The phase anchor, unix seconds.",
1479
+ "type": "integer",
1480
+ "format": "uint64",
1481
+ "maximum": 9007199254740991,
1482
+ "minimum": 0
1483
+ },
1484
+ "kind": {
1485
+ "type": "string",
1486
+ "const": "every"
1487
+ },
1488
+ "period_secs": {
1489
+ "description": "The period.",
1490
+ "type": "integer",
1491
+ "format": "uint64",
1492
+ "maximum": 9007199254740991,
1493
+ "minimum": 0
1494
+ }
1495
+ },
1496
+ "additionalProperties": false,
1497
+ "required": [
1498
+ "kind",
1499
+ "period_secs"
1500
+ ]
1501
+ },
1502
+ {
1503
+ "description": "At a time of day (UTC).",
1504
+ "type": "object",
1505
+ "properties": {
1506
+ "cadence": {
1507
+ "description": "Daily or weekly.",
1508
+ "$ref": "#/$defs/Cadence"
1509
+ },
1510
+ "day": {
1511
+ "description": "The weekday (weekly only).",
1512
+ "$ref": "#/$defs/Weekday"
1513
+ },
1514
+ "kind": {
1515
+ "type": "string",
1516
+ "const": "at"
1517
+ },
1518
+ "time": {
1519
+ "description": "`HH:MM`.",
1520
+ "type": "string"
1521
+ }
1522
+ },
1523
+ "additionalProperties": false,
1524
+ "required": [
1525
+ "kind",
1526
+ "cadence",
1527
+ "time"
1528
+ ]
1529
+ },
1530
+ {
1531
+ "description": "After `after_secs` in the state.",
1532
+ "type": "object",
1533
+ "properties": {
1534
+ "after_secs": {
1535
+ "description": "Seconds.",
1536
+ "type": "integer",
1537
+ "format": "uint64",
1538
+ "maximum": 9007199254740991,
1539
+ "minimum": 0
1540
+ },
1541
+ "kind": {
1542
+ "type": "string",
1543
+ "const": "elapsed"
1544
+ }
1545
+ },
1546
+ "additionalProperties": false,
1547
+ "required": [
1548
+ "kind",
1549
+ "after_secs"
1550
+ ]
1551
+ },
1552
+ {
1553
+ "description": "A resting order filled.",
1554
+ "type": "object",
1555
+ "properties": {
1556
+ "kind": {
1557
+ "type": "string",
1558
+ "const": "filled"
1559
+ },
1560
+ "order": {
1561
+ "description": "The order.",
1562
+ "$ref": "#/$defs/BlockId"
1563
+ }
1564
+ },
1565
+ "additionalProperties": false,
1566
+ "required": [
1567
+ "kind",
1568
+ "order"
1569
+ ]
1570
+ },
1571
+ {
1572
+ "description": "A stop loss.",
1573
+ "type": "object",
1574
+ "properties": {
1575
+ "kind": {
1576
+ "type": "string",
1577
+ "const": "stop_loss"
1578
+ },
1579
+ "levels": {
1580
+ "description": "The levels.",
1581
+ "type": "array",
1582
+ "items": {
1583
+ "$ref": "#/$defs/StopLevel"
1584
+ },
1585
+ "maxItems": 8,
1586
+ "minItems": 1
1587
+ },
1588
+ "market": {
1589
+ "description": "The market; absent = the row's.",
1590
+ "type": "string",
1591
+ "pattern": "^[A-Z0-9]{1,32}$"
1592
+ }
1593
+ },
1594
+ "additionalProperties": false,
1595
+ "required": [
1596
+ "kind",
1597
+ "levels"
1598
+ ]
1599
+ },
1600
+ {
1601
+ "description": "A take profit.",
1602
+ "type": "object",
1603
+ "properties": {
1604
+ "kind": {
1605
+ "type": "string",
1606
+ "const": "take_profit"
1607
+ },
1608
+ "levels": {
1609
+ "description": "The levels.",
1610
+ "type": "array",
1611
+ "items": {
1612
+ "$ref": "#/$defs/StopLevel"
1613
+ },
1614
+ "maxItems": 8,
1615
+ "minItems": 1
1616
+ },
1617
+ "market": {
1618
+ "description": "The market; absent = the row's.",
1619
+ "type": "string",
1620
+ "pattern": "^[A-Z0-9]{1,32}$"
1621
+ }
1622
+ },
1623
+ "additionalProperties": false,
1624
+ "required": [
1625
+ "kind",
1626
+ "levels"
1627
+ ]
1628
+ },
1629
+ {
1630
+ "description": "Every instance of a list ended.",
1631
+ "type": "object",
1632
+ "properties": {
1633
+ "kind": {
1634
+ "type": "string",
1635
+ "const": "instances_ended"
1636
+ },
1637
+ "list": {
1638
+ "description": "The list.",
1639
+ "$ref": "#/$defs/BlockId"
1640
+ }
1641
+ },
1642
+ "additionalProperties": false,
1643
+ "required": [
1644
+ "kind",
1645
+ "list"
1646
+ ]
1647
+ },
1648
+ {
1649
+ "description": "An action was refused.",
1650
+ "type": "object",
1651
+ "properties": {
1652
+ "action": {
1653
+ "description": "The action; absent = any.",
1654
+ "$ref": "#/$defs/BlockId"
1655
+ },
1656
+ "kind": {
1657
+ "type": "string",
1658
+ "const": "refused"
1659
+ }
1660
+ },
1661
+ "additionalProperties": false,
1662
+ "required": [
1663
+ "kind"
1664
+ ]
1665
+ },
1666
+ {
1667
+ "description": "The close found an open position.",
1668
+ "type": "object",
1669
+ "properties": {
1670
+ "kind": {
1671
+ "type": "string",
1672
+ "const": "close_open"
1673
+ }
1674
+ },
1675
+ "additionalProperties": false,
1676
+ "required": [
1677
+ "kind"
1678
+ ]
1679
+ },
1680
+ {
1681
+ "description": "An outside series could not be read.",
1682
+ "type": "object",
1683
+ "properties": {
1684
+ "kind": {
1685
+ "type": "string",
1686
+ "const": "source_unreadable"
1687
+ },
1688
+ "series": {
1689
+ "description": "The pin.",
1690
+ "$ref": "#/$defs/BlockId"
1691
+ }
1692
+ },
1693
+ "additionalProperties": false,
1694
+ "required": [
1695
+ "kind",
1696
+ "series"
1697
+ ]
1698
+ },
1699
+ {
1700
+ "description": "An outside series ended.",
1701
+ "type": "object",
1702
+ "properties": {
1703
+ "kind": {
1704
+ "type": "string",
1705
+ "const": "source_ended"
1706
+ },
1707
+ "series": {
1708
+ "description": "The pin.",
1709
+ "$ref": "#/$defs/BlockId"
1710
+ }
1711
+ },
1712
+ "additionalProperties": false,
1713
+ "required": [
1714
+ "kind",
1715
+ "series"
1716
+ ]
1717
+ }
1718
+ ]
1719
+ },
1720
+ "Weekday": {
1721
+ "description": "A weekday.",
1722
+ "type": "string",
1723
+ "enum": [
1724
+ "mon",
1725
+ "tue",
1726
+ "wed",
1727
+ "thu",
1728
+ "fri",
1729
+ "sat",
1730
+ "sun"
1731
+ ]
1732
+ },
1733
+ "WeightRow": {
1734
+ "description": "One weight row of a rebalance.",
1735
+ "type": "object",
1736
+ "properties": {
1737
+ "id": {
1738
+ "description": "The row id.",
1739
+ "$ref": "#/$defs/BlockId"
1740
+ },
1741
+ "if": {
1742
+ "description": "Which members it matches; absent = every member.",
1743
+ "$ref": "#/$defs/Expr"
1744
+ },
1745
+ "weight": {
1746
+ "description": "The weight, >= 0.",
1747
+ "type": "string",
1748
+ "pattern": "^(0|[1-9][0-9]*)(\\.[0-9]*[1-9])?$"
1749
+ }
1750
+ },
1751
+ "additionalProperties": false,
1752
+ "required": [
1753
+ "id",
1754
+ "weight"
1755
+ ]
1756
+ }
1757
+ }
1758
+ }