openalgo-charts 1.0.5 → 1.0.7
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
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.6";
|
|
3
3
|
/** Returns the current library version. */
|
|
4
4
|
declare function version(): string;
|
|
5
5
|
|
|
@@ -1385,6 +1385,19 @@ declare class Chart {
|
|
|
1385
1385
|
private readonly _onPointerDown;
|
|
1386
1386
|
private readonly _onPointerMove;
|
|
1387
1387
|
private readonly _onPointerUp;
|
|
1388
|
+
/**
|
|
1389
|
+
* DOM pointerup entry point. Mirrors the primary-button guard in
|
|
1390
|
+
* `_onPointerDown`: a right-click (or any non-primary mouse button) fires
|
|
1391
|
+
* pointerdown *and* pointerup, but `_onPointerDown` ignores it — so the
|
|
1392
|
+
* down state (`_downX`/`_downLocalY`/`_downPane`/`_pointerMoved`) is never
|
|
1393
|
+
* refreshed and still holds the *previous* left-click. Letting a non-primary
|
|
1394
|
+
* pointerup through would re-run the click branch against that stale position
|
|
1395
|
+
* and replay the last click (e.g. re-firing a Buy/Sell button → a phantom
|
|
1396
|
+
* order). Touch/pen are unaffected (they contact with button 0). The internal
|
|
1397
|
+
* recovery call from `_onPointerMove` invokes `_onPointerUp` directly, so it
|
|
1398
|
+
* bypasses this filter and still ends a drag when a button release is missed.
|
|
1399
|
+
*/
|
|
1400
|
+
private readonly _onPointerUpNative;
|
|
1388
1401
|
private readonly _onPointerLeave;
|
|
1389
1402
|
private readonly _onWheel;
|
|
1390
1403
|
/**
|
|
@@ -1591,6 +1604,78 @@ declare class LogoWatermark implements IPrimitive {
|
|
|
1591
1604
|
private _tinted;
|
|
1592
1605
|
}
|
|
1593
1606
|
|
|
1607
|
+
/**
|
|
1608
|
+
* Inline Buy/Sell button panel (ARCHITECTURE.md §9). A TradingView-style trade
|
|
1609
|
+
* panel docked inside the plot: a SELL button (bid), a quantity chip, and a BUY
|
|
1610
|
+
* button (ask), drawn on the overlay canvas so it stays fixed while the chart
|
|
1611
|
+
* pans/zooms. Clicks hit-test to `${id}:sell` / `${id}:buy` / `${id}:qty`, which
|
|
1612
|
+
* the chart routes through `subscribeClick` — the app places the order. Prices
|
|
1613
|
+
* update cheaply on every tick (`setPrices` / `setMark`).
|
|
1614
|
+
*/
|
|
1615
|
+
|
|
1616
|
+
interface BuySellButtonsOptions {
|
|
1617
|
+
/** Stable id prefix; hit-tests emit `${id}:sell` / `${id}:buy` / `${id}:qty`. Default `trade`. */
|
|
1618
|
+
id?: string;
|
|
1619
|
+
/** Corner to dock to. Default `top-left`. */
|
|
1620
|
+
position?: WatermarkPosition;
|
|
1621
|
+
/**
|
|
1622
|
+
* Gap from the plot edges in media px. A number applies to both axes; pass
|
|
1623
|
+
* `{ x, y }` to offset independently (e.g. clear an OHLC legend at the top).
|
|
1624
|
+
*/
|
|
1625
|
+
margin?: number | {
|
|
1626
|
+
x: number;
|
|
1627
|
+
y: number;
|
|
1628
|
+
};
|
|
1629
|
+
/** Quantity shown in the centre chip (e.g. lots or absolute qty). */
|
|
1630
|
+
qty?: string | number;
|
|
1631
|
+
/** Buy button color (defaults to the theme `buy`). */
|
|
1632
|
+
buyColor?: string;
|
|
1633
|
+
/** Sell button color (defaults to the theme `sell`). */
|
|
1634
|
+
sellColor?: string;
|
|
1635
|
+
/** Button labels. Default `BUY` / `SELL`. */
|
|
1636
|
+
buyLabel?: string;
|
|
1637
|
+
sellLabel?: string;
|
|
1638
|
+
/** Show the price line above each label. Default true. */
|
|
1639
|
+
showPrices?: boolean;
|
|
1640
|
+
}
|
|
1641
|
+
declare class BuySellButtons implements IPrimitive {
|
|
1642
|
+
private readonly _id;
|
|
1643
|
+
private readonly _position;
|
|
1644
|
+
private readonly _mx;
|
|
1645
|
+
private readonly _my;
|
|
1646
|
+
private readonly _buyLabel;
|
|
1647
|
+
private readonly _sellLabel;
|
|
1648
|
+
private readonly _showPrices;
|
|
1649
|
+
private _qty;
|
|
1650
|
+
private _buyColor?;
|
|
1651
|
+
private _sellColor?;
|
|
1652
|
+
private _bid;
|
|
1653
|
+
private _ask;
|
|
1654
|
+
private _host;
|
|
1655
|
+
private _sellRect;
|
|
1656
|
+
private _buyRect;
|
|
1657
|
+
private _qtyRect;
|
|
1658
|
+
constructor(options?: BuySellButtonsOptions);
|
|
1659
|
+
attached(host: PrimitiveHost): void;
|
|
1660
|
+
detached(): void;
|
|
1661
|
+
zOrder(): ZOrder;
|
|
1662
|
+
autoscaleInfo(): null;
|
|
1663
|
+
/** Distinct bid/ask (shows a spread on the two buttons). */
|
|
1664
|
+
setPrices(bid: number, ask: number): void;
|
|
1665
|
+
/** Single mark price shown on both buttons (when there is no bid/ask). */
|
|
1666
|
+
setMark(price: number): void;
|
|
1667
|
+
setQty(qty: string | number): void;
|
|
1668
|
+
setColors(buyColor?: string, sellColor?: string): void;
|
|
1669
|
+
private _origin;
|
|
1670
|
+
draw(ctx: CanvasRenderingContext2D, rc: PrimitiveRenderContext): void;
|
|
1671
|
+
private _fmt;
|
|
1672
|
+
private _drawButton;
|
|
1673
|
+
private _drawChip;
|
|
1674
|
+
/** Trace a rect rounded on the left or right pair of corners only. */
|
|
1675
|
+
private _roundedSide;
|
|
1676
|
+
hitTest(x: number, y: number, _rc: PrimitiveRenderContext): PrimitiveHit | null;
|
|
1677
|
+
}
|
|
1678
|
+
|
|
1594
1679
|
/**
|
|
1595
1680
|
* Exponential moving average (ARCHITECTURE.md §8 — an indicator that validates
|
|
1596
1681
|
* the series/extensibility model). Pure; the result is plotted as a `line`
|
|
@@ -2239,4 +2324,4 @@ declare function lerp(a: number, b: number, t: number): number;
|
|
|
2239
2324
|
*/
|
|
2240
2325
|
declare function roundToTick(value: number, step: number): number;
|
|
2241
2326
|
|
|
2242
|
-
export { ALT_PRESET, type AddSeriesOptions, type AggTick, BUILTIN_COMMANDS, type Bar, type BarUpdate, type BarsRequest, CandleBuilder, type CandleBuilderOptions, type CandleStyle, type CandleUpdate, Chart, type ChartEvent, type ChartOptions, type ChartTheme, type CrosshairMoveEvent, type CustomShortcut, DEFAULT_CANDLE_BUILDER_OPTIONS, DEFAULT_CANDLE_STYLE, DEFAULT_HISTOGRAM_STYLE, DEFAULT_KEYMAP, DEFAULT_PRICE_SCALE_OPTIONS, DEFAULT_THEME, DEFAULT_TIME_SCALE_OPTIONS, DEFAULT_TRADING_COLORS, type DataFeed, type DepthLevel, type DrawItem, EventMarkers, FakeDataFeed, type FeedScheduler, type HistogramStyle, type IPrimitive, IST_OFFSET_SECONDS, InvalidationLevel, type KeymapEntry, type LateTickPolicy, type LinePoint, type LogicalRange, LogoWatermark, type LogoWatermarkOptions, type LtpEvent, type MarkerPosition, type MarkerShape, type MarkerSize, type MarketDepth, type OpenAlgoConfig, OpenAlgoDataFeed, type OpenAlgoLiveConfig, OpenAlgoLiveDataFeed, type OpenAlgoTradeConfig, OpenAlgoTradeFeed, type OpenAlgoWsConfig, OpenAlgoWsFeed, type OrderSide$1 as OrderSide, type OrderType$1 as OrderType, type OriginalTime, Pane, type PaneInvalidation, type PlaceOrder, type PositionSide, PriceLine, type PriceLineOptions, type PriceRange, PriceScale, type PriceScaleId, type PriceScaleMode, type PriceScaleOptions, type PrimitiveHit, type PrimitiveHost, type PrimitiveRenderContext, type RendererEntry, type SeriesApi, type SeriesDataItem, type SeriesMarker, SeriesMarkers, type SeriesRenderContext, type SeriesStyle, type SeriesType, type ShortcutListItem, ShortcutManager, type ShortcutManagerOptions, type ShortcutPreset, type ShortcutScope, type ShortcutTriggerEvent, type Size, type SocketFactory, type SocketLike, type SupertrendPoint, type Tick, TickBarAggregator, type TickMarkType, type TickTimeframe, TimeScale, type TimeScaleOp, type TimeScaleOptions, type TradeFeed, type TradeMarkerVariant, TradeMarkersPrimitive, type TradingColors, TradingController, type TradingHost, type TradingLineStyle, type TradingLineVariant, type TradingOrder, type TradingOrderSide, type TradingOrderType, type TradingPosition, type TradingSettings, type TradingSyncPayload, type TradingTrade, type UTCSeconds, type UnsubscribeFn, VERSION, type VolumeMode, type WatermarkPosition, type Whitespace, type WsControlMessage, type WsMode, type WsState, type ZOrder, atr, autoscaleRange, bestHit, bitmapSize, clamp, compactVolume, conflateBars, conflateItems, conflationGroupSize, createChart, darkTheme, drawShape, effectiveMarkerPx, ema, emaSeries, epochMsToUtcSeconds, eventToCombo, formatCombo, formatIstDate, formatIstTime, formatIstTimeSeconds, formatSubscribe, formatUnsubscribe, generateBars, getChartType, intervalToSeconds, isNewIstDay, isReservedCombo, isValidCombo, isWhitespace, istStringToUtcSeconds, lerp, lightTheme, mapHistoryResponse, mapOrder, mapPosition, markerSizePx, mergeBars, niceTicks, normalizeCombo, optimalBarWidth, parseCombo, parseMessage, precisionForStep, registerChartType, registeredChartTypes, roundToTick, rowTimeToUtcSeconds, rsi, rsiSeries, snapToDevicePixel, supertrend, supertrendSeries, toBar, trueRange, utcSecondsToIstDateString, utcSecondsToIstParts, version, verticalGradient, watermarkRect };
|
|
2327
|
+
export { ALT_PRESET, type AddSeriesOptions, type AggTick, BUILTIN_COMMANDS, type Bar, type BarUpdate, type BarsRequest, BuySellButtons, type BuySellButtonsOptions, CandleBuilder, type CandleBuilderOptions, type CandleStyle, type CandleUpdate, Chart, type ChartEvent, type ChartOptions, type ChartTheme, type CrosshairMoveEvent, type CustomShortcut, DEFAULT_CANDLE_BUILDER_OPTIONS, DEFAULT_CANDLE_STYLE, DEFAULT_HISTOGRAM_STYLE, DEFAULT_KEYMAP, DEFAULT_PRICE_SCALE_OPTIONS, DEFAULT_THEME, DEFAULT_TIME_SCALE_OPTIONS, DEFAULT_TRADING_COLORS, type DataFeed, type DepthLevel, type DrawItem, EventMarkers, FakeDataFeed, type FeedScheduler, type HistogramStyle, type IPrimitive, IST_OFFSET_SECONDS, InvalidationLevel, type KeymapEntry, type LateTickPolicy, type LinePoint, type LogicalRange, LogoWatermark, type LogoWatermarkOptions, type LtpEvent, type MarkerPosition, type MarkerShape, type MarkerSize, type MarketDepth, type OpenAlgoConfig, OpenAlgoDataFeed, type OpenAlgoLiveConfig, OpenAlgoLiveDataFeed, type OpenAlgoTradeConfig, OpenAlgoTradeFeed, type OpenAlgoWsConfig, OpenAlgoWsFeed, type OrderSide$1 as OrderSide, type OrderType$1 as OrderType, type OriginalTime, Pane, type PaneInvalidation, type PlaceOrder, type PositionSide, PriceLine, type PriceLineOptions, type PriceRange, PriceScale, type PriceScaleId, type PriceScaleMode, type PriceScaleOptions, type PrimitiveHit, type PrimitiveHost, type PrimitiveRenderContext, type RendererEntry, type SeriesApi, type SeriesDataItem, type SeriesMarker, SeriesMarkers, type SeriesRenderContext, type SeriesStyle, type SeriesType, type ShortcutListItem, ShortcutManager, type ShortcutManagerOptions, type ShortcutPreset, type ShortcutScope, type ShortcutTriggerEvent, type Size, type SocketFactory, type SocketLike, type SupertrendPoint, type Tick, TickBarAggregator, type TickMarkType, type TickTimeframe, TimeScale, type TimeScaleOp, type TimeScaleOptions, type TradeFeed, type TradeMarkerVariant, TradeMarkersPrimitive, type TradingColors, TradingController, type TradingHost, type TradingLineStyle, type TradingLineVariant, type TradingOrder, type TradingOrderSide, type TradingOrderType, type TradingPosition, type TradingSettings, type TradingSyncPayload, type TradingTrade, type UTCSeconds, type UnsubscribeFn, VERSION, type VolumeMode, type WatermarkPosition, type Whitespace, type WsControlMessage, type WsMode, type WsState, type ZOrder, atr, autoscaleRange, bestHit, bitmapSize, clamp, compactVolume, conflateBars, conflateItems, conflationGroupSize, createChart, darkTheme, drawShape, effectiveMarkerPx, ema, emaSeries, epochMsToUtcSeconds, eventToCombo, formatCombo, formatIstDate, formatIstTime, formatIstTimeSeconds, formatSubscribe, formatUnsubscribe, generateBars, getChartType, intervalToSeconds, isNewIstDay, isReservedCombo, isValidCombo, isWhitespace, istStringToUtcSeconds, lerp, lightTheme, mapHistoryResponse, mapOrder, mapPosition, markerSizePx, mergeBars, niceTicks, normalizeCombo, optimalBarWidth, parseCombo, parseMessage, precisionForStep, registerChartType, registeredChartTypes, roundToTick, rowTimeToUtcSeconds, rsi, rsiSeries, snapToDevicePixel, supertrend, supertrendSeries, toBar, trueRange, utcSecondsToIstDateString, utcSecondsToIstParts, version, verticalGradient, watermarkRect };
|