@christtrade/depth 0.14.1 → 0.15.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.
Files changed (40) hide show
  1. package/depth.cjs +90 -56
  2. package/depth.css +1 -1
  3. package/depth.mjs +90 -56
  4. package/depth.nopreflight.css +1 -1
  5. package/package.json +1 -1
  6. package/types/console/Console.d.ts +190 -0
  7. package/types/console/builtins/cfgedit.d.ts +2 -0
  8. package/types/console/builtins/editor.d.ts +9 -0
  9. package/types/console/builtins/js.d.ts +9 -0
  10. package/types/console/builtins/pipes.d.ts +2 -0
  11. package/types/console/builtins/plot.d.ts +9 -0
  12. package/types/console/builtins/scripts.d.ts +2 -0
  13. package/types/console/builtins/watch.d.ts +2 -0
  14. package/types/console/chart-host.d.ts +3 -0
  15. package/types/console/lex.d.ts +16 -0
  16. package/types/console/manifest.gen.d.ts +3 -0
  17. package/types/console/plugin-console.d.ts +24 -0
  18. package/types/console/tools/book.d.ts +3 -0
  19. package/types/console/tools/free.d.ts +3 -0
  20. package/types/console/tools/look.d.ts +3 -0
  21. package/types/console/tools/market.d.ts +6 -0
  22. package/types/console/tools/net.d.ts +14 -0
  23. package/types/console/tools/netgraph.d.ts +3 -0
  24. package/types/console/tools/profile.d.ts +3 -0
  25. package/types/console/tools/tape.d.ts +3 -0
  26. package/types/console/tools/top.d.ts +10 -0
  27. package/types/console/tools/trace.d.ts +3 -0
  28. package/types/console/tools/triggers.d.ts +3 -0
  29. package/types/console/tools/tui.d.ts +13 -0
  30. package/types/console/types.d.ts +62 -0
  31. package/types/console/values.d.ts +46 -0
  32. package/types/core/DepthChart.d.ts +12 -0
  33. package/types/core/ExecutionEngine.d.ts +6 -1
  34. package/types/core/RenderEngine.d.ts +13 -0
  35. package/types/core/ScriptedPlugin.d.ts +10 -0
  36. package/types/core/TypedEventBus.d.ts +9 -0
  37. package/types/core/index.d.ts +5 -1
  38. package/types/interfaces/plugins/IChartPlugin.d.ts +10 -0
  39. package/types/lib/matchingEngine.d.ts +14 -0
  40. package/types/lib/storage.d.ts +2 -0
@@ -13,6 +13,7 @@ import type { SerialTrade, PriceHistory } from '../../lib/types';
13
13
  import type { FootprintBar } from '../../lib/types/footprint';
14
14
  import type { BracketAmendment } from '../../lib/types/trading-types';
15
15
  import type { PlaceOrderRequest } from '../../lib/matchingEngine';
16
+ import type { CommandDef, CvarDef } from '../../console/Console';
16
17
  export type PluginType = 'indicator' | 'drawing' | 'chart-type' | 'data-source' | 'extension' | 'strategy';
17
18
  export type Permission = 'data:read' | 'data:write' | 'eventbus:emit' | 'eventbus:intercept' | 'ui:pane' | 'ui:panel' | 'ui:toolbar' | 'ui:context-menu' | 'render:overlay' | 'render:shader' | 'drawing:register' | 'chart-type:register' | 'theme:register' | 'audio' | 'network' | 'storage' | 'intercept' | 'execution:read' | 'execution:write';
18
19
  export interface ToolbarItem {
@@ -228,6 +229,15 @@ export interface PluginContext {
228
229
  playback: {
229
230
  registerState(snapshot: PluginStateSnapshot): () => void;
230
231
  };
232
+ /**
233
+ * add cmds and cvarsto the charts console. name them 'yourplugin:thing'
234
+ * so 'thing' alone still finds them. everything registered here goes away when the plugin
235
+ * uninstalls. the returned fn removes one sooner
236
+ */
237
+ console: {
238
+ register(def: CommandDef): () => void;
239
+ registerCvar(def: CvarDef): () => void;
240
+ };
231
241
  }
232
242
  export interface ChartPlugin {
233
243
  readonly id: string;
@@ -19,6 +19,15 @@ export declare const NQ_FEE_SCHEDULE: FeeSchedule;
19
19
  export declare const MICRO_FEE_SCHEDULE: FeeSchedule;
20
20
  export declare const ZERO_FEE_SCHEDULE: FeeSchedule;
21
21
  export declare function feeScheduleFor(symbolInfo?: SymbolInfo | null): FeeSchedule;
22
+ export type BookLevel = {
23
+ price: number;
24
+ size: number;
25
+ orders: number;
26
+ };
27
+ export type BookDepth = {
28
+ bids: BookLevel[];
29
+ asks: BookLevel[];
30
+ };
22
31
  export interface L3EngineOptions {
23
32
  symbolInfo?: SymbolInfo;
24
33
  tickSize?: number;
@@ -128,6 +137,11 @@ export interface L3MatchingEngine {
128
137
  getFillSearch: () => FillSearchOptions;
129
138
  /** Cheap gate: is there any resting order / untriggered bracket that could fill? */
130
139
  hasPendingTriggers: () => boolean;
140
+ /**
141
+ * Resting size at the best `levels` prices each side (best first). Only an
142
+ * order by order feed builds a book, anything coarser returns empty sides
143
+ */
144
+ getDepth: (levels: number) => BookDepth;
131
145
  /**
132
146
  * Replay a skipped span's bars (fetched at fillSearch.maxResolution) to apply
133
147
  * fills the jump would otherwise have skipped. Bars must be time-ascending.
@@ -14,6 +14,8 @@ export declare const StorageKey: {
14
14
  readonly colorSwatches: "christtrade:chart:color-swatches";
15
15
  readonly pluginStartup: "christtrade:chart:plugin-startup";
16
16
  readonly pluginPanels: "christtrade:chart:plugin-panels";
17
+ readonly console: "christtrade:chart:console";
18
+ readonly consoleHistory: "christtrade:chart:console-history";
17
19
  };
18
20
  /** sdklaföfkdslfk:Settings blob a plugin owns via `ctx.getSettings()` / `ctx.saveSettings()`. */
19
21
  export declare function pluginSettingsKey(pluginId: string): string;