openalgo-charts 1.0.5 → 1.0.6

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.5";
2
+ declare const VERSION = "1.0.6";
3
3
  /** Returns the current library version. */
4
4
  declare function version(): string;
5
5
 
@@ -1591,6 +1591,78 @@ declare class LogoWatermark implements IPrimitive {
1591
1591
  private _tinted;
1592
1592
  }
1593
1593
 
1594
+ /**
1595
+ * Inline Buy/Sell button panel (ARCHITECTURE.md §9). A TradingView-style trade
1596
+ * panel docked inside the plot: a SELL button (bid), a quantity chip, and a BUY
1597
+ * button (ask), drawn on the overlay canvas so it stays fixed while the chart
1598
+ * pans/zooms. Clicks hit-test to `${id}:sell` / `${id}:buy` / `${id}:qty`, which
1599
+ * the chart routes through `subscribeClick` — the app places the order. Prices
1600
+ * update cheaply on every tick (`setPrices` / `setMark`).
1601
+ */
1602
+
1603
+ interface BuySellButtonsOptions {
1604
+ /** Stable id prefix; hit-tests emit `${id}:sell` / `${id}:buy` / `${id}:qty`. Default `trade`. */
1605
+ id?: string;
1606
+ /** Corner to dock to. Default `top-left`. */
1607
+ position?: WatermarkPosition;
1608
+ /**
1609
+ * Gap from the plot edges in media px. A number applies to both axes; pass
1610
+ * `{ x, y }` to offset independently (e.g. clear an OHLC legend at the top).
1611
+ */
1612
+ margin?: number | {
1613
+ x: number;
1614
+ y: number;
1615
+ };
1616
+ /** Quantity shown in the centre chip (e.g. lots or absolute qty). */
1617
+ qty?: string | number;
1618
+ /** Buy button color (defaults to the theme `buy`). */
1619
+ buyColor?: string;
1620
+ /** Sell button color (defaults to the theme `sell`). */
1621
+ sellColor?: string;
1622
+ /** Button labels. Default `BUY` / `SELL`. */
1623
+ buyLabel?: string;
1624
+ sellLabel?: string;
1625
+ /** Show the price line above each label. Default true. */
1626
+ showPrices?: boolean;
1627
+ }
1628
+ declare class BuySellButtons implements IPrimitive {
1629
+ private readonly _id;
1630
+ private readonly _position;
1631
+ private readonly _mx;
1632
+ private readonly _my;
1633
+ private readonly _buyLabel;
1634
+ private readonly _sellLabel;
1635
+ private readonly _showPrices;
1636
+ private _qty;
1637
+ private _buyColor?;
1638
+ private _sellColor?;
1639
+ private _bid;
1640
+ private _ask;
1641
+ private _host;
1642
+ private _sellRect;
1643
+ private _buyRect;
1644
+ private _qtyRect;
1645
+ constructor(options?: BuySellButtonsOptions);
1646
+ attached(host: PrimitiveHost): void;
1647
+ detached(): void;
1648
+ zOrder(): ZOrder;
1649
+ autoscaleInfo(): null;
1650
+ /** Distinct bid/ask (shows a spread on the two buttons). */
1651
+ setPrices(bid: number, ask: number): void;
1652
+ /** Single mark price shown on both buttons (when there is no bid/ask). */
1653
+ setMark(price: number): void;
1654
+ setQty(qty: string | number): void;
1655
+ setColors(buyColor?: string, sellColor?: string): void;
1656
+ private _origin;
1657
+ draw(ctx: CanvasRenderingContext2D, rc: PrimitiveRenderContext): void;
1658
+ private _fmt;
1659
+ private _drawButton;
1660
+ private _drawChip;
1661
+ /** Trace a rect rounded on the left or right pair of corners only. */
1662
+ private _roundedSide;
1663
+ hitTest(x: number, y: number, _rc: PrimitiveRenderContext): PrimitiveHit | null;
1664
+ }
1665
+
1594
1666
  /**
1595
1667
  * Exponential moving average (ARCHITECTURE.md §8 — an indicator that validates
1596
1668
  * the series/extensibility model). Pure; the result is plotted as a `line`
@@ -2239,4 +2311,4 @@ declare function lerp(a: number, b: number, t: number): number;
2239
2311
  */
2240
2312
  declare function roundToTick(value: number, step: number): number;
2241
2313
 
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 };
2314
+ 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 };