hyperprop-charting-library 0.1.93 → 0.1.94

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.
@@ -2524,7 +2524,13 @@ function createChart(element, options = {}) {
2524
2524
  const qtyRaw = riskAmount > 0 && stopDist > 0 ? riskAmount / (stopDist * effectivePointValue) : 0;
2525
2525
  const hasMoney = qtyRaw > 0 && Number.isFinite(qtyRaw);
2526
2526
  const qtyText = hasMoney ? qtyRaw.toFixed(Math.max(0, drawing.qtyPrecision)) : "";
2527
- const formatAmount = (value) => value.toFixed(2);
2527
+ const formatAmount = (value) => {
2528
+ const abs = Math.abs(value);
2529
+ if (abs >= 1e9) return `${(value / 1e9).toFixed(2)}B`;
2530
+ if (abs >= 1e6) return `${(value / 1e6).toFixed(2)}M`;
2531
+ if (abs >= 1e3) return `${(value / 1e3).toFixed(2)}K`;
2532
+ return value.toFixed(2);
2533
+ };
2528
2534
  const targetAmountText = hasMoney ? `, Amount: ${formatAmount(qtyRaw * target.price * effectivePointValue)}` : "";
2529
2535
  const stopAmountText = hasMoney ? `, Amount: ${formatAmount(qtyRaw * stop.price * effectivePointValue)}` : "";
2530
2536
  const drawPositionPill = (text, leftX2, centerY, bg) => {
@@ -2498,7 +2498,13 @@ function createChart(element, options = {}) {
2498
2498
  const qtyRaw = riskAmount > 0 && stopDist > 0 ? riskAmount / (stopDist * effectivePointValue) : 0;
2499
2499
  const hasMoney = qtyRaw > 0 && Number.isFinite(qtyRaw);
2500
2500
  const qtyText = hasMoney ? qtyRaw.toFixed(Math.max(0, drawing.qtyPrecision)) : "";
2501
- const formatAmount = (value) => value.toFixed(2);
2501
+ const formatAmount = (value) => {
2502
+ const abs = Math.abs(value);
2503
+ if (abs >= 1e9) return `${(value / 1e9).toFixed(2)}B`;
2504
+ if (abs >= 1e6) return `${(value / 1e6).toFixed(2)}M`;
2505
+ if (abs >= 1e3) return `${(value / 1e3).toFixed(2)}K`;
2506
+ return value.toFixed(2);
2507
+ };
2502
2508
  const targetAmountText = hasMoney ? `, Amount: ${formatAmount(qtyRaw * target.price * effectivePointValue)}` : "";
2503
2509
  const stopAmountText = hasMoney ? `, Amount: ${formatAmount(qtyRaw * stop.price * effectivePointValue)}` : "";
2504
2510
  const drawPositionPill = (text, leftX2, centerY, bg) => {
package/dist/index.cjs CHANGED
@@ -2524,7 +2524,13 @@ function createChart(element, options = {}) {
2524
2524
  const qtyRaw = riskAmount > 0 && stopDist > 0 ? riskAmount / (stopDist * effectivePointValue) : 0;
2525
2525
  const hasMoney = qtyRaw > 0 && Number.isFinite(qtyRaw);
2526
2526
  const qtyText = hasMoney ? qtyRaw.toFixed(Math.max(0, drawing.qtyPrecision)) : "";
2527
- const formatAmount = (value) => value.toFixed(2);
2527
+ const formatAmount = (value) => {
2528
+ const abs = Math.abs(value);
2529
+ if (abs >= 1e9) return `${(value / 1e9).toFixed(2)}B`;
2530
+ if (abs >= 1e6) return `${(value / 1e6).toFixed(2)}M`;
2531
+ if (abs >= 1e3) return `${(value / 1e3).toFixed(2)}K`;
2532
+ return value.toFixed(2);
2533
+ };
2528
2534
  const targetAmountText = hasMoney ? `, Amount: ${formatAmount(qtyRaw * target.price * effectivePointValue)}` : "";
2529
2535
  const stopAmountText = hasMoney ? `, Amount: ${formatAmount(qtyRaw * stop.price * effectivePointValue)}` : "";
2530
2536
  const drawPositionPill = (text, leftX2, centerY, bg) => {
package/dist/index.js CHANGED
@@ -2498,7 +2498,13 @@ function createChart(element, options = {}) {
2498
2498
  const qtyRaw = riskAmount > 0 && stopDist > 0 ? riskAmount / (stopDist * effectivePointValue) : 0;
2499
2499
  const hasMoney = qtyRaw > 0 && Number.isFinite(qtyRaw);
2500
2500
  const qtyText = hasMoney ? qtyRaw.toFixed(Math.max(0, drawing.qtyPrecision)) : "";
2501
- const formatAmount = (value) => value.toFixed(2);
2501
+ const formatAmount = (value) => {
2502
+ const abs = Math.abs(value);
2503
+ if (abs >= 1e9) return `${(value / 1e9).toFixed(2)}B`;
2504
+ if (abs >= 1e6) return `${(value / 1e6).toFixed(2)}M`;
2505
+ if (abs >= 1e3) return `${(value / 1e3).toFixed(2)}K`;
2506
+ return value.toFixed(2);
2507
+ };
2502
2508
  const targetAmountText = hasMoney ? `, Amount: ${formatAmount(qtyRaw * target.price * effectivePointValue)}` : "";
2503
2509
  const stopAmountText = hasMoney ? `, Amount: ${formatAmount(qtyRaw * stop.price * effectivePointValue)}` : "";
2504
2510
  const drawPositionPill = (text, leftX2, centerY, bg) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hyperprop-charting-library",
3
- "version": "0.1.93",
3
+ "version": "0.1.94",
4
4
  "description": "Lightweight TypeScript charting core",
5
5
  "type": "module",
6
6
  "main": "./dist/hyperprop-charting-library.cjs",