gloomberb 0.2.0 → 0.3.2
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 +20 -19
- package/bin/gloomberb +3 -0
- package/package.json +5 -4
- package/patches/@opentui%2Fcore@0.1.90.patch +356 -0
- package/src/app.tsx +1365 -0
- package/src/brokers/sync-broker-instance.test.ts +100 -0
- package/src/brokers/sync-broker-instance.ts +341 -0
- package/src/cli/commands/plugins.ts +173 -0
- package/src/cli/commands/portfolio.ts +210 -0
- package/src/cli/commands/search.ts +120 -0
- package/src/cli/commands/ticker.ts +375 -0
- package/src/cli/commands/watchlist.ts +210 -0
- package/src/cli/context.ts +62 -0
- package/src/cli/errors.ts +13 -0
- package/src/cli/helpers.ts +85 -0
- package/src/cli/index.ts +143 -0
- package/src/cli/ticker-resolution.ts +39 -0
- package/src/cli/types.ts +15 -0
- package/src/cli.test.ts +361 -0
- package/src/components/chart/chart-data.ts +239 -0
- package/src/components/chart/chart-renderer.ts +1199 -0
- package/src/components/chart/chart-types.ts +82 -0
- package/src/components/chart/chart-viewport.ts +21 -0
- package/src/components/chart/chart.test.ts +439 -0
- package/src/components/chart/comparison-chart-data.test.ts +109 -0
- package/src/components/chart/comparison-chart-data.ts +316 -0
- package/src/components/chart/comparison-chart-renderer.test.ts +84 -0
- package/src/components/chart/comparison-chart-renderer.ts +354 -0
- package/src/components/chart/comparison-stock-chart.tsx +1486 -0
- package/src/components/chart/cursor-motion.ts +48 -0
- package/src/components/chart/native/chart-rasterizer.ts +732 -0
- package/src/components/chart/native/kitty-adapter.ts +12 -0
- package/src/components/chart/native/kitty-manager.ts +142 -0
- package/src/components/chart/native/kitty-protocol.ts +110 -0
- package/src/components/chart/native/kitty-support.ts +71 -0
- package/src/components/chart/native/kitty.test.ts +620 -0
- package/src/components/chart/native/renderer-selection.ts +24 -0
- package/src/components/chart/native/surface-manager.ts +225 -0
- package/src/components/chart/native/surface-sync.ts +34 -0
- package/src/components/chart/stock-chart-renderer-switch.test.tsx +165 -0
- package/src/components/chart/stock-chart.test.ts +107 -0
- package/src/components/chart/stock-chart.tsx +1556 -0
- package/src/components/command-bar/__snapshots__/command-bar.test.tsx.snap +137 -0
- package/src/components/command-bar/command-bar.test.tsx +1546 -0
- package/src/components/command-bar/command-bar.tsx +4841 -0
- package/src/components/command-bar/command-registry.ts +269 -0
- package/src/components/command-bar/helpers.test.ts +224 -0
- package/src/components/command-bar/helpers.ts +371 -0
- package/src/components/command-bar/root-shortcuts.ts +158 -0
- package/src/components/command-bar/view-model.test.ts +152 -0
- package/src/components/command-bar/view-model.ts +185 -0
- package/src/components/command-bar/workflow-ops.test.ts +70 -0
- package/src/components/command-bar/workflow-ops.ts +433 -0
- package/src/components/command-bar/workflow-types.ts +127 -0
- package/src/components/detail-feed-view.test.tsx +105 -0
- package/src/components/detail-feed-view.tsx +295 -0
- package/src/components/index.ts +32 -0
- package/src/components/layout/floating-pane.tsx +49 -0
- package/src/components/layout/header.tsx +151 -0
- package/src/components/layout/pane-header.tsx +44 -0
- package/src/components/layout/pane.tsx +49 -0
- package/src/components/layout/pixel-mouse-mode.test.ts +122 -0
- package/src/components/layout/pixel-mouse.test.ts +40 -0
- package/src/components/layout/shell.test.tsx +651 -0
- package/src/components/layout/shell.tsx +1200 -0
- package/src/components/layout/status-bar.test.tsx +173 -0
- package/src/components/layout/status-bar.tsx +138 -0
- package/src/components/markdown-editor.tsx +134 -0
- package/src/components/markdown-text.tsx +218 -0
- package/src/components/onboarding/onboarding-wizard.test.tsx +184 -0
- package/src/components/onboarding/onboarding-wizard.tsx +1365 -0
- package/src/components/pane-settings-dialog.tsx +468 -0
- package/src/components/pane-template-wizard.test.tsx +52 -0
- package/src/components/pane-template-wizard.tsx +199 -0
- package/src/components/price-selector-dialog.tsx +195 -0
- package/src/components/spinner.tsx +2 -0
- package/src/components/tab-bar.tsx +17 -0
- package/src/components/ticker-badge-text.test.tsx +160 -0
- package/src/components/ticker-badge-text.tsx +58 -0
- package/src/components/ticker-badge.tsx +88 -0
- package/src/components/ticker-list-table.tsx +188 -0
- package/src/components/toggle-list.tsx +74 -0
- package/src/components/ui/button.tsx +77 -0
- package/src/components/ui/data-table.tsx +210 -0
- package/src/components/ui/external-link.tsx +22 -0
- package/src/components/ui/fields.tsx +187 -0
- package/src/components/ui/frame.tsx +73 -0
- package/src/components/ui/index.ts +53 -0
- package/src/components/ui/list-view.tsx +166 -0
- package/src/components/ui/loading.tsx +70 -0
- package/src/components/ui/status.tsx +83 -0
- package/src/components/ui/tabs.tsx +47 -0
- package/src/components/ui/toggle.tsx +164 -0
- package/src/components/ui/ui.test.tsx +134 -0
- package/src/data/app-persistence.ts +25 -0
- package/src/data/config-store.test.ts +347 -0
- package/src/data/config-store.ts +507 -0
- package/src/data/plugin-state-store.ts +102 -0
- package/src/data/resource-store.ts +323 -0
- package/src/data/session-store.ts +52 -0
- package/src/data/sqlite-cache.test.ts +103 -0
- package/src/data/sqlite-database.ts +62 -0
- package/src/data/sqlite-json.ts +19 -0
- package/src/data/ticker-repository.ts +45 -0
- package/src/data/ticker-store.ts +46 -0
- package/src/index.tsx +67 -0
- package/src/market-data/coordinator.test.ts +369 -0
- package/src/market-data/coordinator.ts +580 -0
- package/src/market-data/hooks.tsx +234 -0
- package/src/market-data/query-store.ts +28 -0
- package/src/market-data/request-types.test.ts +64 -0
- package/src/market-data/request-types.ts +70 -0
- package/src/market-data/result-types.ts +56 -0
- package/src/market-data/selectors.ts +166 -0
- package/src/market-data/trace.ts +7 -0
- package/src/pane-settings.test.ts +55 -0
- package/src/pane-settings.ts +73 -0
- package/src/plugins/builtin/ai/ask-ai-detail-tab.tsx +350 -0
- package/src/plugins/builtin/ai/gloomberb-cli.ts +70 -0
- package/src/plugins/builtin/ai/index.test.tsx +139 -0
- package/src/plugins/builtin/ai/index.tsx +86 -0
- package/src/plugins/builtin/ai/providers.ts +99 -0
- package/src/plugins/builtin/ai/runner.ts +82 -0
- package/src/plugins/builtin/ai/screener-contract.test.ts +117 -0
- package/src/plugins/builtin/ai/screener-contract.ts +174 -0
- package/src/plugins/builtin/ai/screener-pane.test.tsx +365 -0
- package/src/plugins/builtin/ai/screener-pane.tsx +1161 -0
- package/src/plugins/builtin/ai/settings.ts +79 -0
- package/src/plugins/builtin/ai/ticker-context.ts +64 -0
- package/src/plugins/builtin/ai/utils.ts +71 -0
- package/src/plugins/builtin/ask-ai.test.tsx +258 -0
- package/src/plugins/builtin/ask-ai.tsx +9 -0
- package/src/plugins/builtin/chat-controller.test.ts +217 -0
- package/src/plugins/builtin/chat-controller.ts +340 -0
- package/src/plugins/builtin/chat.test.tsx +451 -0
- package/src/plugins/builtin/chat.tsx +620 -0
- package/src/plugins/builtin/comparison-chart.test.tsx +277 -0
- package/src/plugins/builtin/comparison-chart.tsx +169 -0
- package/src/plugins/builtin/data-providers.ts +16 -0
- package/src/plugins/builtin/debug.tsx +351 -0
- package/src/plugins/builtin/help.test.tsx +110 -0
- package/src/plugins/builtin/help.tsx +281 -0
- package/src/plugins/builtin/layout-manager.tsx +264 -0
- package/src/plugins/builtin/manual-entry.tsx +25 -0
- package/src/plugins/builtin/news.tsx +143 -0
- package/src/plugins/builtin/notes-files.ts +58 -0
- package/src/plugins/builtin/notes.tsx +396 -0
- package/src/plugins/builtin/options-availability.test.tsx +179 -0
- package/src/plugins/builtin/options-availability.ts +158 -0
- package/src/plugins/builtin/options.tsx +364 -0
- package/src/plugins/builtin/portfolio-list/header.tsx +227 -0
- package/src/plugins/builtin/portfolio-list/index.tsx +99 -0
- package/src/plugins/builtin/portfolio-list/metrics.ts +460 -0
- package/src/plugins/builtin/portfolio-list/pane.tsx +533 -0
- package/src/plugins/builtin/portfolio-list/settings.ts +270 -0
- package/src/plugins/builtin/portfolio-list/summary.tsx +270 -0
- package/src/plugins/builtin/portfolio-list/table.tsx +64 -0
- package/src/plugins/builtin/portfolio-list.test.ts +74 -0
- package/src/plugins/builtin/portfolio-list.test.tsx +1164 -0
- package/src/plugins/builtin/portfolio-metrics.test.ts +224 -0
- package/src/plugins/builtin/quote-monitor.test.tsx +114 -0
- package/src/plugins/builtin/sec.tsx +250 -0
- package/src/plugins/builtin/ticker-detail/chart-tab.tsx +43 -0
- package/src/plugins/builtin/ticker-detail/financials-tab.tsx +390 -0
- package/src/plugins/builtin/ticker-detail/index.tsx +80 -0
- package/src/plugins/builtin/ticker-detail/overview-tab.tsx +242 -0
- package/src/plugins/builtin/ticker-detail/pane.tsx +183 -0
- package/src/plugins/builtin/ticker-detail/quote-monitor.tsx +83 -0
- package/src/plugins/builtin/ticker-detail/settings.ts +132 -0
- package/src/plugins/builtin/ticker-detail-chart-tab-switch.test.tsx +193 -0
- package/src/plugins/builtin/ticker-detail.test.tsx +578 -0
- package/src/plugins/builtin/yahoo.ts +18 -0
- package/src/plugins/event-bus.ts +37 -0
- package/src/plugins/ibkr/__snapshots__/trade-tab.test.tsx.snap +35 -0
- package/src/plugins/ibkr/account-cache.test.ts +101 -0
- package/src/plugins/ibkr/account-cache.ts +137 -0
- package/src/plugins/ibkr/broker-adapter.ts +168 -0
- package/src/plugins/ibkr/config.test.ts +68 -0
- package/src/plugins/ibkr/config.ts +262 -0
- package/src/plugins/ibkr/dialogs.tsx +83 -0
- package/src/plugins/ibkr/flex.test.ts +107 -0
- package/src/plugins/ibkr/flex.ts +267 -0
- package/src/plugins/ibkr/fundamental-parser.ts +149 -0
- package/src/plugins/ibkr/gateway-helpers.ts +28 -0
- package/src/plugins/ibkr/gateway-selection.ts +51 -0
- package/src/plugins/ibkr/gateway-service.test.ts +450 -0
- package/src/plugins/ibkr/gateway-service.ts +2228 -0
- package/src/plugins/ibkr/index.test.tsx +183 -0
- package/src/plugins/ibkr/index.tsx +153 -0
- package/src/plugins/ibkr/instance-selection.test.ts +121 -0
- package/src/plugins/ibkr/instance-selection.ts +36 -0
- package/src/plugins/ibkr/price-normalization.test.ts +38 -0
- package/src/plugins/ibkr/price-normalization.ts +59 -0
- package/src/plugins/ibkr/trade-badge.tsx +27 -0
- package/src/plugins/ibkr/trade-tab.test.tsx +225 -0
- package/src/plugins/ibkr/trade-tab.tsx +1050 -0
- package/src/plugins/ibkr/trade-utils.test.ts +175 -0
- package/src/plugins/ibkr/trade-utils.ts +149 -0
- package/src/plugins/ibkr/trading-pane.tsx +438 -0
- package/src/plugins/ibkr/trading-state.test.ts +109 -0
- package/src/plugins/ibkr/trading-state.ts +339 -0
- package/src/plugins/loader.ts +71 -0
- package/src/plugins/pane-manager.test.ts +103 -0
- package/src/plugins/pane-manager.ts +974 -0
- package/src/plugins/plugin-persistence.ts +85 -0
- package/src/plugins/plugin-runtime.test.tsx +185 -0
- package/src/plugins/plugin-runtime.tsx +175 -0
- package/src/plugins/prediction-markets/cache.ts +114 -0
- package/src/plugins/prediction-markets/categories.ts +223 -0
- package/src/plugins/prediction-markets/chart.tsx +512 -0
- package/src/plugins/prediction-markets/columns.ts +133 -0
- package/src/plugins/prediction-markets/controller-data.ts +614 -0
- package/src/plugins/prediction-markets/controller.ts +725 -0
- package/src/plugins/prediction-markets/detail/book.tsx +118 -0
- package/src/plugins/prediction-markets/detail/outcomes.tsx +102 -0
- package/src/plugins/prediction-markets/detail/overview.tsx +73 -0
- package/src/plugins/prediction-markets/detail/pane.tsx +308 -0
- package/src/plugins/prediction-markets/detail/rules.tsx +16 -0
- package/src/plugins/prediction-markets/detail/shared.tsx +29 -0
- package/src/plugins/prediction-markets/detail/trades.tsx +30 -0
- package/src/plugins/prediction-markets/detail.test.tsx +47 -0
- package/src/plugins/prediction-markets/index.tsx +102 -0
- package/src/plugins/prediction-markets/keyboard.ts +64 -0
- package/src/plugins/prediction-markets/launch.test.ts +126 -0
- package/src/plugins/prediction-markets/launch.ts +240 -0
- package/src/plugins/prediction-markets/metrics.ts +311 -0
- package/src/plugins/prediction-markets/navigation.ts +90 -0
- package/src/plugins/prediction-markets/outcome-order.ts +19 -0
- package/src/plugins/prediction-markets/pane.test.tsx +425 -0
- package/src/plugins/prediction-markets/pane.tsx +294 -0
- package/src/plugins/prediction-markets/plugin.test.tsx +570 -0
- package/src/plugins/prediction-markets/rows.ts +229 -0
- package/src/plugins/prediction-markets/services/fetch.ts +97 -0
- package/src/plugins/prediction-markets/services/kalshi-adapter.ts +555 -0
- package/src/plugins/prediction-markets/services/polymarket-adapter.ts +660 -0
- package/src/plugins/prediction-markets/services/polymarket-ws.ts +108 -0
- package/src/plugins/prediction-markets/settings.ts +164 -0
- package/src/plugins/prediction-markets/status.ts +24 -0
- package/src/plugins/prediction-markets/table.tsx +84 -0
- package/src/plugins/prediction-markets/test-helpers.tsx +636 -0
- package/src/plugins/prediction-markets/types.ts +186 -0
- package/src/plugins/registry.ts +633 -0
- package/src/sources/exchange-rates.ts +18 -0
- package/src/sources/gloomberb-cloud.test.ts +199 -0
- package/src/sources/gloomberb-cloud.ts +326 -0
- package/src/sources/provider-errors.ts +19 -0
- package/src/sources/provider-router.test.ts +1476 -0
- package/src/sources/provider-router.ts +1405 -0
- package/src/sources/sec-edgar.test.ts +286 -0
- package/src/sources/sec-edgar.ts +526 -0
- package/src/sources/yahoo-finance.test.ts +14 -0
- package/src/sources/yahoo-finance.ts +1017 -0
- package/src/state/app-activity.test.ts +41 -0
- package/src/state/app-activity.ts +106 -0
- package/src/state/app-bootstrap.test.ts +471 -0
- package/src/state/app-bootstrap.ts +308 -0
- package/src/state/app-context.test.ts +406 -0
- package/src/state/app-context.test.tsx +162 -0
- package/src/state/app-context.tsx +981 -0
- package/src/state/selectors.ts +67 -0
- package/src/state/session-persistence.test.ts +128 -0
- package/src/state/session-persistence.ts +161 -0
- package/src/state/ticker-refresh-queue.test.ts +46 -0
- package/src/state/ticker-refresh-queue.ts +40 -0
- package/src/state/use-inline-tickers.ts +174 -0
- package/src/state/use-quote-streaming.test.ts +37 -0
- package/src/state/use-quote-streaming.test.tsx +70 -0
- package/src/state/use-quote-streaming.ts +80 -0
- package/src/state/use-session-snapshot.ts +84 -0
- package/src/test-support/data-provider.ts +22 -0
- package/src/theme/color-utils.ts +67 -0
- package/src/theme/colors.ts +128 -0
- package/src/theme/themes.test.ts +45 -0
- package/src/theme/themes.ts +491 -0
- package/src/types/broker.ts +105 -0
- package/src/types/config.ts +444 -0
- package/src/types/data-provider.ts +81 -0
- package/src/types/financials.ts +142 -0
- package/src/types/instrument.ts +29 -0
- package/src/types/persistence.ts +21 -0
- package/src/types/plugin.ts +354 -0
- package/src/types/ticker.ts +58 -0
- package/src/types/trading.ts +85 -0
- package/src/updater.test.ts +282 -0
- package/src/updater.ts +303 -0
- package/src/utils/api-client.ts +666 -0
- package/src/utils/ascii-chart.ts +172 -0
- package/src/utils/broker-instances.ts +47 -0
- package/src/utils/cli-output.ts +83 -0
- package/src/utils/currency-units.test.ts +49 -0
- package/src/utils/currency-units.ts +82 -0
- package/src/utils/debug-log.ts +133 -0
- package/src/utils/exchange-rate-map.ts +8 -0
- package/src/utils/format.ts +158 -0
- package/src/utils/fuzzy-search.ts +34 -0
- package/src/utils/market-status.ts +95 -0
- package/src/utils/options.ts +86 -0
- package/src/utils/price-history.ts +39 -0
- package/src/utils/quote-time.test.ts +22 -0
- package/src/utils/quote-time.ts +50 -0
- package/src/utils/sec.test.ts +55 -0
- package/src/utils/sec.ts +45 -0
- package/src/utils/ticker-list.test.ts +22 -0
- package/src/utils/ticker-list.ts +35 -0
- package/src/utils/ticker-metadata.ts +51 -0
- package/src/utils/ticker-search.test.ts +227 -0
- package/src/utils/ticker-search.ts +764 -0
- package/src/utils/ticker-tokenizer.test.ts +48 -0
- package/src/utils/ticker-tokenizer.ts +72 -0
- package/src/version.ts +1 -0
- package/install.mjs +0 -68
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface CachePolicy {
|
|
2
|
+
staleMs: number;
|
|
3
|
+
expireMs: number;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export type CachePolicyMap = Partial<Record<string, CachePolicy>>;
|
|
7
|
+
|
|
8
|
+
export interface PersistedResourceMetadata {
|
|
9
|
+
fetchedAt: number;
|
|
10
|
+
staleAt: number;
|
|
11
|
+
expiresAt: number;
|
|
12
|
+
sourceKey: string;
|
|
13
|
+
schemaVersion: number;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface PersistedResourceValue<T = unknown> extends PersistedResourceMetadata {
|
|
17
|
+
value: T;
|
|
18
|
+
provenance?: unknown | null;
|
|
19
|
+
stale?: boolean;
|
|
20
|
+
expired?: boolean;
|
|
21
|
+
}
|
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { TickerRepository } from "../data/ticker-repository";
|
|
3
|
+
import type { PluginEvents } from "../plugins/event-bus";
|
|
4
|
+
import type { PluginLogger } from "../utils/debug-log";
|
|
5
|
+
import type { BrokerAdapter } from "./broker";
|
|
6
|
+
import type {
|
|
7
|
+
AppConfig,
|
|
8
|
+
BrokerInstanceConfig,
|
|
9
|
+
ColumnConfig,
|
|
10
|
+
LayoutConfig,
|
|
11
|
+
PaneBinding,
|
|
12
|
+
PaneInstanceConfig,
|
|
13
|
+
} from "./config";
|
|
14
|
+
import type { DataProvider } from "./data-provider";
|
|
15
|
+
import type { TickerFinancials } from "./financials";
|
|
16
|
+
import type { CachePolicy, PersistedResourceValue } from "./persistence";
|
|
17
|
+
import type { TickerRecord } from "./ticker";
|
|
18
|
+
import type { InstrumentSearchResult } from "./instrument";
|
|
19
|
+
|
|
20
|
+
export interface GloomSlots {
|
|
21
|
+
"detail:tab": { ticker: TickerRecord; financials: TickerFinancials | null };
|
|
22
|
+
"detail:section": { ticker: TickerRecord; financials: TickerFinancials | null };
|
|
23
|
+
"list:column": { ticker: TickerRecord; financials: TickerFinancials | null };
|
|
24
|
+
"command:extra": { query: string };
|
|
25
|
+
"command:preset": Record<string, never>;
|
|
26
|
+
"status:widget": Record<string, never>;
|
|
27
|
+
"config:section": Record<string, never>;
|
|
28
|
+
"data:post-refresh": { ticker: string; financials: TickerFinancials };
|
|
29
|
+
"data:enricher": { ticker: TickerRecord };
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface PaneProps {
|
|
33
|
+
paneId: string;
|
|
34
|
+
paneType: string;
|
|
35
|
+
focused: boolean;
|
|
36
|
+
width: number;
|
|
37
|
+
height: number;
|
|
38
|
+
close?: () => void;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export interface PaneDef {
|
|
42
|
+
id: string;
|
|
43
|
+
name: string;
|
|
44
|
+
icon?: string;
|
|
45
|
+
component: (props: PaneProps) => ReactNode;
|
|
46
|
+
defaultPosition: "left" | "right";
|
|
47
|
+
defaultWidth?: string;
|
|
48
|
+
defaultFloatingSize?: { width: number; height: number };
|
|
49
|
+
defaultMode?: "docked" | "floating";
|
|
50
|
+
settings?: PaneSettingsDef | ((context: PaneSettingsContext) => PaneSettingsDef | null);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface PaneSettingsContext {
|
|
54
|
+
config: AppConfig;
|
|
55
|
+
layout: LayoutConfig;
|
|
56
|
+
paneId: string;
|
|
57
|
+
paneType: string;
|
|
58
|
+
pane: PaneInstanceConfig;
|
|
59
|
+
settings: Record<string, unknown>;
|
|
60
|
+
paneState: Record<string, unknown>;
|
|
61
|
+
activeTicker: string | null;
|
|
62
|
+
activeCollectionId: string | null;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export interface PaneSettingOption {
|
|
66
|
+
value: string;
|
|
67
|
+
label: string;
|
|
68
|
+
description?: string;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
interface PaneSettingFieldBase {
|
|
72
|
+
key: string;
|
|
73
|
+
label: string;
|
|
74
|
+
description?: string;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export interface PaneSettingToggleField extends PaneSettingFieldBase {
|
|
78
|
+
type: "toggle";
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export interface PaneSettingTextField extends PaneSettingFieldBase {
|
|
82
|
+
type: "text";
|
|
83
|
+
placeholder?: string;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export interface PaneSettingSelectField extends PaneSettingFieldBase {
|
|
87
|
+
type: "select";
|
|
88
|
+
options: PaneSettingOption[];
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export interface PaneSettingMultiSelectField extends PaneSettingFieldBase {
|
|
92
|
+
type: "multi-select";
|
|
93
|
+
options: PaneSettingOption[];
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export interface PaneSettingOrderedMultiSelectField extends PaneSettingFieldBase {
|
|
97
|
+
type: "ordered-multi-select";
|
|
98
|
+
options: PaneSettingOption[];
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export type PaneSettingField =
|
|
102
|
+
| PaneSettingToggleField
|
|
103
|
+
| PaneSettingTextField
|
|
104
|
+
| PaneSettingSelectField
|
|
105
|
+
| PaneSettingMultiSelectField
|
|
106
|
+
| PaneSettingOrderedMultiSelectField;
|
|
107
|
+
|
|
108
|
+
export interface PaneSettingsDef {
|
|
109
|
+
title?: string;
|
|
110
|
+
fields: PaneSettingField[];
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export interface PaneTemplateContext {
|
|
114
|
+
config: AppConfig;
|
|
115
|
+
layout: LayoutConfig;
|
|
116
|
+
focusedPaneId: string | null;
|
|
117
|
+
activeTicker: string | null;
|
|
118
|
+
activeCollectionId: string | null;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export interface PaneTemplateShortcut {
|
|
122
|
+
prefix: string;
|
|
123
|
+
argPlaceholder?: string;
|
|
124
|
+
argKind?: "text" | "ticker" | "ticker-list";
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export interface PaneTemplateCreateOptions {
|
|
128
|
+
arg?: string;
|
|
129
|
+
values?: Record<string, string>;
|
|
130
|
+
symbol?: string | null;
|
|
131
|
+
symbols?: string[] | null;
|
|
132
|
+
ticker?: TickerRecord | null;
|
|
133
|
+
searchResult?: InstrumentSearchResult | null;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export interface PaneTemplateInstanceConfig {
|
|
137
|
+
title?: string;
|
|
138
|
+
binding?: PaneBinding;
|
|
139
|
+
params?: Record<string, string>;
|
|
140
|
+
settings?: Record<string, unknown>;
|
|
141
|
+
placement?: "default" | "docked" | "floating";
|
|
142
|
+
relativeToPaneId?: string;
|
|
143
|
+
relativePosition?: "left" | "right" | "above" | "below";
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export interface PaneTemplateDef {
|
|
147
|
+
id: string;
|
|
148
|
+
paneId: string;
|
|
149
|
+
label: string;
|
|
150
|
+
description: string;
|
|
151
|
+
keywords?: string[];
|
|
152
|
+
shortcut?: PaneTemplateShortcut;
|
|
153
|
+
wizard?: WizardStep[];
|
|
154
|
+
canCreate?: (context: PaneTemplateContext, options?: PaneTemplateCreateOptions) => boolean;
|
|
155
|
+
createInstance?: (
|
|
156
|
+
context: PaneTemplateContext,
|
|
157
|
+
options?: PaneTemplateCreateOptions,
|
|
158
|
+
) => PaneTemplateInstanceConfig | null | Promise<PaneTemplateInstanceConfig | null>;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
export interface WizardStep {
|
|
162
|
+
key: string;
|
|
163
|
+
label: string;
|
|
164
|
+
placeholder?: string;
|
|
165
|
+
defaultValue?: string;
|
|
166
|
+
type?: "text" | "password" | "info" | "select" | "number" | "textarea";
|
|
167
|
+
options?: Array<{ label: string; value: string }>;
|
|
168
|
+
dependsOn?: { key: string; value: string };
|
|
169
|
+
body?: string[];
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
export interface CommandDef {
|
|
173
|
+
id: string;
|
|
174
|
+
label: string;
|
|
175
|
+
keywords: string[];
|
|
176
|
+
shortcut?: string;
|
|
177
|
+
execute: (values?: Record<string, string>) => void | Promise<void>;
|
|
178
|
+
category: "navigation" | "data" | "portfolio" | "config";
|
|
179
|
+
description?: string;
|
|
180
|
+
wizard?: WizardStep[];
|
|
181
|
+
confirm?: CommandConfirmDef | ((context: CommandConfirmContext) => CommandConfirmDef | null);
|
|
182
|
+
wizardLayout?: "steps" | "form";
|
|
183
|
+
hidden?: () => boolean;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
export interface CommandConfirmContext {
|
|
187
|
+
config: AppConfig;
|
|
188
|
+
layout: LayoutConfig;
|
|
189
|
+
activeTicker: string | null;
|
|
190
|
+
activeCollectionId: string | null;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
export interface CommandConfirmDef {
|
|
194
|
+
title: string;
|
|
195
|
+
body: string[];
|
|
196
|
+
confirmLabel?: string;
|
|
197
|
+
cancelLabel?: string;
|
|
198
|
+
tone?: "default" | "danger";
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
export interface CustomColumnDef extends ColumnConfig {
|
|
202
|
+
render: (ticker: TickerRecord, financials: TickerFinancials | null) => string;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
export interface DetailTabProps {
|
|
206
|
+
width: number;
|
|
207
|
+
height: number;
|
|
208
|
+
focused: boolean;
|
|
209
|
+
onCapture: (capturing: boolean) => void;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
export interface DetailTabVisibilityContext {
|
|
213
|
+
ticker: TickerRecord | null;
|
|
214
|
+
financials: TickerFinancials | null | undefined;
|
|
215
|
+
hasIbkrGatewayTrading: boolean;
|
|
216
|
+
hasOptionsChain: boolean;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
export interface DetailTabDef {
|
|
220
|
+
id: string;
|
|
221
|
+
name: string;
|
|
222
|
+
order: number;
|
|
223
|
+
component: (props: DetailTabProps) => ReactNode;
|
|
224
|
+
isVisible?: (context: DetailTabVisibilityContext) => boolean;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
export interface KeyboardShortcut {
|
|
228
|
+
id: string;
|
|
229
|
+
key: string;
|
|
230
|
+
ctrl?: boolean;
|
|
231
|
+
shift?: boolean;
|
|
232
|
+
description: string;
|
|
233
|
+
execute: () => void;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
export interface TickerAction {
|
|
237
|
+
id: string;
|
|
238
|
+
label: string;
|
|
239
|
+
keywords: string[];
|
|
240
|
+
filter?: (ticker: TickerRecord) => boolean;
|
|
241
|
+
execute: (ticker: TickerRecord, financials: TickerFinancials | null) => void | Promise<void>;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
export interface PluginPersistence {
|
|
245
|
+
getState<T = unknown>(key: string, options?: { schemaVersion?: number }): T | null;
|
|
246
|
+
setState(key: string, value: unknown, options?: { schemaVersion?: number }): void;
|
|
247
|
+
deleteState(key: string): void;
|
|
248
|
+
getResource<T = unknown>(
|
|
249
|
+
kind: string,
|
|
250
|
+
key: string,
|
|
251
|
+
options?: { sourceKey?: string; schemaVersion?: number; allowExpired?: boolean },
|
|
252
|
+
): PersistedResourceValue<T> | null;
|
|
253
|
+
setResource<T = unknown>(
|
|
254
|
+
kind: string,
|
|
255
|
+
key: string,
|
|
256
|
+
value: T,
|
|
257
|
+
options: {
|
|
258
|
+
cachePolicy: CachePolicy;
|
|
259
|
+
sourceKey?: string;
|
|
260
|
+
schemaVersion?: number;
|
|
261
|
+
provenance?: unknown;
|
|
262
|
+
},
|
|
263
|
+
): PersistedResourceValue<T>;
|
|
264
|
+
deleteResource(kind: string, key: string, options?: { sourceKey?: string }): void;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
export interface PluginResumeState {
|
|
268
|
+
getState<T = unknown>(key: string, options?: { schemaVersion?: number }): T | null;
|
|
269
|
+
setState(key: string, value: unknown, options?: { schemaVersion?: number }): void;
|
|
270
|
+
deleteState(key: string): void;
|
|
271
|
+
getPaneState<T = unknown>(paneId: string, key: string): T | null;
|
|
272
|
+
setPaneState(paneId: string, key: string, value: unknown): void;
|
|
273
|
+
deletePaneState(paneId: string, key: string): void;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
export interface PluginConfigState {
|
|
277
|
+
get<T = unknown>(key: string): T | null;
|
|
278
|
+
set(key: string, value: unknown): Promise<void>;
|
|
279
|
+
delete(key: string): Promise<void>;
|
|
280
|
+
keys(): string[];
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
export interface PluginPaneSettingsState {
|
|
284
|
+
get<T = unknown>(paneId: string, key: string): T | null;
|
|
285
|
+
set(paneId: string, key: string, value: unknown): Promise<void>;
|
|
286
|
+
delete(paneId: string, key: string): Promise<void>;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
export interface GloomPluginContext {
|
|
290
|
+
registerPane(pane: PaneDef): void;
|
|
291
|
+
registerPaneTemplate(template: PaneTemplateDef): void;
|
|
292
|
+
registerCommand(command: CommandDef): void;
|
|
293
|
+
registerColumn(column: CustomColumnDef): void;
|
|
294
|
+
registerBroker(broker: BrokerAdapter): void;
|
|
295
|
+
registerDataProvider(provider: DataProvider): void;
|
|
296
|
+
registerDetailTab(tab: DetailTabDef): void;
|
|
297
|
+
registerShortcut(shortcut: KeyboardShortcut): void;
|
|
298
|
+
registerTickerAction(action: TickerAction): void;
|
|
299
|
+
|
|
300
|
+
getData(ticker: string): TickerFinancials | null;
|
|
301
|
+
getTicker(ticker: string): TickerRecord | null;
|
|
302
|
+
getConfig(): import("./config").AppConfig;
|
|
303
|
+
|
|
304
|
+
readonly dataProvider: DataProvider;
|
|
305
|
+
readonly tickerRepository: TickerRepository;
|
|
306
|
+
readonly persistence: PluginPersistence;
|
|
307
|
+
readonly log: PluginLogger;
|
|
308
|
+
readonly resume: PluginResumeState;
|
|
309
|
+
readonly configState: PluginConfigState;
|
|
310
|
+
readonly paneSettings: PluginPaneSettingsState;
|
|
311
|
+
|
|
312
|
+
createBrokerInstance(brokerType: string, label: string, values: Record<string, unknown>): Promise<BrokerInstanceConfig>;
|
|
313
|
+
updateBrokerInstance(instanceId: string, values: Record<string, unknown>): Promise<void>;
|
|
314
|
+
syncBrokerInstance(instanceId: string): Promise<void>;
|
|
315
|
+
removeBrokerInstance(instanceId: string): Promise<void>;
|
|
316
|
+
|
|
317
|
+
selectTicker(symbol: string, paneId?: string): void;
|
|
318
|
+
switchPanel(panel: "left" | "right"): void;
|
|
319
|
+
switchTab(tabId: string, paneId?: string): void;
|
|
320
|
+
openCommandBar(query?: string): void;
|
|
321
|
+
showPane(paneId: string): void;
|
|
322
|
+
createPaneFromTemplate(templateId: string, options?: PaneTemplateCreateOptions): void;
|
|
323
|
+
hidePane(paneId: string): void;
|
|
324
|
+
focusPane(paneId: string): void;
|
|
325
|
+
pinTicker(symbol: string, options?: { floating?: boolean; paneType?: string }): void;
|
|
326
|
+
openPaneSettings(paneId?: string): void;
|
|
327
|
+
|
|
328
|
+
on<K extends keyof PluginEvents>(event: K, handler: (payload: PluginEvents[K]) => void): () => void;
|
|
329
|
+
emit<K extends keyof PluginEvents>(event: K, payload: PluginEvents[K]): void;
|
|
330
|
+
|
|
331
|
+
showWidget(widgetId: string): void;
|
|
332
|
+
hideWidget(widgetId: string): void;
|
|
333
|
+
showToast(message: string, options?: { duration?: number; type?: "info" | "success" | "error" }): void;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
export interface GloomPlugin {
|
|
337
|
+
id: string;
|
|
338
|
+
name: string;
|
|
339
|
+
version: string;
|
|
340
|
+
description?: string;
|
|
341
|
+
toggleable?: boolean;
|
|
342
|
+
order?: number;
|
|
343
|
+
|
|
344
|
+
setup?(ctx: GloomPluginContext): void | Promise<void>;
|
|
345
|
+
dispose?(): void;
|
|
346
|
+
|
|
347
|
+
panes?: PaneDef[];
|
|
348
|
+
paneTemplates?: PaneTemplateDef[];
|
|
349
|
+
broker?: BrokerAdapter;
|
|
350
|
+
dataProvider?: DataProvider;
|
|
351
|
+
slots?: Partial<{
|
|
352
|
+
[K in keyof GloomSlots]: (props: GloomSlots[K]) => ReactNode;
|
|
353
|
+
}>;
|
|
354
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { BrokerContractRef } from "./instrument";
|
|
2
|
+
|
|
3
|
+
export interface TickerPosition {
|
|
4
|
+
portfolio: string;
|
|
5
|
+
shares: number;
|
|
6
|
+
avgCost: number;
|
|
7
|
+
currency?: string;
|
|
8
|
+
dateAcquired?: string;
|
|
9
|
+
broker: string; // "manual" | future broker plugin IDs
|
|
10
|
+
side?: "long" | "short";
|
|
11
|
+
marketValue?: number;
|
|
12
|
+
unrealizedPnl?: number;
|
|
13
|
+
/** Contract multiplier (e.g. 100 for options) */
|
|
14
|
+
multiplier?: number;
|
|
15
|
+
/** Last known mark price from broker snapshot */
|
|
16
|
+
markPrice?: number;
|
|
17
|
+
brokerInstanceId?: string;
|
|
18
|
+
brokerAccountId?: string;
|
|
19
|
+
brokerContractId?: number;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface TickerMetadata {
|
|
23
|
+
ticker: string;
|
|
24
|
+
exchange: string;
|
|
25
|
+
currency: string;
|
|
26
|
+
name: string;
|
|
27
|
+
sector?: string;
|
|
28
|
+
industry?: string;
|
|
29
|
+
assetCategory?: string; // STK, ETF, OPT, FUT, BOND, etc.
|
|
30
|
+
isin?: string;
|
|
31
|
+
cusip?: string;
|
|
32
|
+
portfolios: string[];
|
|
33
|
+
watchlists: string[];
|
|
34
|
+
positions: TickerPosition[];
|
|
35
|
+
broker_contracts?: BrokerContractRef[];
|
|
36
|
+
custom: Record<string, unknown>;
|
|
37
|
+
tags: string[];
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface TickerRecord {
|
|
41
|
+
metadata: TickerMetadata;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export interface Portfolio {
|
|
45
|
+
id: string;
|
|
46
|
+
name: string;
|
|
47
|
+
description?: string;
|
|
48
|
+
currency: string;
|
|
49
|
+
brokerId?: string;
|
|
50
|
+
brokerInstanceId?: string;
|
|
51
|
+
brokerAccountId?: string;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export interface Watchlist {
|
|
55
|
+
id: string;
|
|
56
|
+
name: string;
|
|
57
|
+
description?: string;
|
|
58
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import type { BrokerContractRef } from "./instrument";
|
|
2
|
+
|
|
3
|
+
export type BrokerOrderAction = "BUY" | "SELL";
|
|
4
|
+
export type BrokerOrderType = "MKT" | "LMT" | "STP" | "STP LMT";
|
|
5
|
+
|
|
6
|
+
export interface BrokerCashBalance {
|
|
7
|
+
currency: string;
|
|
8
|
+
quantity: number;
|
|
9
|
+
baseValue?: number;
|
|
10
|
+
baseCurrency?: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface BrokerAccount {
|
|
14
|
+
accountId: string;
|
|
15
|
+
name: string;
|
|
16
|
+
currency?: string;
|
|
17
|
+
source?: "gateway" | "flex";
|
|
18
|
+
updatedAt?: number;
|
|
19
|
+
netLiquidation?: number;
|
|
20
|
+
totalCashValue?: number;
|
|
21
|
+
settledCash?: number;
|
|
22
|
+
buyingPower?: number;
|
|
23
|
+
availableFunds?: number;
|
|
24
|
+
excessLiquidity?: number;
|
|
25
|
+
initMarginReq?: number;
|
|
26
|
+
maintMarginReq?: number;
|
|
27
|
+
cashBalances?: BrokerCashBalance[];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface BrokerOrderRequest {
|
|
31
|
+
brokerInstanceId?: string;
|
|
32
|
+
accountId?: string;
|
|
33
|
+
contract: BrokerContractRef;
|
|
34
|
+
action: BrokerOrderAction;
|
|
35
|
+
orderType: BrokerOrderType;
|
|
36
|
+
quantity: number;
|
|
37
|
+
limitPrice?: number;
|
|
38
|
+
stopPrice?: number;
|
|
39
|
+
tif?: string;
|
|
40
|
+
outsideRth?: boolean;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface BrokerOrderPreview {
|
|
44
|
+
initMarginBefore?: number;
|
|
45
|
+
initMarginAfter?: number;
|
|
46
|
+
maintMarginBefore?: number;
|
|
47
|
+
maintMarginAfter?: number;
|
|
48
|
+
equityWithLoanBefore?: number;
|
|
49
|
+
equityWithLoanAfter?: number;
|
|
50
|
+
commission?: number;
|
|
51
|
+
commissionCurrency?: string;
|
|
52
|
+
warningText?: string;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export interface BrokerOrder {
|
|
56
|
+
orderId: number;
|
|
57
|
+
brokerInstanceId?: string;
|
|
58
|
+
accountId?: string;
|
|
59
|
+
status: string;
|
|
60
|
+
action: BrokerOrderAction;
|
|
61
|
+
orderType: string;
|
|
62
|
+
quantity: number;
|
|
63
|
+
filled: number;
|
|
64
|
+
remaining: number;
|
|
65
|
+
avgFillPrice?: number;
|
|
66
|
+
limitPrice?: number;
|
|
67
|
+
stopPrice?: number;
|
|
68
|
+
tif?: string;
|
|
69
|
+
warningText?: string;
|
|
70
|
+
updatedAt: number;
|
|
71
|
+
contract: BrokerContractRef;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export interface BrokerExecution {
|
|
75
|
+
execId: string;
|
|
76
|
+
brokerInstanceId?: string;
|
|
77
|
+
orderId?: number;
|
|
78
|
+
accountId?: string;
|
|
79
|
+
side: string;
|
|
80
|
+
shares: number;
|
|
81
|
+
price: number;
|
|
82
|
+
time: number;
|
|
83
|
+
exchange?: string;
|
|
84
|
+
contract: BrokerContractRef;
|
|
85
|
+
}
|