openalgo-charts 1.0.3 → 1.0.4
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/dist/index.d.ts +76 -7
- package/dist/openalgo-charts.mjs +1 -1
- package/dist/openalgo-charts.mjs.map +1 -1
- package/dist/openalgo-charts.standalone.js +1 -1
- package/dist/openalgo-charts.standalone.js.map +1 -1
- package/dist/openalgo-charts.trade.mjs +1 -1
- package/dist/openalgo-charts.trade.mjs.map +1 -1
- package/dist/profile/index.d.ts +4 -0
- package/dist/trade/index.d.ts +30 -12
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Library version string. Matches package.json (published npm release). */
|
|
2
|
-
declare const VERSION = "1.0.
|
|
2
|
+
declare const VERSION = "1.0.4";
|
|
3
3
|
/** Returns the current library version. */
|
|
4
4
|
declare function version(): string;
|
|
5
5
|
|
|
@@ -492,6 +492,10 @@ interface PrimitiveRenderContext {
|
|
|
492
492
|
priceAxisWidth: number;
|
|
493
493
|
dpr: number;
|
|
494
494
|
theme: ChartTheme;
|
|
495
|
+
/** externalId of the primitive hit under the pointer (hover state), if any. */
|
|
496
|
+
hoverId?: string | null;
|
|
497
|
+
/** externalId of the line being dragged (active state), if any. */
|
|
498
|
+
dragId?: string | null;
|
|
495
499
|
}
|
|
496
500
|
interface PrimitiveHit {
|
|
497
501
|
externalId: string;
|
|
@@ -634,6 +638,10 @@ interface PaneRenderContext {
|
|
|
634
638
|
showHorzGrid: boolean;
|
|
635
639
|
/** Optional custom time label formatter (UTC seconds -> string). Defaults to IST. */
|
|
636
640
|
timeFormatter?: (utcSeconds: number, tickMark?: TickMarkType) => string;
|
|
641
|
+
/** externalId of the primitive under the pointer (hover visual state). */
|
|
642
|
+
hoverId?: string | null;
|
|
643
|
+
/** externalId of the line currently being dragged (active visual state). */
|
|
644
|
+
dragId?: string | null;
|
|
637
645
|
}
|
|
638
646
|
declare class Pane {
|
|
639
647
|
readonly element: HTMLElement;
|
|
@@ -946,8 +954,8 @@ declare class TradingController {
|
|
|
946
954
|
private _renderTrades;
|
|
947
955
|
private _sync;
|
|
948
956
|
private _sig;
|
|
957
|
+
/** Info segment for a position: live P&L text (side/size live in badge/qty). */
|
|
949
958
|
private _positionPill;
|
|
950
|
-
private _orderPill;
|
|
951
959
|
private _positionOpts;
|
|
952
960
|
private _orderOpts;
|
|
953
961
|
private _onClick;
|
|
@@ -958,7 +966,11 @@ declare class TradingController {
|
|
|
958
966
|
/**
|
|
959
967
|
* Horizontal price line primitive (ARCHITECTURE.md §8). The reusable base for
|
|
960
968
|
* order/SL/TP/alert/indicator-level lines: a line across the plot plus a fixed
|
|
961
|
-
* right-axis price tag
|
|
969
|
+
* right-axis price tag and an optional broker-style segmented pill group on the
|
|
970
|
+
* line — [badge][qty][label][✕] — with hover / dragging states (the chart
|
|
971
|
+
* passes `hoverId`/`dragId` on the render context) and a drag ghost at the
|
|
972
|
+
* pre-drag price via `setDragGhost`. Interaction semantics are unchanged from
|
|
973
|
+
* the classic tag: the ✕ hit-tests as `${id}::close`, everything else drags.
|
|
962
974
|
*/
|
|
963
975
|
|
|
964
976
|
interface PriceLineOptions {
|
|
@@ -968,7 +980,11 @@ interface PriceLineOptions {
|
|
|
968
980
|
dashed: boolean;
|
|
969
981
|
/** Right-axis tag text. Defaults to the formatted price. */
|
|
970
982
|
label?: string;
|
|
971
|
-
/**
|
|
983
|
+
/** Solid colored badge segment at the start of the pill group (e.g. 'BUY', 'TP', 'SL'). */
|
|
984
|
+
badge?: string;
|
|
985
|
+
/** Quantity segment rendered as a neutral box after the badge. */
|
|
986
|
+
qty?: string | number;
|
|
987
|
+
/** Info text segment (order type, price, P&L ...) — the classic left tag text. */
|
|
972
988
|
leftLabel?: string;
|
|
973
989
|
/**
|
|
974
990
|
* Fraction of the plot width the line spans, measured from the right (price)
|
|
@@ -976,7 +992,7 @@ interface PriceLineOptions {
|
|
|
976
992
|
* partial-width order line. The right-axis tag is always drawn.
|
|
977
993
|
*/
|
|
978
994
|
extentFromRight?: number;
|
|
979
|
-
/** Draw a
|
|
995
|
+
/** Draw a cancel (✕) segment at the end of the pill group; hit-tests as `${id}::close`. */
|
|
980
996
|
closeButton?: boolean;
|
|
981
997
|
/** Stable id returned by hit-test (for click/drag routing). */
|
|
982
998
|
id: string;
|
|
@@ -986,14 +1002,22 @@ interface PriceLineOptions {
|
|
|
986
1002
|
declare class PriceLine implements IPrimitive {
|
|
987
1003
|
private _opts;
|
|
988
1004
|
private _host;
|
|
1005
|
+
private _ghostPrice;
|
|
1006
|
+
/** Pill-group geometry from the last draw (media px) for hit-testing. */
|
|
1007
|
+
private _group;
|
|
989
1008
|
constructor(opts: PriceLineOptions);
|
|
990
1009
|
attached(host: PrimitiveHost): void;
|
|
991
1010
|
detached(): void;
|
|
992
1011
|
get price(): number;
|
|
993
1012
|
/** Move the line; schedules a repaint via the host. */
|
|
994
1013
|
setPrice(price: number): void;
|
|
995
|
-
/** Update the
|
|
1014
|
+
/** Update the info segment text (e.g. live position P&L); repaints. */
|
|
996
1015
|
setLeftLabel(text: string): void;
|
|
1016
|
+
/**
|
|
1017
|
+
* Show a dimmed reference line at the pre-drag price while the user drags
|
|
1018
|
+
* (pass the original price on drag start, null on drag end to clear).
|
|
1019
|
+
*/
|
|
1020
|
+
setDragGhost(price: number | null): void;
|
|
997
1021
|
options(): Readonly<PriceLineOptions>;
|
|
998
1022
|
zOrder(): ZOrder;
|
|
999
1023
|
autoscaleInfo(): {
|
|
@@ -1194,6 +1218,7 @@ declare class Chart {
|
|
|
1194
1218
|
private _downX;
|
|
1195
1219
|
private _downLocalY;
|
|
1196
1220
|
private _dragId;
|
|
1221
|
+
private _hoverId;
|
|
1197
1222
|
private _dragCb;
|
|
1198
1223
|
private _dragEndCb;
|
|
1199
1224
|
private _axisDrag;
|
|
@@ -1360,9 +1385,21 @@ declare class Chart {
|
|
|
1360
1385
|
private _shortcutsActive;
|
|
1361
1386
|
/** Execute a built-in command; returns false for unknown (custom) commands. */
|
|
1362
1387
|
private _runShortcut;
|
|
1363
|
-
|
|
1388
|
+
/**
|
|
1389
|
+
* Composite the full chart (all panes + overlays) and trigger a PNG download.
|
|
1390
|
+
* This is what the screenshot keyboard shortcut runs; call it from a toolbar
|
|
1391
|
+
* button for a reliable "save image" — the browser's native right-click
|
|
1392
|
+
* "Save image as…" captures only the topmost (transparent overlay) canvas.
|
|
1393
|
+
*/
|
|
1394
|
+
downloadScreenshot(filename?: string): void;
|
|
1364
1395
|
/** Refresh the polite live-region summary screen readers announce. */
|
|
1365
1396
|
private _updateAccessibleSummary;
|
|
1397
|
+
/**
|
|
1398
|
+
* Track the primitive under the pointer: apply its cursor hint to the
|
|
1399
|
+
* container and repaint on hover enter/leave so lines/pills can render
|
|
1400
|
+
* hover states (they read `hoverId` off the render context).
|
|
1401
|
+
*/
|
|
1402
|
+
private _setHover;
|
|
1366
1403
|
private _updateCursor;
|
|
1367
1404
|
private _maybeLoadHistory;
|
|
1368
1405
|
private _startKinetic;
|
|
@@ -1799,6 +1836,32 @@ interface LtpEvent {
|
|
|
1799
1836
|
volume?: number;
|
|
1800
1837
|
timeSec: number;
|
|
1801
1838
|
}
|
|
1839
|
+
/**
|
|
1840
|
+
* Real-time order lifecycle event from the `subscribe_orders` stream — fills,
|
|
1841
|
+
* partial fills, rejections, cancellations, pushed by the broker (or by the
|
|
1842
|
+
* sandbox engine in analyze mode).
|
|
1843
|
+
*/
|
|
1844
|
+
interface OrderUpdateEvent {
|
|
1845
|
+
orderId: string;
|
|
1846
|
+
symbol: string;
|
|
1847
|
+
exchange: string;
|
|
1848
|
+
action: 'BUY' | 'SELL';
|
|
1849
|
+
quantity: number;
|
|
1850
|
+
price: number;
|
|
1851
|
+
/** Undefined when the broker reports 0 (plain LIMIT/MARKET). */
|
|
1852
|
+
triggerPrice?: number;
|
|
1853
|
+
pricetype: string;
|
|
1854
|
+
product: string;
|
|
1855
|
+
/** Lowercase OpenAlgo status: open | trigger pending | complete | rejected | cancelled | ... */
|
|
1856
|
+
status: string;
|
|
1857
|
+
filledQuantity: number;
|
|
1858
|
+
pendingQuantity: number;
|
|
1859
|
+
averagePrice: number;
|
|
1860
|
+
/** Broker RMS/OMS text when rejected. */
|
|
1861
|
+
rejectionReason: string;
|
|
1862
|
+
/** 'live' for broker events, 'analyze' for sandbox events. */
|
|
1863
|
+
mode: string;
|
|
1864
|
+
}
|
|
1802
1865
|
/**
|
|
1803
1866
|
* Pure: build a subscribe message — `{ action, symbol, exchange, mode }`, where
|
|
1804
1867
|
* `mode` is the numeric OpenAlgo data mode. Depth subscriptions may request a
|
|
@@ -1830,6 +1893,8 @@ declare class OpenAlgoWsFeed {
|
|
|
1830
1893
|
private readonly _depthCbs;
|
|
1831
1894
|
private readonly _stateCbs;
|
|
1832
1895
|
private readonly _controlCbs;
|
|
1896
|
+
private readonly _orderCbs;
|
|
1897
|
+
private _ordersSubscribed;
|
|
1833
1898
|
private readonly _subs;
|
|
1834
1899
|
private _userClosed;
|
|
1835
1900
|
private _attempts;
|
|
@@ -1855,6 +1920,10 @@ declare class OpenAlgoWsFeed {
|
|
|
1855
1920
|
onDepth(cb: (symbol: string, exchange: string, depth: MarketDepth) => void): () => void;
|
|
1856
1921
|
subscribe(mode: WsMode, symbol: string, exchange: string, depthLevel?: number): void;
|
|
1857
1922
|
unsubscribe(mode: WsMode, symbol: string, exchange: string): void;
|
|
1923
|
+
/** Subscribe to real-time order updates (fills / cancels / rejections). Account-level; replayed on reconnect. */
|
|
1924
|
+
onOrderUpdate(cb: (e: OrderUpdateEvent) => void): () => void;
|
|
1925
|
+
subscribeOrders(): void;
|
|
1926
|
+
unsubscribeOrders(): void;
|
|
1858
1927
|
close(): void;
|
|
1859
1928
|
private _dispatch;
|
|
1860
1929
|
}
|