@qtsurfer/api-client 0.16.0 → 0.18.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.
- package/README.md +12 -2
- package/dist/index.d.ts +742 -21
- package/dist/index.js +123 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/generated/schemas.gen.ts +578 -7
- package/src/generated/sdk.gen.ts +355 -8
- package/src/generated/types.gen.ts +648 -12
|
@@ -445,8 +445,17 @@ export const ExchangeSchema = {
|
|
|
445
445
|
|
|
446
446
|
export const DataSourceTypeSchema = {
|
|
447
447
|
type: "string",
|
|
448
|
-
description:
|
|
449
|
-
|
|
448
|
+
description: `Managed exchange data sources available for backtesting.
|
|
449
|
+
|
|
450
|
+
* \`ticker\` — trades. Can be prepared, executed and swept.
|
|
451
|
+
* \`kline\` — aggregated bars (candlesticks). Can be prepared, executed and swept. A run reads
|
|
452
|
+
bars of the \`cadence\` the data was prepared at: you choose the bar width when you prepare,
|
|
453
|
+
and the strategy does not fix it. See \`PrepareRequest.cadence\` for the accepted values.
|
|
454
|
+
* \`funding\` — funding rates. Can be **prepared but not executed or swept yet**: a \`funding\`
|
|
455
|
+
request to \`execute\` or \`executeSweep\` is rejected with \`400\` before anything is queued,
|
|
456
|
+
and the message names the sources that can be run.
|
|
457
|
+
`,
|
|
458
|
+
enum: ["ticker", "kline", "funding"],
|
|
450
459
|
example: "ticker",
|
|
451
460
|
} as const;
|
|
452
461
|
|
|
@@ -508,9 +517,14 @@ resampling the source and stored alongside the native blob in cache. A target fi
|
|
|
508
517
|
than the source, or not an exact multiple of it, returns \`400\`. What's accepted, and
|
|
509
518
|
what omitting it means, depends on the source:
|
|
510
519
|
|
|
511
|
-
* Managed exchange — one of \`1s\`, \`5s\`, \`1m\`, \`3m\`, \`5m\`, \`15m\`,
|
|
512
|
-
\`4h\`, \`8h\`, \`12h\`, \`1d\`, \`1w\`, \`1q\`; any other label returns \`400\`.
|
|
513
|
-
the publisher's native cadence.
|
|
520
|
+
* Managed exchange, \`ticker\` or \`funding\` — one of \`1s\`, \`5s\`, \`1m\`, \`3m\`, \`5m\`, \`15m\`,
|
|
521
|
+
\`30m\`, \`1h\`, \`2h\`, \`4h\`, \`8h\`, \`12h\`, \`1d\`, \`1w\`, \`1q\`; any other label returns \`400\`.
|
|
522
|
+
Omitted = \`1s\`, the publisher's native cadence.
|
|
523
|
+
* Managed exchange, \`kline\` — one of \`1s\`, \`1m\`, \`5m\`, \`15m\`, \`30m\`, \`1h\`, \`4h\`, \`1d\`;
|
|
524
|
+
any other label, including \`5s\`, \`3m\` and \`8h\`, returns \`400\` and names the accepted
|
|
525
|
+
ones. Omitted = \`1s\`. This is the width of the bars a run reads: it is chosen here,
|
|
526
|
+
once, and the same strategy can be run at several cadences by preparing the range at
|
|
527
|
+
each.
|
|
514
528
|
* Dataset (\`exchangeId: user\`) — omitted = the dataset version's own discovered
|
|
515
529
|
\`cadence\` (see \`DatasetVersion.cadence\`), served as-is. Any cadence equal to or
|
|
516
530
|
coarser than it and an exact multiple of it is accepted, including ones outside the
|
|
@@ -1880,8 +1894,9 @@ export const EquityCurveResultSchema = {
|
|
|
1880
1894
|
|
|
1881
1895
|
export const strategyIdSchema = {
|
|
1882
1896
|
description: `Unique identifier for a compiled strategy, derived from the source itself: the same code
|
|
1883
|
-
always yields the same id, for every caller
|
|
1884
|
-
\`POST /strategy\` for exactly which rewrites preserve it and which do
|
|
1897
|
+
always yields the same id, for every caller. How much formatting the id ignores depends on
|
|
1898
|
+
the language — see \`POST /strategy\` for exactly which rewrites preserve it and which do
|
|
1899
|
+
not.
|
|
1885
1900
|
`,
|
|
1886
1901
|
type: "string",
|
|
1887
1902
|
example: "6bsh31ikwkuivhtgcoa6s4",
|
|
@@ -2770,3 +2785,559 @@ export const AuthTokenErrorSchema = {
|
|
|
2770
2785
|
},
|
|
2771
2786
|
},
|
|
2772
2787
|
} as const;
|
|
2788
|
+
|
|
2789
|
+
export const LiveSourceSchema = {
|
|
2790
|
+
type: "object",
|
|
2791
|
+
required: ["venueType", "exchange", "segment", "type", "instruments"],
|
|
2792
|
+
description:
|
|
2793
|
+
"One market feed a live run consumes. Exactly one entry per run today.",
|
|
2794
|
+
properties: {
|
|
2795
|
+
venueType: {
|
|
2796
|
+
type: "string",
|
|
2797
|
+
example: "cx",
|
|
2798
|
+
description:
|
|
2799
|
+
"Venue category. `cx` (centralized exchange) is the only one live runs support today.",
|
|
2800
|
+
},
|
|
2801
|
+
exchange: {
|
|
2802
|
+
type: "string",
|
|
2803
|
+
example: "binance",
|
|
2804
|
+
},
|
|
2805
|
+
segment: {
|
|
2806
|
+
type: "string",
|
|
2807
|
+
example: "spot",
|
|
2808
|
+
},
|
|
2809
|
+
type: {
|
|
2810
|
+
type: "string",
|
|
2811
|
+
enum: ["ticker", "kline"],
|
|
2812
|
+
description:
|
|
2813
|
+
"Both `ticker` and `kline` connect to the lightest (fastest) cadence available for the exchange — today, 1 tick/second on every supported exchange. Choosing a specific cadence is not offered yet.",
|
|
2814
|
+
},
|
|
2815
|
+
instruments: {
|
|
2816
|
+
type: "array",
|
|
2817
|
+
items: {
|
|
2818
|
+
type: "string",
|
|
2819
|
+
},
|
|
2820
|
+
example: ["BTC/USDT"],
|
|
2821
|
+
description:
|
|
2822
|
+
'Instrument symbols, or `["*"]` for every instrument the exchange/segment offers (tier-gated).',
|
|
2823
|
+
},
|
|
2824
|
+
},
|
|
2825
|
+
} as const;
|
|
2826
|
+
|
|
2827
|
+
export const StartLiveRequestSchema = {
|
|
2828
|
+
type: "object",
|
|
2829
|
+
required: ["sources"],
|
|
2830
|
+
properties: {
|
|
2831
|
+
sources: {
|
|
2832
|
+
type: "array",
|
|
2833
|
+
minItems: 1,
|
|
2834
|
+
maxItems: 1,
|
|
2835
|
+
items: {
|
|
2836
|
+
$ref: "#/components/schemas/LiveSource",
|
|
2837
|
+
},
|
|
2838
|
+
},
|
|
2839
|
+
params: {
|
|
2840
|
+
type: "object",
|
|
2841
|
+
description:
|
|
2842
|
+
"Strategy parameters to start with. Opaque key/value pairs — see this strategy's own `declaredProperties` (from `POST /strategy`) for the keys it accepts.",
|
|
2843
|
+
additionalProperties: true,
|
|
2844
|
+
},
|
|
2845
|
+
visibility: {
|
|
2846
|
+
type: "string",
|
|
2847
|
+
enum: ["private", "public"],
|
|
2848
|
+
default: "private",
|
|
2849
|
+
description:
|
|
2850
|
+
"A `public` run appears in `GET /live/public` and its signal channel accepts subscriptions from anyone, not only you.",
|
|
2851
|
+
},
|
|
2852
|
+
relay: {
|
|
2853
|
+
type: "boolean",
|
|
2854
|
+
default: false,
|
|
2855
|
+
description: `Request that this run's signals be relayed over its WebSocket channel once it reaches the \`live\` stage — see the "Live execution" guide. Has no effect while the run is still in the \`sandbox\` stage, regardless of this value.`,
|
|
2856
|
+
},
|
|
2857
|
+
name: {
|
|
2858
|
+
type: "string",
|
|
2859
|
+
},
|
|
2860
|
+
description: {
|
|
2861
|
+
type: "string",
|
|
2862
|
+
},
|
|
2863
|
+
},
|
|
2864
|
+
} as const;
|
|
2865
|
+
|
|
2866
|
+
export const UpdateLiveRequestSchema = {
|
|
2867
|
+
type: "object",
|
|
2868
|
+
properties: {
|
|
2869
|
+
visibility: {
|
|
2870
|
+
type: "string",
|
|
2871
|
+
enum: ["private", "public"],
|
|
2872
|
+
},
|
|
2873
|
+
name: {
|
|
2874
|
+
type: "string",
|
|
2875
|
+
},
|
|
2876
|
+
description: {
|
|
2877
|
+
type: "string",
|
|
2878
|
+
},
|
|
2879
|
+
},
|
|
2880
|
+
} as const;
|
|
2881
|
+
|
|
2882
|
+
export const UpdateLiveParamsRequestSchema = {
|
|
2883
|
+
type: "object",
|
|
2884
|
+
required: ["params"],
|
|
2885
|
+
properties: {
|
|
2886
|
+
params: {
|
|
2887
|
+
type: "object",
|
|
2888
|
+
additionalProperties: true,
|
|
2889
|
+
description:
|
|
2890
|
+
"Must be non-empty; every key must be a property your strategy declares.",
|
|
2891
|
+
},
|
|
2892
|
+
},
|
|
2893
|
+
} as const;
|
|
2894
|
+
|
|
2895
|
+
export const LiveRunSchema = {
|
|
2896
|
+
type: "object",
|
|
2897
|
+
required: [
|
|
2898
|
+
"strategyId",
|
|
2899
|
+
"runId",
|
|
2900
|
+
"visibility",
|
|
2901
|
+
"stage",
|
|
2902
|
+
"state",
|
|
2903
|
+
"desired",
|
|
2904
|
+
"sources",
|
|
2905
|
+
"params",
|
|
2906
|
+
"paramsVersion",
|
|
2907
|
+
"relay",
|
|
2908
|
+
"startedAtMs",
|
|
2909
|
+
],
|
|
2910
|
+
description:
|
|
2911
|
+
"A live run's full state, as returned by starting, reading, or stopping it through its strategy.",
|
|
2912
|
+
properties: {
|
|
2913
|
+
strategyId: {
|
|
2914
|
+
$ref: "#/components/schemas/strategyId",
|
|
2915
|
+
},
|
|
2916
|
+
runId: {
|
|
2917
|
+
type: "string",
|
|
2918
|
+
description:
|
|
2919
|
+
"This run's own id — its canonical identity for `PATCH`/`PUT .../params` and for `GET /live/public`.",
|
|
2920
|
+
},
|
|
2921
|
+
name: {
|
|
2922
|
+
type: "string",
|
|
2923
|
+
},
|
|
2924
|
+
description: {
|
|
2925
|
+
type: "string",
|
|
2926
|
+
},
|
|
2927
|
+
visibility: {
|
|
2928
|
+
type: "string",
|
|
2929
|
+
enum: ["private", "public"],
|
|
2930
|
+
},
|
|
2931
|
+
stage: {
|
|
2932
|
+
type: "string",
|
|
2933
|
+
enum: ["SANDBOX", "LIVE"],
|
|
2934
|
+
description:
|
|
2935
|
+
"A new run always starts `SANDBOX` — a trial run compared against a second execution for agreement — and moves to `LIVE` once it passes.",
|
|
2936
|
+
},
|
|
2937
|
+
state: {
|
|
2938
|
+
type: "string",
|
|
2939
|
+
description: `\`STARTING\` until first observed running; otherwise the runner's own reported state (e.g. \`RUNNING\`).`,
|
|
2940
|
+
},
|
|
2941
|
+
desired: {
|
|
2942
|
+
type: "string",
|
|
2943
|
+
enum: ["RUNNING", "STOPPED"],
|
|
2944
|
+
description:
|
|
2945
|
+
"What you last asked for. `state` can lag this briefly after `DELETE`.",
|
|
2946
|
+
},
|
|
2947
|
+
reason: {
|
|
2948
|
+
type: "string",
|
|
2949
|
+
description:
|
|
2950
|
+
"Present only when the run stopped because it exceeded its resource allowance.",
|
|
2951
|
+
},
|
|
2952
|
+
sources: {
|
|
2953
|
+
type: "array",
|
|
2954
|
+
items: {
|
|
2955
|
+
$ref: "#/components/schemas/LiveSource",
|
|
2956
|
+
},
|
|
2957
|
+
},
|
|
2958
|
+
params: {
|
|
2959
|
+
type: "object",
|
|
2960
|
+
additionalProperties: true,
|
|
2961
|
+
},
|
|
2962
|
+
paramsVersion: {
|
|
2963
|
+
type: "integer",
|
|
2964
|
+
description:
|
|
2965
|
+
"Increments on every accepted `PUT .../params` call, including one that resends the current values.",
|
|
2966
|
+
},
|
|
2967
|
+
relay: {
|
|
2968
|
+
type: "boolean",
|
|
2969
|
+
description: `Whether this run's signals are being relayed over the WebSocket channel described in the "Live execution" guide, right now. This is the effective value — \`false\` on a \`sandbox\` run regardless of what was requested at start; matches the requested value once \`stage\` reaches \`live\`.`,
|
|
2970
|
+
},
|
|
2971
|
+
startedAtMs: {
|
|
2972
|
+
type: "integer",
|
|
2973
|
+
format: "int64",
|
|
2974
|
+
description: "Epoch milliseconds.",
|
|
2975
|
+
},
|
|
2976
|
+
gate: {
|
|
2977
|
+
type: "object",
|
|
2978
|
+
additionalProperties: true,
|
|
2979
|
+
description:
|
|
2980
|
+
"The sandbox trial's promotion verdict, once one exists. Shape is not yet stabilized as public API — treat as opaque diagnostics.",
|
|
2981
|
+
},
|
|
2982
|
+
},
|
|
2983
|
+
} as const;
|
|
2984
|
+
|
|
2985
|
+
export const LiveRunCompactSchema = {
|
|
2986
|
+
type: "object",
|
|
2987
|
+
required: ["runId", "visibility", "stage", "state", "sources"],
|
|
2988
|
+
description:
|
|
2989
|
+
"A run's state as returned by `PATCH /live/{runId}` — narrower than `LiveRun` (no `strategyId`, `params`, or `desired`), since this endpoint is addressed by `runId` alone.",
|
|
2990
|
+
properties: {
|
|
2991
|
+
runId: {
|
|
2992
|
+
type: "string",
|
|
2993
|
+
},
|
|
2994
|
+
name: {
|
|
2995
|
+
type: "string",
|
|
2996
|
+
},
|
|
2997
|
+
description: {
|
|
2998
|
+
type: "string",
|
|
2999
|
+
},
|
|
3000
|
+
visibility: {
|
|
3001
|
+
type: "string",
|
|
3002
|
+
enum: ["private", "public"],
|
|
3003
|
+
},
|
|
3004
|
+
stage: {
|
|
3005
|
+
type: "string",
|
|
3006
|
+
enum: ["SANDBOX", "LIVE"],
|
|
3007
|
+
},
|
|
3008
|
+
state: {
|
|
3009
|
+
type: "string",
|
|
3010
|
+
},
|
|
3011
|
+
sources: {
|
|
3012
|
+
type: "array",
|
|
3013
|
+
items: {
|
|
3014
|
+
$ref: "#/components/schemas/LiveSource",
|
|
3015
|
+
},
|
|
3016
|
+
},
|
|
3017
|
+
},
|
|
3018
|
+
} as const;
|
|
3019
|
+
|
|
3020
|
+
export const LiveRunSummarySchema = {
|
|
3021
|
+
type: "object",
|
|
3022
|
+
required: [
|
|
3023
|
+
"strategyId",
|
|
3024
|
+
"runId",
|
|
3025
|
+
"visibility",
|
|
3026
|
+
"stage",
|
|
3027
|
+
"state",
|
|
3028
|
+
"desired",
|
|
3029
|
+
"sources",
|
|
3030
|
+
"createdAtMs",
|
|
3031
|
+
"startedAtMs",
|
|
3032
|
+
],
|
|
3033
|
+
description:
|
|
3034
|
+
"A run as it appears in `GET /live` — one of your own, narrower than `LiveRun` (no `params`, `paramsVersion`, `relay`, or `gate`), since listing stays cheap regardless of how many runs you have. Check a specific run's full state with `GET /strategy/{strategyId}/live`.",
|
|
3035
|
+
properties: {
|
|
3036
|
+
strategyId: {
|
|
3037
|
+
$ref: "#/components/schemas/strategyId",
|
|
3038
|
+
},
|
|
3039
|
+
runId: {
|
|
3040
|
+
type: "string",
|
|
3041
|
+
description:
|
|
3042
|
+
"This run's own id — its canonical identity for `PATCH`/`PUT .../params` and for `GET /live/public`.",
|
|
3043
|
+
},
|
|
3044
|
+
name: {
|
|
3045
|
+
type: "string",
|
|
3046
|
+
},
|
|
3047
|
+
description: {
|
|
3048
|
+
type: "string",
|
|
3049
|
+
},
|
|
3050
|
+
visibility: {
|
|
3051
|
+
type: "string",
|
|
3052
|
+
enum: ["private", "public"],
|
|
3053
|
+
},
|
|
3054
|
+
stage: {
|
|
3055
|
+
type: "string",
|
|
3056
|
+
enum: ["SANDBOX", "LIVE"],
|
|
3057
|
+
description:
|
|
3058
|
+
"A new run always starts `SANDBOX` — a trial run compared against a second execution for agreement — and moves to `LIVE` once it passes.",
|
|
3059
|
+
},
|
|
3060
|
+
state: {
|
|
3061
|
+
type: "string",
|
|
3062
|
+
description: `\`STARTING\` until first observed running; otherwise the runner's own reported state (e.g. \`RUNNING\`).`,
|
|
3063
|
+
},
|
|
3064
|
+
desired: {
|
|
3065
|
+
type: "string",
|
|
3066
|
+
enum: ["RUNNING", "STOPPED"],
|
|
3067
|
+
description:
|
|
3068
|
+
"What you last asked for. `state` can lag this briefly after `DELETE`.",
|
|
3069
|
+
},
|
|
3070
|
+
sources: {
|
|
3071
|
+
type: "array",
|
|
3072
|
+
items: {
|
|
3073
|
+
$ref: "#/components/schemas/LiveSource",
|
|
3074
|
+
},
|
|
3075
|
+
},
|
|
3076
|
+
createdAtMs: {
|
|
3077
|
+
type: "integer",
|
|
3078
|
+
format: "int64",
|
|
3079
|
+
description: "Epoch milliseconds this run was started.",
|
|
3080
|
+
},
|
|
3081
|
+
startedAtMs: {
|
|
3082
|
+
type: "integer",
|
|
3083
|
+
format: "int64",
|
|
3084
|
+
description: "Epoch milliseconds.",
|
|
3085
|
+
},
|
|
3086
|
+
},
|
|
3087
|
+
} as const;
|
|
3088
|
+
|
|
3089
|
+
export const LiveListResponseSchema = {
|
|
3090
|
+
type: "object",
|
|
3091
|
+
required: ["runs"],
|
|
3092
|
+
properties: {
|
|
3093
|
+
runs: {
|
|
3094
|
+
type: "array",
|
|
3095
|
+
items: {
|
|
3096
|
+
$ref: "#/components/schemas/LiveRunSummary",
|
|
3097
|
+
},
|
|
3098
|
+
},
|
|
3099
|
+
_links: {
|
|
3100
|
+
$ref: "#/components/schemas/PublicLiveListLinks",
|
|
3101
|
+
},
|
|
3102
|
+
},
|
|
3103
|
+
} as const;
|
|
3104
|
+
|
|
3105
|
+
export const PublicLiveRunSchema = {
|
|
3106
|
+
type: "object",
|
|
3107
|
+
required: ["runId", "sources", "state", "createdAtMs"],
|
|
3108
|
+
description:
|
|
3109
|
+
"A run as it appears in `GET /live/public` — never reveals who owns it or which strategy it runs.",
|
|
3110
|
+
properties: {
|
|
3111
|
+
runId: {
|
|
3112
|
+
type: "string",
|
|
3113
|
+
},
|
|
3114
|
+
name: {
|
|
3115
|
+
type: "string",
|
|
3116
|
+
},
|
|
3117
|
+
description: {
|
|
3118
|
+
type: "string",
|
|
3119
|
+
},
|
|
3120
|
+
sources: {
|
|
3121
|
+
type: "array",
|
|
3122
|
+
items: {
|
|
3123
|
+
$ref: "#/components/schemas/LiveSource",
|
|
3124
|
+
},
|
|
3125
|
+
},
|
|
3126
|
+
state: {
|
|
3127
|
+
type: "string",
|
|
3128
|
+
},
|
|
3129
|
+
createdAtMs: {
|
|
3130
|
+
type: "integer",
|
|
3131
|
+
format: "int64",
|
|
3132
|
+
},
|
|
3133
|
+
},
|
|
3134
|
+
} as const;
|
|
3135
|
+
|
|
3136
|
+
export const PublicLiveListResponseSchema = {
|
|
3137
|
+
type: "object",
|
|
3138
|
+
required: ["runs"],
|
|
3139
|
+
properties: {
|
|
3140
|
+
runs: {
|
|
3141
|
+
type: "array",
|
|
3142
|
+
items: {
|
|
3143
|
+
$ref: "#/components/schemas/PublicLiveRun",
|
|
3144
|
+
},
|
|
3145
|
+
},
|
|
3146
|
+
_links: {
|
|
3147
|
+
$ref: "#/components/schemas/PublicLiveListLinks",
|
|
3148
|
+
},
|
|
3149
|
+
},
|
|
3150
|
+
} as const;
|
|
3151
|
+
|
|
3152
|
+
export const PublicLiveListLinksSchema = {
|
|
3153
|
+
type: "object",
|
|
3154
|
+
description: "Present only when another page exists.",
|
|
3155
|
+
properties: {
|
|
3156
|
+
next: {
|
|
3157
|
+
$ref: "#/components/schemas/PublicLiveNextLink",
|
|
3158
|
+
},
|
|
3159
|
+
},
|
|
3160
|
+
} as const;
|
|
3161
|
+
|
|
3162
|
+
export const PublicLiveNextLinkSchema = {
|
|
3163
|
+
type: "object",
|
|
3164
|
+
properties: {
|
|
3165
|
+
href: {
|
|
3166
|
+
type: "string",
|
|
3167
|
+
},
|
|
3168
|
+
},
|
|
3169
|
+
} as const;
|
|
3170
|
+
|
|
3171
|
+
export const LiveSignalPageSchema = {
|
|
3172
|
+
type: "object",
|
|
3173
|
+
required: ["signals"],
|
|
3174
|
+
description: "One page of a run's recorded signals, oldest first.",
|
|
3175
|
+
properties: {
|
|
3176
|
+
signals: {
|
|
3177
|
+
type: "array",
|
|
3178
|
+
items: {
|
|
3179
|
+
$ref: "#/components/schemas/LiveSignal",
|
|
3180
|
+
},
|
|
3181
|
+
},
|
|
3182
|
+
availableSinceMs: {
|
|
3183
|
+
type: "integer",
|
|
3184
|
+
format: "int64",
|
|
3185
|
+
description:
|
|
3186
|
+
"The oldest moment this run's signals can still be read from. Absent when the run has produced nothing yet. It moves forward over time as older signals are discarded, so a `sinceMs` earlier than this is served from here instead.",
|
|
3187
|
+
},
|
|
3188
|
+
_links: {
|
|
3189
|
+
$ref: "#/components/schemas/PublicLiveListLinks",
|
|
3190
|
+
},
|
|
3191
|
+
},
|
|
3192
|
+
} as const;
|
|
3193
|
+
|
|
3194
|
+
export const LiveSignalSchema = {
|
|
3195
|
+
type: "object",
|
|
3196
|
+
required: [
|
|
3197
|
+
"v",
|
|
3198
|
+
"signalId",
|
|
3199
|
+
"runId",
|
|
3200
|
+
"stage",
|
|
3201
|
+
"type",
|
|
3202
|
+
"eventTsMs",
|
|
3203
|
+
"emittedAtMs",
|
|
3204
|
+
"instrument",
|
|
3205
|
+
"digest",
|
|
3206
|
+
],
|
|
3207
|
+
description:
|
|
3208
|
+
"One signal, in the same shape the real-time signal channel delivers.",
|
|
3209
|
+
properties: {
|
|
3210
|
+
v: {
|
|
3211
|
+
type: "integer",
|
|
3212
|
+
description: "Envelope schema version.",
|
|
3213
|
+
},
|
|
3214
|
+
signalId: {
|
|
3215
|
+
type: "string",
|
|
3216
|
+
description:
|
|
3217
|
+
"Stable id for this exact signal — dedupe on it across reconnects or overlapping reads.",
|
|
3218
|
+
},
|
|
3219
|
+
runId: {
|
|
3220
|
+
type: "string",
|
|
3221
|
+
},
|
|
3222
|
+
stage: {
|
|
3223
|
+
type: "string",
|
|
3224
|
+
enum: ["sandbox", "live"],
|
|
3225
|
+
description: "The stage the run was in when this signal was produced.",
|
|
3226
|
+
},
|
|
3227
|
+
paramsVersion: {
|
|
3228
|
+
type: "integer",
|
|
3229
|
+
description: "The parameter set in force when this signal was produced.",
|
|
3230
|
+
},
|
|
3231
|
+
type: {
|
|
3232
|
+
type: "string",
|
|
3233
|
+
enum: ["hint", "info", "marker", "command"],
|
|
3234
|
+
},
|
|
3235
|
+
kind: {
|
|
3236
|
+
type: ["string", "null"],
|
|
3237
|
+
description: `\`BUY\`/\`SELL\` for a \`hint\`, the command name for a \`command\`, absent otherwise.`,
|
|
3238
|
+
},
|
|
3239
|
+
eventTsMs: {
|
|
3240
|
+
type: "integer",
|
|
3241
|
+
format: "int64",
|
|
3242
|
+
description: "Market time the signal was produced.",
|
|
3243
|
+
},
|
|
3244
|
+
emittedAtMs: {
|
|
3245
|
+
type: "integer",
|
|
3246
|
+
format: "int64",
|
|
3247
|
+
description: "Time it was published — always at or after `eventTsMs`.",
|
|
3248
|
+
},
|
|
3249
|
+
instrument: {
|
|
3250
|
+
$ref: "#/components/schemas/LiveSignalInstrument",
|
|
3251
|
+
},
|
|
3252
|
+
order: {
|
|
3253
|
+
$ref: "#/components/schemas/LiveSignalOrder",
|
|
3254
|
+
},
|
|
3255
|
+
data: {
|
|
3256
|
+
type: "object",
|
|
3257
|
+
additionalProperties: true,
|
|
3258
|
+
description: "The signal's own free-form payload.",
|
|
3259
|
+
},
|
|
3260
|
+
regenerated: {
|
|
3261
|
+
type: "boolean",
|
|
3262
|
+
description: `\`true\` only for a signal republished to fill a gap in the record.`,
|
|
3263
|
+
},
|
|
3264
|
+
digest: {
|
|
3265
|
+
type: "string",
|
|
3266
|
+
description:
|
|
3267
|
+
"Content hash, for checking that two independent deliveries of the same signal agree.",
|
|
3268
|
+
},
|
|
3269
|
+
},
|
|
3270
|
+
} as const;
|
|
3271
|
+
|
|
3272
|
+
export const LiveSignalInstrumentSchema = {
|
|
3273
|
+
type: "object",
|
|
3274
|
+
properties: {
|
|
3275
|
+
exchange: {
|
|
3276
|
+
type: "string",
|
|
3277
|
+
},
|
|
3278
|
+
segment: {
|
|
3279
|
+
type: "string",
|
|
3280
|
+
},
|
|
3281
|
+
symbol: {
|
|
3282
|
+
type: "string",
|
|
3283
|
+
description: "Slashed form, e.g. `BTC/USDT`.",
|
|
3284
|
+
},
|
|
3285
|
+
},
|
|
3286
|
+
} as const;
|
|
3287
|
+
|
|
3288
|
+
export const LiveSignalOrderSchema = {
|
|
3289
|
+
type: ["object", "null"],
|
|
3290
|
+
description: "Present only for a `hint`.",
|
|
3291
|
+
properties: {
|
|
3292
|
+
orderKind: {
|
|
3293
|
+
type: "string",
|
|
3294
|
+
},
|
|
3295
|
+
price: {
|
|
3296
|
+
type: ["string", "null"],
|
|
3297
|
+
},
|
|
3298
|
+
amount: {
|
|
3299
|
+
type: ["string", "null"],
|
|
3300
|
+
},
|
|
3301
|
+
stopPrice: {
|
|
3302
|
+
type: ["string", "null"],
|
|
3303
|
+
},
|
|
3304
|
+
trailPct: {
|
|
3305
|
+
type: ["string", "null"],
|
|
3306
|
+
},
|
|
3307
|
+
},
|
|
3308
|
+
} as const;
|
|
3309
|
+
|
|
3310
|
+
export const LiveConnectionTokenSchema = {
|
|
3311
|
+
type: "object",
|
|
3312
|
+
required: ["token", "expiresAtMs"],
|
|
3313
|
+
properties: {
|
|
3314
|
+
token: {
|
|
3315
|
+
type: "string",
|
|
3316
|
+
description:
|
|
3317
|
+
'Pass as the `token` field of the WebSocket `connect` command — see the "Live execution" guide.',
|
|
3318
|
+
},
|
|
3319
|
+
expiresAtMs: {
|
|
3320
|
+
type: "integer",
|
|
3321
|
+
format: "int64",
|
|
3322
|
+
},
|
|
3323
|
+
},
|
|
3324
|
+
} as const;
|
|
3325
|
+
|
|
3326
|
+
export const LiveParamsUpdateResultSchema = {
|
|
3327
|
+
type: "object",
|
|
3328
|
+
required: ["runId", "paramsVersion", "effectiveAtMs"],
|
|
3329
|
+
properties: {
|
|
3330
|
+
runId: {
|
|
3331
|
+
type: "string",
|
|
3332
|
+
},
|
|
3333
|
+
paramsVersion: {
|
|
3334
|
+
type: "integer",
|
|
3335
|
+
},
|
|
3336
|
+
effectiveAtMs: {
|
|
3337
|
+
type: "integer",
|
|
3338
|
+
format: "int64",
|
|
3339
|
+
description:
|
|
3340
|
+
"Epoch milliseconds — the earliest moment the new values are guaranteed to be in effect.",
|
|
3341
|
+
},
|
|
3342
|
+
},
|
|
3343
|
+
} as const;
|