@orangecharts/wrun-chart-host 0.8.0 → 0.9.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 +2 -1
- package/dist/constants/feature-flags.constants.d.ts +4 -0
- package/dist/constants/feature-flags.constants.js +27 -0
- package/dist/constants/marketCapabilities.constants.d.ts +14 -9
- package/dist/constants/marketCapabilities.constants.js +36 -13
- package/dist/constants/opra-compliance.constants.d.ts +14 -0
- package/dist/constants/opra-compliance.constants.js +14 -0
- package/dist/constants/option-venues.constants.d.ts +11 -6
- package/dist/constants/option-venues.constants.js +5 -2
- package/dist/host-env.d.ts +10 -4
- package/dist/host-ports.types.d.ts +39 -3
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/interfaces/opra-realtime.interface.d.ts +13 -11
- package/dist/interfaces/opra-realtime.interface.js +10 -10
- package/dist/interfaces/wrun-runtime.interface.d.ts +34 -13
- package/dist/kscript-data/controls/live-trades-merge.util.d.ts +53 -10
- package/dist/kscript-data/controls/live-trades-merge.util.js +81 -16
- package/dist/market-data/billing.interface.d.ts +138 -17
- package/dist/market-data/billing.interface.js +25 -8
- package/dist/market-data/venues/index.d.ts +3 -3
- package/dist/market-data/venues/opra.contract.copy.json +5 -3
- package/dist/market-data/venues/opra.d.ts +3 -3
- package/dist/market-data/venues/opra.js +5 -4
- package/dist/replay/replayLadder.js +3 -1
- package/dist/utility/chart/crypto-index.leaf.d.ts +2 -2
- package/dist/utility/chart/crypto-index.leaf.js +2 -2
- package/dist/utility/chart/index-mode-admission.util.js +9 -1
- package/dist/utility/chart/index-mode.util.d.ts +5 -2
- package/dist/utility/chart/index-mode.util.js +23 -13
- package/dist/utility/chart/kscript-venue-policy.util.d.ts +28 -21
- package/dist/utility/chart/kscript-venue-policy.util.js +30 -24
- package/dist/utility/chart/marketKind.util.d.ts +12 -10
- package/dist/utility/chart/marketKind.util.js +17 -7
- package/dist/utility/chart/om-panel-push-style.util.d.ts +7 -7
- package/dist/utility/chart/om-panel-push-style.util.js +17 -15
- package/dist/utility/chart/om-panel.util.js +6 -6
- package/dist/utility/chart/profile-block-size.util.d.ts +16 -0
- package/dist/utility/chart/profile-block-size.util.js +7 -0
- package/dist/utility/chart/quote-perp.leaf.d.ts +17 -0
- package/dist/utility/chart/quote-perp.leaf.js +20 -0
- package/dist/utility/chart/wrun-run-result.util.d.ts +5 -0
- package/dist/utility/chart/wrun-run-result.util.js +4 -1
- package/dist/utility/common/transformations.util.d.ts +7 -0
- package/dist/utility/common/transformations.util.js +11 -0
- package/dist/utility/options/option-venue.util.d.ts +3 -3
- package/dist/utility/options/option-venue.util.js +3 -3
- package/dist/utility/wrun/run-schedule/wrun-late-reads.util.d.ts +1 -1
- package/dist/utility/wrun/run-schedule/wrun-late-reads.util.js +2 -2
- package/dist/utility/wrun/run-schedule/wrun-prefix-feeds.util.d.ts +2 -2
- package/dist/utility/wrun/run-schedule/wrun-prefix-feeds.util.js +5 -1
- package/dist/utility/wrun/sources/row-lane-registry.js +3 -2
- package/dist/utility/wrun/sources/row-lanes/option_contract_state.d.ts +9 -3
- package/dist/utility/wrun/sources/row-lanes/option_contract_state.js +13 -5
- package/dist/utility/wrun/sources/row-lanes/option_prints.d.ts +11 -0
- package/dist/utility/wrun/sources/row-lanes/option_prints.js +63 -9
- package/dist/utility/wrun/sources/row-lanes/option_strikes.d.ts +8 -0
- package/dist/utility/wrun/sources/row-lanes/option_strikes.js +12 -0
- package/dist/utility/wrun/sources/row-lanes/option_surface.d.ts +5 -2
- package/dist/utility/wrun/sources/row-lanes/option_surface.js +5 -2
- package/dist/utility/wrun/sources/wrun-poll-lanes.util.d.ts +11 -5
- package/dist/utility/wrun/sources/wrun-poll-lanes.util.js +31 -10
- package/dist/utility/wrun/sources/wrun-row-lane-first-paint.util.d.ts +33 -1
- package/dist/utility/wrun/sources/wrun-row-lane-first-paint.util.js +95 -6
- package/dist/utility/wrun/sources/wrun-row-lane.types.d.ts +25 -5
- package/dist/utility/wrun/sources/wrun-row-lanes.util.d.ts +55 -18
- package/dist/utility/wrun/sources/wrun-row-lanes.util.js +146 -40
- package/dist/utility/wrun/wrun-batched-marks.util.d.ts +16 -3
- package/dist/utility/wrun/wrun-batched-marks.util.js +30 -19
- package/dist/utility/wrun/wrun-batched-readout.util.d.ts +37 -9
- package/dist/utility/wrun/wrun-batched-readout.util.js +61 -15
- package/dist/utility/wrun/wrun-canvas-readout.util.d.ts +4 -0
- package/dist/utility/wrun/wrun-cell-capacity.leaf.d.ts +66 -0
- package/dist/utility/wrun/wrun-cell-capacity.leaf.js +86 -0
- package/dist/utility/wrun/wrun-chart-market-facts.util.d.ts +147 -9
- package/dist/utility/wrun/wrun-chart-market-facts.util.js +345 -11
- package/dist/utility/wrun/wrun-color-facts.util.d.ts +19 -9
- package/dist/utility/wrun/wrun-color-facts.util.js +24 -14
- package/dist/utility/wrun/wrun-color-settings.util.d.ts +15 -4
- package/dist/utility/wrun/wrun-color-settings.util.js +31 -12
- package/dist/utility/wrun/wrun-dollar-unit-port.leaf.d.ts +17 -0
- package/dist/utility/wrun/wrun-dollar-unit-port.leaf.js +9 -0
- package/dist/utility/wrun/wrun-download-meter.util.d.ts +92 -0
- package/dist/utility/wrun/wrun-download-meter.util.js +122 -0
- package/dist/utility/wrun/wrun-draft-overlay.util.d.ts +6 -1
- package/dist/utility/wrun/wrun-draft-overlay.util.js +23 -3
- package/dist/utility/wrun/wrun-frames.js +5 -5
- package/dist/utility/wrun/wrun-hosted-wire-caps.d.ts +2 -2
- package/dist/utility/wrun/wrun-hosted-wire-caps.js +7 -0
- package/dist/utility/wrun/wrun-hud-looks.util.d.ts +33 -17
- package/dist/utility/wrun/wrun-hud-looks.util.js +30 -16
- package/dist/utility/wrun/wrun-lifecycle-runtime.util.d.ts +8 -6
- package/dist/utility/wrun/wrun-lifecycle-runtime.util.js +8 -6
- package/dist/utility/wrun/wrun-lifecycle.contract.d.ts +4 -2
- package/dist/utility/wrun/wrun-live-intake.util.d.ts +6 -2
- package/dist/utility/wrun/wrun-live-intake.util.js +136 -21
- package/dist/utility/wrun/wrun-live-tick.util.js +91 -38
- package/dist/utility/wrun/wrun-market-size-contract-carry.leaf.d.ts +53 -0
- package/dist/utility/wrun/wrun-market-size-contract-carry.leaf.js +162 -0
- package/dist/utility/wrun/wrun-market-size-defaults.leaf.d.ts +166 -48
- package/dist/utility/wrun/wrun-market-size-defaults.leaf.js +216 -33
- package/dist/utility/wrun/wrun-market-size-defaults.util.d.ts +51 -7
- package/dist/utility/wrun/wrun-market-size-defaults.util.js +314 -56
- package/dist/utility/wrun/wrun-option-prints.util.d.ts +41 -2
- package/dist/utility/wrun/wrun-option-prints.util.js +80 -13
- package/dist/utility/wrun/wrun-option-strike-flow-lane.util.d.ts +3 -0
- package/dist/utility/wrun/wrun-option-strike-flow-lane.util.js +3 -0
- package/dist/utility/wrun/wrun-option-strike-flow.util.d.ts +23 -0
- package/dist/utility/wrun/wrun-option-strike-flow.util.js +55 -0
- package/dist/utility/wrun/wrun-option-views.util.d.ts +51 -7
- package/dist/utility/wrun/wrun-option-views.util.js +151 -28
- package/dist/utility/wrun/wrun-options-stop.util.d.ts +2 -1
- package/dist/utility/wrun/wrun-options-stop.util.js +3 -2
- package/dist/utility/wrun/wrun-overlay-drivers.util.d.ts +3 -0
- package/dist/utility/wrun/wrun-overlay-lifecycle.lazy.d.ts +31 -14
- package/dist/utility/wrun/wrun-overlay-lifecycle.lazy.js +22 -0
- package/dist/utility/wrun/wrun-overlay-recovery.util.d.ts +7 -0
- package/dist/utility/wrun/wrun-overlay-recovery.util.js +25 -1
- package/dist/utility/wrun/wrun-overlay-result.util.d.ts +7 -1
- package/dist/utility/wrun/wrun-overlay-result.util.js +2 -0
- package/dist/utility/wrun/wrun-overlay-run.util.d.ts +34 -6
- package/dist/utility/wrun/wrun-overlay-run.util.js +416 -171
- package/dist/utility/wrun/wrun-pack-widths.leaf.d.ts +4 -4
- package/dist/utility/wrun/wrun-pack-widths.leaf.js +4 -4
- package/dist/utility/wrun/wrun-pack.util.d.ts +7 -3
- package/dist/utility/wrun/wrun-pack.util.js +20 -9
- package/dist/utility/wrun/wrun-panel-style.util.d.ts +27 -15
- package/dist/utility/wrun/wrun-panel-style.util.js +42 -20
- package/dist/utility/wrun/wrun-param-map.util.d.ts +7 -6
- package/dist/utility/wrun/wrun-param-map.util.js +8 -5
- package/dist/utility/wrun/wrun-param-values.util.d.ts +10 -2
- package/dist/utility/wrun/wrun-param-values.util.js +2 -0
- package/dist/utility/wrun/wrun-prefix-lanes.util.js +2 -2
- package/dist/utility/wrun/wrun-refusal.util.js +10 -1
- package/dist/utility/wrun/wrun-script-inputs.util.d.ts +7 -0
- package/dist/utility/wrun/wrun-source-rows.util.d.ts +4 -0
- package/dist/utility/wrun/wrun-source-rows.util.js +92 -40
- package/dist/utility/wrun/wrun-tape-source.util.d.ts +126 -50
- package/dist/utility/wrun/wrun-tape-source.util.js +193 -68
- package/dist/utility/wrun/wrun-volume-profile-lane.util.d.ts +7 -5
- package/dist/utility/wrun/wrun-volume-profile-lane.util.js +8 -6
- package/dist/workers/utils/volume-profile.worker.util.d.ts +4 -1
- package/dist/workers/utils/volume-profile.worker.util.js +5 -2
- package/dist/workers/wrun/wrun-abi-host.js +3 -2
- package/package.json +11 -11
|
@@ -1,106 +1,224 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The size thresholds a built-in package declares
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* threshold that means "big" follows the market instead:
|
|
7
|
-
* and param name, never by a label, a hint or a pattern),
|
|
8
|
-
* per mount and market (wrun-market-size-defaults.util).
|
|
2
|
+
* The size thresholds a built-in package declares as ONE number for every market, made to follow the market. Big
|
|
3
|
+
* Trades 0.5.0 floors its tape by Min size in each venue's raw stored unit (coins on Binance, contracts on gate.io
|
|
4
|
+
* futures), tuned on BTC, where 10 BTC is about $830k; on a market whose coin is worth a sliver of BTC the same number
|
|
5
|
+
* keeps a whole tape: 10 ETH (about $24k) kept 487,132 prints over its seven days of BINANCE_FUTURES ETHUSDT, past the
|
|
6
|
+
* trades worker's 300,000-print cap, so every attempt failed. A threshold that means "big" follows the market instead:
|
|
7
|
+
* the table below names the params that do (keyed by package and param name, never by a label, a hint or a pattern),
|
|
8
|
+
* and this leaf holds the rules; the run head applies them once per mount and market (wrun-market-size-defaults.util).
|
|
9
9
|
*
|
|
10
|
-
*
|
|
11
|
-
* coins, Min size defaults to 0.01% of the market's daily base volume rounded down to 1, 2 or 5 times a power of ten
|
|
12
|
-
* (`wrunNiceFloor`, below 1 too), and Whale size to ten times that, so BTC keeps 10 and 100 (131.7K BTC a day) while
|
|
13
|
-
* ETH reads 200 and 2000 (3.13M ETH). The daily volume comes from the chart's own candles (`wrunDailyCandleVolume`).
|
|
14
|
-
* A market whose facts never yield a market default reads the package's defaults, so a record never keeps the last
|
|
15
|
-
* coin market's scaled one there: sized in contracts (CME, every contract market), placed by the directory in another
|
|
16
|
-
* unit (shares), or candles in another unit than the tape (an inverse or OKX swap, a formula chart). A market whose
|
|
17
|
-
* size unit is not known yet and a chart whose closed candles cover under an hour move nothing: the next run asks
|
|
18
|
-
* again.
|
|
10
|
+
* Two rule families, one per unit a package floors in:
|
|
19
11
|
*
|
|
20
|
-
*
|
|
12
|
+
* - The DOLLAR rule (C-DOLLAR, Big Trades 0.6.0's Min value and Whale value, the floor every new package uses): the
|
|
13
|
+
* default is 0.01% of the market's daily DOLLAR volume, read from the chart's own candles (each candle's volume x
|
|
14
|
+
* its close x the market's dollar unit, `wrunDailyCandleDollarVolume`), rounded down to 1, 2 or 5 times a power of
|
|
15
|
+
* ten (`wrunNiceFloor`), and Whale value ten times that. The dollar unit is the market facts' (`market.point_value()`
|
|
16
|
+
* on a market quoted in dollars, wrun-chart-market-facts.util `wrunMarketDollarUnit`): 1 where a candle counts coins
|
|
17
|
+
* or shares, the CME root's point value where it counts contracts. ONE rule for every market: the verdict reads the
|
|
18
|
+
* candles and the unit, and never a venue list (a spec walks every venue the pb-common enum names). A market whose
|
|
19
|
+
* unit cannot be proven reads the package's defaults with a named reason (no point value, a quote that is no dollar),
|
|
20
|
+
* or moves nothing while the directory can still name its quote.
|
|
21
|
+
* - The COIN rule (Big Trades 0.5.0's Min size and Whale size, kept so a published 0.5.0 runs exactly as it did): on a
|
|
22
|
+
* market whose size unit is coins and whose candle volume is in base coins, Min size defaults to 0.01% of the daily
|
|
23
|
+
* base volume, rounded the same way, and Whale size to ten times that, so BTC keeps 10 and 100 (131.7K BTC a day)
|
|
24
|
+
* while ETH reads 200 and 2000 (3.13M ETH). Its facts are a venue's raw unit, so a market whose facts never yield a
|
|
25
|
+
* coin default reads the package's defaults: sized in contracts, placed by the directory in another unit (shares), or
|
|
26
|
+
* candles in another unit than the tape (candle-volume-unit.leaf). This is the raw-unit class the dollar rule ends.
|
|
27
|
+
*
|
|
28
|
+
* Big Trades 0.8.0's contracts floor (`min_contracts` and `whale_contracts`, Min size and Whale size on a market that
|
|
29
|
+
* counts contracts, the floor of its `tape_contracts` input) follows no market: CME keeps 0.5.0's flat 10 and 100
|
|
30
|
+
* contracts, the package's defaults, untouched rows included (Kyle 2026-10-23; an even-density rule is a follow-up).
|
|
31
|
+
* The twins guard exempts it by name.
|
|
32
|
+
*
|
|
33
|
+
* A run reads only the family its sheet declares (`wrunMarketScaledRulesOfSheet`). A market whose closed candles cover
|
|
34
|
+
* under an hour moves nothing: the next run asks again.
|
|
35
|
+
*
|
|
36
|
+
* Beside the volume rules, the OPTION rule (r11, Big Trades 0.7.0's Size shown as, `contracts-option`): a select whose
|
|
37
|
+
* default follows what the chart counts. On a chart that counts contracts (`wrunChartSizeUnit` contracts) whose dollar
|
|
38
|
+
* unit is proven, the rule's option (Contracts or coins: the bubble reads 25 NQ contracts, not $12M); everywhere else
|
|
39
|
+
* the package's own (Dollars). It reads no candles, and skips only while the dollar unit can still be proven, so it
|
|
40
|
+
* never keeps another market's option for good. The run head splits it off the volume rules first
|
|
41
|
+
* (`wrunMarketScaledFamilies`): each family has its own verdict and memo, so a volume rule waiting on its candles never
|
|
42
|
+
* holds the option back.
|
|
43
|
+
*
|
|
44
|
+
* Pure: the specs and the phone app read the same rules. Its one import is the import-free size unit table.
|
|
21
45
|
*/
|
|
22
46
|
import type { WrunScriptInputDeclaration } from './wrun-script-inputs.util.js';
|
|
23
47
|
/** How a market-scaled param's default follows the market. */
|
|
24
48
|
export type WrunMarketScaledRule =
|
|
25
|
-
/** A share of the market's daily base volume, rounded down to 1, 2 or 5 times a power of ten. */
|
|
49
|
+
/** A share of the market's daily base volume (the coin rule), rounded down to 1, 2 or 5 times a power of ten. */
|
|
26
50
|
{
|
|
27
51
|
readonly kind: 'daily-volume';
|
|
28
52
|
readonly share: number;
|
|
29
53
|
}
|
|
54
|
+
/** A share of the market's daily dollar volume (the dollar rule, C-DOLLAR), rounded the same way. `carriesFrom` names
|
|
55
|
+
* the raw-unit param a saved record of an older version held in its place: a value the user changed there is priced
|
|
56
|
+
* into this one once (the pin move keeps it pending, the run head prices it, `wrunCarriedDollarValue`). */
|
|
57
|
+
| {
|
|
58
|
+
readonly kind: 'daily-dollar-volume';
|
|
59
|
+
readonly share: number;
|
|
60
|
+
readonly carriesFrom?: string;
|
|
61
|
+
}
|
|
30
62
|
/** A multiple of another scaled param's market default (resolved after the ones read off the volume). */
|
|
31
63
|
| {
|
|
32
64
|
readonly kind: 'times';
|
|
33
65
|
readonly param: string;
|
|
34
66
|
readonly factor: number;
|
|
67
|
+
readonly carriesFrom?: string;
|
|
68
|
+
}
|
|
69
|
+
/** A select's option where the chart counts contracts and its dollar unit is proven, the package's own default
|
|
70
|
+
* everywhere else (`wrunMarketOptionVerdict`). An option is never a value carried from an older version. */
|
|
71
|
+
| {
|
|
72
|
+
readonly kind: 'contracts-option';
|
|
73
|
+
readonly option: number;
|
|
74
|
+
readonly carriesFrom?: never;
|
|
35
75
|
};
|
|
36
76
|
/**
|
|
37
77
|
* The params whose default follows the market, by package name, then param name (the sheet's own names). A built-in
|
|
38
|
-
* twin whose sheet binds a param to a trade
|
|
78
|
+
* twin whose sheet binds a param to a trade floor lists it here or in the guard's exemptions with a reason
|
|
39
79
|
* (tests/utility/wrun/wrun-market-size-defaults.twins.spec.ts walks every proven twin's frozen sheet).
|
|
40
80
|
*/
|
|
41
81
|
export declare const WRUN_MARKET_SCALED_PARAMS: Readonly<Record<string, Readonly<Record<string, WrunMarketScaledRule>>>>;
|
|
42
82
|
/** The scaled params of a package, or undefined for a package that scales none. */
|
|
43
83
|
export declare function wrunMarketScaledParamsOf(packageName: string | undefined): Readonly<Record<string, WrunMarketScaledRule>> | undefined;
|
|
44
|
-
/**
|
|
45
|
-
*
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
|
|
51
|
-
|
|
84
|
+
/** The scaled rules a sheet declares params for (a version of the package declares its own: 0.5.0 the coin rule,
|
|
85
|
+
* 0.6.0 the dollar rule, 0.7.0 and 0.8.0 the option rule beside it), or undefined when it declares none. */
|
|
86
|
+
export declare function wrunMarketScaledRulesOfSheet(rules: Readonly<Record<string, WrunMarketScaledRule>> | undefined, paramNames: Iterable<string>): Readonly<Record<string, WrunMarketScaledRule>> | undefined;
|
|
87
|
+
/** A package's scaled rules split by family: the VOLUME rules (`daily-volume`, `daily-dollar-volume` and the
|
|
88
|
+
* multiples of them, read off the candles) and the OPTION rules (`contracts-option`, read off the market's units).
|
|
89
|
+
* The run head reads each family with its own verdict and memo; a family the rules leave empty is absent. */
|
|
90
|
+
export interface WrunMarketScaledFamilies {
|
|
91
|
+
volume?: Readonly<Record<string, WrunMarketScaledRule>>;
|
|
92
|
+
options?: Readonly<Record<string, WrunMarketScaledRule>>;
|
|
93
|
+
}
|
|
94
|
+
/** The scaled rules split into their families (`WrunMarketScaledFamilies`): every option rule to `options`, every other
|
|
95
|
+
* rule to `volume`. */
|
|
96
|
+
export declare function wrunMarketScaledFamilies(rules: Readonly<Record<string, WrunMarketScaledRule>>): WrunMarketScaledFamilies;
|
|
97
|
+
/** A market's daily volume in its candles' unit (the coin rule's volume), `wrunDailyCandleSum` of each candle's
|
|
98
|
+
* volume. */
|
|
52
99
|
export declare function wrunDailyCandleVolume(rows: ReadonlyArray<ArrayLike<number>>, intervalMs?: number): number | undefined;
|
|
100
|
+
/** A market's daily dollar volume (the dollar rule's volume): `wrunDailyCandleSum` of each candle's volume x its close
|
|
101
|
+
* x `dollarUnit` (the US dollars one price unit times one candle-volume unit is worth). Undefined for a unit that is
|
|
102
|
+
* not finite and above zero. */
|
|
103
|
+
export declare function wrunDailyCandleDollarVolume(rows: ReadonlyArray<ArrayLike<number>>, dollarUnit: number, intervalMs?: number): number | undefined;
|
|
53
104
|
/**
|
|
54
105
|
* The largest 1, 2 or 5 times a power of ten at or below `value` (5,000,000, 200, 10, then 0.5, 0.2, 0.1 below 1), as
|
|
55
106
|
* a clean decimal; undefined for a value that is not finite and above zero.
|
|
56
107
|
*/
|
|
57
108
|
export declare function wrunNiceFloor(value: number): number | undefined;
|
|
58
109
|
/**
|
|
59
|
-
* Each scaled param's default on a market trading `dailyVolume` base units a day
|
|
60
|
-
* the
|
|
110
|
+
* Each scaled param's default on a market trading `dailyVolume` base units a day and `dailyDollarVolume` dollars a
|
|
111
|
+
* day: the volume rules first (each reads its own family's volume), then the multiples of them. Undefined when a rule's
|
|
112
|
+
* volume yields no default (absent, or not finite and above zero). An option rule is no volume rule and gets nothing
|
|
113
|
+
* here (its default is `wrunMarketOptionVerdict`'s).
|
|
61
114
|
*/
|
|
62
|
-
export declare function wrunMarketScaledDefaults(rules: Readonly<Record<string, WrunMarketScaledRule>>, dailyVolume: number): Record<string, number> | undefined;
|
|
63
|
-
/** The market facts
|
|
64
|
-
*
|
|
115
|
+
export declare function wrunMarketScaledDefaults(rules: Readonly<Record<string, WrunMarketScaledRule>>, dailyVolume: number | undefined, dailyDollarVolume?: number): Record<string, number> | undefined;
|
|
116
|
+
/** The dollar unit a market's facts prove (wrun-chart-market-facts.util `wrunMarketDollarUnit`, read by the head): the
|
|
117
|
+
* US dollars one price unit times one size unit is worth, or why it cannot be proven. */
|
|
118
|
+
export type WrunMarketSizeDollarUnit = {
|
|
119
|
+
kind: 'dollars';
|
|
120
|
+
unit: number;
|
|
121
|
+
} | {
|
|
122
|
+
kind: 'unproven';
|
|
123
|
+
reason: 'point-value' | 'quote';
|
|
124
|
+
transient: boolean;
|
|
125
|
+
};
|
|
126
|
+
/** The market facts the rules read: the size unit (`wrunChartSizeUnit`) and whether the candles' volume is in base
|
|
127
|
+
* coins (the venue's unit profile, candle-volume-unit.leaf) for the coin rule; the market's dollar unit for the dollar
|
|
128
|
+
* rule; the chart's own candle rows and its bar length for both. */
|
|
65
129
|
export interface WrunMarketSizeFacts {
|
|
66
130
|
sizeUnit: number;
|
|
67
131
|
candleVolumeInCoins: boolean;
|
|
132
|
+
/** The dollar rule's unit; absent on a chart whose candles are no market's (a formula chart), which reads the
|
|
133
|
+
* package's defaults (`candle-unit`). */
|
|
134
|
+
dollarUnit?: WrunMarketSizeDollarUnit;
|
|
68
135
|
rows: ReadonlyArray<ArrayLike<number>>;
|
|
69
136
|
intervalMs?: number;
|
|
70
137
|
}
|
|
71
138
|
/** What a market's facts make of the scaled params' defaults. */
|
|
72
139
|
export type WrunMarketSizeVerdict =
|
|
73
|
-
/** The market's own defaults: a
|
|
140
|
+
/** The market's own defaults: a market whose candles say how much it trades a day, in the rules' unit. */
|
|
74
141
|
{
|
|
75
142
|
kind: 'market';
|
|
76
143
|
defaults: Record<string, number>;
|
|
77
144
|
}
|
|
78
145
|
/** The package's declared defaults, on facts that never change for the market, so a record moves back to them
|
|
79
|
-
* instead of keeping another market's scaled default: sized in contracts (`contracts`: CME, every
|
|
80
|
-
* market), placed by the directory in another unit (`size-unit`: shares), candles in another unit than the
|
|
81
|
-
* (`candle-unit`: contracts on an inverse or an OKX swap, a formula chart's candles, which are no market's).
|
|
146
|
+
* instead of keeping another market's scaled default. The coin rule: sized in contracts (`contracts`: CME, every
|
|
147
|
+
* contract market), placed by the directory in another unit (`size-unit`: shares), candles in another unit than the
|
|
148
|
+
* tape (`candle-unit`: contracts on an inverse or an OKX swap, a formula chart's candles, which are no market's). The
|
|
149
|
+
* dollar rule: no point value (`point-value`: ICE, PLATTS, a CME root off the table), a quote that is no dollar
|
|
150
|
+
* (`quote`: KRW, a coin), a formula chart (`candle-unit`). */
|
|
82
151
|
| {
|
|
83
152
|
kind: 'package';
|
|
84
|
-
reason: 'contracts' | 'size-unit' | 'candle-unit';
|
|
153
|
+
reason: 'contracts' | 'size-unit' | 'candle-unit' | 'point-value' | 'quote';
|
|
85
154
|
}
|
|
86
155
|
/** Nothing moves yet (the record keeps what it holds, and the next run asks again), on facts that can still change:
|
|
87
|
-
* a size unit not known yet (`size-unit`: the directory has not placed the market, or its lookup failed),
|
|
88
|
-
* candles covering under an hour or holding no volume
|
|
156
|
+
* a size unit not known yet (`size-unit`: the directory has not placed the market, or its lookup failed), a dollar
|
|
157
|
+
* quote the directory can still name (`quote`), closed candles covering under an hour or holding no volume
|
|
158
|
+
* (`cover`). */
|
|
89
159
|
| {
|
|
90
160
|
kind: 'skip';
|
|
91
|
-
reason: 'size-unit' | 'cover';
|
|
161
|
+
reason: 'size-unit' | 'quote' | 'cover';
|
|
162
|
+
};
|
|
163
|
+
/** The verdict of a market's facts on a package's VOLUME rules (`allRules`, one volume family: a sheet declares one,
|
|
164
|
+
* and the head passes `wrunMarketScaledFamilies(...).volume`; an option rule among them is left out, never read as a
|
|
165
|
+
* dollar rule). A set holding both volume families reads the dollar rule only when the coin rule agrees to move (a
|
|
166
|
+
* mixed set is no shipped sheet's; the stricter verdict wins). */
|
|
167
|
+
export declare function wrunMarketSizeVerdict(allRules: Readonly<Record<string, WrunMarketScaledRule>>, facts: WrunMarketSizeFacts): WrunMarketSizeVerdict;
|
|
168
|
+
/**
|
|
169
|
+
* The verdict of a market's facts on a package's OPTION rules (`contracts-option`, the head passes
|
|
170
|
+
* `wrunMarketScaledFamilies(...).options`). It reads no candles: on a chart that counts contracts (`sizeUnit`) whose
|
|
171
|
+
* dollar unit is proven, each rule's option (`market`); the package's own defaults on facts that never change for the
|
|
172
|
+
* market (`package`: a formula chart, `candle-unit`; a dollar unit that can never be proven, its reason; any other size
|
|
173
|
+
* unit, `size-unit`); nothing while the dollar unit can still be proven (`skip`, `quote`), so it is never a skip for
|
|
174
|
+
* good and a record never keeps another market's option.
|
|
175
|
+
*/
|
|
176
|
+
export declare function wrunMarketOptionVerdict(rules: Readonly<Record<string, WrunMarketScaledRule>>, facts: WrunMarketSizeFacts): WrunMarketSizeVerdict;
|
|
177
|
+
/** What one unit of a market's STORED trade amount is worth in US dollars (wrun-chart-market-facts.util
|
|
178
|
+
* `wrunMarketStoredUnitDollars`, read by the head: the large-print writer's own price of one, off the market's newest
|
|
179
|
+
* TRADE_LARGE print), or why that cannot be proven (`transient` while a read can still answer it). */
|
|
180
|
+
export type WrunMarketSizeStoredUnit = {
|
|
181
|
+
kind: 'dollars';
|
|
182
|
+
perUnit: number;
|
|
183
|
+
} | {
|
|
184
|
+
kind: 'unproven';
|
|
185
|
+
reason: string;
|
|
186
|
+
transient: boolean;
|
|
92
187
|
};
|
|
93
|
-
/**
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
188
|
+
/**
|
|
189
|
+
* A raw-unit value the user changed on an older version (C-DOLLAR's carry: Big Trades 0.5.0's Min size or Whale size)
|
|
190
|
+
* priced in dollars once, for the dollar param that took its place: `raw` STORED units (the unit 0.5.0 floored by:
|
|
191
|
+
* contracts on gate.io futures and OKX swaps, USD contracts on an inverse market, contracts on CME) x the dollars one
|
|
192
|
+
* stored unit is worth at the market's price (`perStoredUnit`, `WrunMarketSizeStoredUnit`), held to 3 significant
|
|
193
|
+
* figures, the nearest. A user's own number is never moved on the market defaults' 1, 2 or 5 ladder (`wrunNiceFloor`):
|
|
194
|
+
* that floor cut 5 NQ contracts ($3,002,125) to $2,000,000, about 3.3 contracts, and 60,000 gate.io contracts
|
|
195
|
+
* ($495,078) to $200,000; held to 3 figures they carry $3,000,000 and $495,000. A raw floor is never priced as coins:
|
|
196
|
+
* 60,000 gate.io BTC_USDT contracts are 6 BTC, about $504,000, never 60,000 x the price. Undefined when either fact is
|
|
197
|
+
* not finite and above zero, or their product is not (the carry then waits, never guesses).
|
|
198
|
+
*/
|
|
199
|
+
export declare function wrunCarriedDollarValue(raw: unknown, perStoredUnit: number): number | undefined;
|
|
200
|
+
/**
|
|
201
|
+
* Whether a carry keeps the raw value under its old name after pricing it (BT-CME stopgap S0): on a market that counts
|
|
202
|
+
* contracts (`sizeUnit`, `wrunChartSizeUnit` contracts: the CME family) the raw value IS the market's own unit, the
|
|
203
|
+
* contract count a futures trader set, and the version that floors such a market in contracts restores it exactly, so
|
|
204
|
+
* it stays stored (its dollar row's `carriedValue` mark keeps it from pricing twice). Everywhere else the raw value is
|
|
205
|
+
* a venue's stored unit no later version reads, and the carry clears it.
|
|
206
|
+
*/
|
|
207
|
+
export declare function wrunCarryKeepsRawValue(sizeUnit: number | undefined): boolean;
|
|
208
|
+
/** A market default as its row holds it: a number row's value held to its bounds (undefined for one that is not
|
|
209
|
+
* finite); a select row's option string when `String(value)` is one of the row's options ("0", "1"), the row's own
|
|
210
|
+
* spelling, else undefined. */
|
|
211
|
+
export declare function wrunMarketDefaultWithinRow(row: Pick<WrunScriptInputDeclaration, 'type' | 'constraints' | 'options'>, value: unknown): number | string | undefined;
|
|
97
212
|
/**
|
|
98
213
|
* `rows` (the rows a sheet builds, `buildWrunScriptInputs`) with the market defaults a record holds: each scaled
|
|
99
214
|
* param's row takes the default its row in `held` (the record's own `scriptInputs`) carries, the one the run head last
|
|
100
215
|
* moved it to, so a rebuild of the rows from the sheet (a delivered sheet's reconcile, a pin move) never moves a market
|
|
101
|
-
* default back to the sheet's, and a value at it never reads as changed
|
|
102
|
-
*
|
|
216
|
+
* default back to the sheet's, and a value at it never reads as changed; and the carried value its held row marks
|
|
217
|
+
* (`carriedValue`, C-DOLLAR's carry), so a rebuild never turns a carried value into one the market defaults move. A
|
|
218
|
+
* held default that is not a number within the row's bounds stays the sheet's, and so does one a select row does not
|
|
219
|
+
* offer (a select keeps the option it names, in its own spelling). The same array when nothing moves.
|
|
103
220
|
*/
|
|
104
221
|
export declare function wrunRowsKeepingMarketDefaults(rows: WrunScriptInputDeclaration[], held: unknown, packageName: string | undefined): WrunScriptInputDeclaration[];
|
|
105
|
-
/** Whether a settings row can hold
|
|
106
|
-
|
|
222
|
+
/** Whether a settings row can hold the market default of `rule`: a select for an option rule (`contracts-option`), a
|
|
223
|
+
* number kind for every other rule and for no rule given; a sheet that retyped the param keeps its own. */
|
|
224
|
+
export declare function isWrunMarketScaledRow(row: Pick<WrunScriptInputDeclaration, 'type'>, rule?: WrunMarketScaledRule): boolean;
|