@tradecanvas/commons 1.56.0 → 1.59.0
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/i18n/index.d.ts +3 -0
- package/dist/i18n/index.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +453 -251
- package/dist/index.js.map +1 -1
- package/dist/market/index.d.ts +1 -1
- package/dist/market/index.d.ts.map +1 -1
- package/dist/market/presets.d.ts +30 -0
- package/dist/market/presets.d.ts.map +1 -1
- package/dist/market/types.d.ts +8 -1
- package/dist/market/types.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/market/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export type { MarketType, StockExchange, MarketConfig, PriceStepBand, TradingSession, MarketColorScheme, PriceLimitInfo, VN30FContract } from './types.js';
|
|
2
|
-
export { VN_COLORS, HOSE_SESSIONS, HNX_SESSIONS, UPCOM_SESSIONS, VN30F_SESSIONS, MARKET_HOSE, MARKET_HOSE_ETF, MARKET_HNX, MARKET_UPCOM, MARKET_VN30F, MARKET_CRYPTO, MARKET_NYSE, createVNTheme, priceStepAt, roundToPriceStep, computePriceLimits, scaleMarketPrices, getCurrentSession, vn30fLastTradingDay, vn30fContracts, } from './presets.js';
|
|
2
|
+
export { VN_COLORS, KR_COLORS, KRX_SESSIONS, NXT_SESSIONS, MARKET_KRX, MARKET_NXT, MARKET_UPBIT_KRW, createMarketTheme, HOSE_SESSIONS, HNX_SESSIONS, UPCOM_SESSIONS, VN30F_SESSIONS, MARKET_HOSE, MARKET_HOSE_ETF, MARKET_HNX, MARKET_UPCOM, MARKET_VN30F, MARKET_CRYPTO, MARKET_NYSE, createVNTheme, priceStepAt, roundToPriceStep, computePriceLimits, scaleMarketPrices, getCurrentSession, vn30fLastTradingDay, vn30fContracts, } from './presets.js';
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/market/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,iBAAiB,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3J,OAAO,EACL,SAAS,EACT,aAAa,EACb,YAAY,EACZ,cAAc,EACd,cAAc,EACd,WAAW,EACX,eAAe,EACf,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,WAAW,EACX,aAAa,EACb,WAAW,EACX,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,cAAc,GACf,MAAM,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/market/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,iBAAiB,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3J,OAAO,EACL,SAAS,EACT,SAAS,EACT,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,UAAU,EACV,gBAAgB,EAChB,iBAAiB,EACjB,aAAa,EACb,YAAY,EACZ,cAAc,EACd,cAAc,EACd,WAAW,EACX,eAAe,EACf,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,WAAW,EACX,aAAa,EACb,WAAW,EACX,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,cAAc,GACf,MAAM,cAAc,CAAC"}
|
package/dist/market/presets.d.ts
CHANGED
|
@@ -5,10 +5,17 @@ import { Theme } from '../types/theme.js';
|
|
|
5
5
|
* cyan at the floor (sàn), yellow at the reference price (tham chiếu).
|
|
6
6
|
*/
|
|
7
7
|
export declare const VN_COLORS: MarketColorScheme;
|
|
8
|
+
/**
|
|
9
|
+
* Korean trading apps: red up, blue down, against the previous close; the
|
|
10
|
+
* upper limit (상한가) a deeper red, the lower (하한가) a deeper blue.
|
|
11
|
+
*/
|
|
12
|
+
export declare const KR_COLORS: MarketColorScheme;
|
|
8
13
|
export declare const HOSE_SESSIONS: TradingSession[];
|
|
9
14
|
export declare const HNX_SESSIONS: TradingSession[];
|
|
10
15
|
export declare const UPCOM_SESSIONS: TradingSession[];
|
|
11
16
|
export declare const VN30F_SESSIONS: TradingSession[];
|
|
17
|
+
export declare const KRX_SESSIONS: TradingSession[];
|
|
18
|
+
export declare const NXT_SESSIONS: TradingSession[];
|
|
12
19
|
/**
|
|
13
20
|
* HOSE shares (Ho Chi Minh City), in thousands of dong: steps of 0.01 below
|
|
14
21
|
* 10, 0.05 from 10, 0.1 from 50; 2 decimals; lots of 100; limits of ±7%
|
|
@@ -26,6 +33,23 @@ export declare const MARKET_HNX: MarketConfig;
|
|
|
26
33
|
export declare const MARKET_UPCOM: MarketConfig;
|
|
27
34
|
/** VN30 index futures on HNX: index points, 0.1 a step, 100,000 dong a point, limits of ±7%, zone Asia/Ho_Chi_Minh, `VN30F_SESSIONS`. */
|
|
28
35
|
export declare const MARKET_VN30F: MarketConfig;
|
|
36
|
+
/**
|
|
37
|
+
* KOSPI and KOSDAQ shares on KRX, in won: steps from 1 won below 2,000 to
|
|
38
|
+
* 1,000 from 500,000 (`priceSteps`); whole won; limits of ±30% from the
|
|
39
|
+
* reference, the move rounded first as KRX does (`roundMove`); zone
|
|
40
|
+
* Asia/Seoul; red up and blue down (`KR_COLORS`); the opening and closing
|
|
41
|
+
* calls, the regular session and the After-Market (`KRX_SESSIONS`). ETFs
|
|
42
|
+
* and ETNs step differently and are not in the After-Market.
|
|
43
|
+
*/
|
|
44
|
+
export declare const MARKET_KRX: MarketConfig;
|
|
45
|
+
/** Shares on Nextrade: KRX's steps and limits (from KRX's reference price), `NXT_SESSIONS`. */
|
|
46
|
+
export declare const MARKET_NXT: MarketConfig;
|
|
47
|
+
/**
|
|
48
|
+
* Upbit's KRW market (`KRW-BTC`): steps from 1,000 won at a million down to
|
|
49
|
+
* a hundred-millionth of a won (`priceSteps`), the decimals following the
|
|
50
|
+
* symbol's data; no limits; red up and blue down. It trades around the clock.
|
|
51
|
+
*/
|
|
52
|
+
export declare const MARKET_UPBIT_KRW: MarketConfig;
|
|
29
53
|
/** Crypto: 2 decimals, no limits, no zone or sessions (it trades around the clock). */
|
|
30
54
|
export declare const MARKET_CRYPTO: MarketConfig;
|
|
31
55
|
/** NYSE shares, in dollars: 0.01 a step, no limits, zone America/New_York, pre-market, regular and after-hours sessions. */
|
|
@@ -36,6 +60,12 @@ export declare const MARKET_NYSE: MarketConfig;
|
|
|
36
60
|
* preset's follows the new candles).
|
|
37
61
|
*/
|
|
38
62
|
export declare function createVNTheme(base: Theme): Theme;
|
|
63
|
+
/**
|
|
64
|
+
* A theme variant with a market's candle colours: `createMarketTheme(DARK_THEME,
|
|
65
|
+
* KR_COLORS)` draws rising candles red and falling ones blue. Volume keeps
|
|
66
|
+
* the theme's own.
|
|
67
|
+
*/
|
|
68
|
+
export declare function createMarketTheme(base: Theme, colors: Pick<MarketColorScheme, 'up' | 'down'>): Theme;
|
|
39
69
|
/**
|
|
40
70
|
* The price step at `price`: the band it falls in, else the market's
|
|
41
71
|
* `priceStep`; undefined when the market names no step.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"presets.d.ts","sourceRoot":"","sources":["../../src/market/presets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,iBAAiB,EAAiB,cAAc,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAChH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAI/C;;;GAGG;AACH,eAAO,MAAM,SAAS,EAAE,iBAOvB,CAAC;AAMF,eAAO,MAAM,aAAa,EAAE,cAAc,EAMzC,CAAC;AAEF,eAAO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MAAM,KAAK,OAAO,GAAG,MAAM,CAU7G;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,GAAG,aAAa,EAAE,CAoBjG"}
|
package/dist/market/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type MarketType = 'crypto' | 'stock' | 'forex' | 'futures';
|
|
2
|
-
export type StockExchange = 'HOSE' | 'HNX' | 'UPCOM' | 'NYSE' | 'NASDAQ' | string;
|
|
2
|
+
export type StockExchange = 'HOSE' | 'HNX' | 'UPCOM' | 'NYSE' | 'NASDAQ' | 'KRX' | 'NXT' | 'UPBIT' | string;
|
|
3
3
|
/** From `from` up to the next band, prices move in steps of `step`. */
|
|
4
4
|
export interface PriceStepBand {
|
|
5
5
|
from: number;
|
|
@@ -32,6 +32,13 @@ export interface MarketConfig {
|
|
|
32
32
|
floorPercent?: number;
|
|
33
33
|
/** The price the limits are counted from, the last session's close; `chart.setPriceLimits(price)` sets it. */
|
|
34
34
|
referencePrice?: number;
|
|
35
|
+
/**
|
|
36
|
+
* Round the move first (KRX): the percentage of the reference is rounded
|
|
37
|
+
* down to the reference's step, then each limit down to the step of the
|
|
38
|
+
* price it lands on. Without it, the ceiling rounds down and the floor up
|
|
39
|
+
* (the Vietnamese exchanges).
|
|
40
|
+
*/
|
|
41
|
+
roundMove?: boolean;
|
|
35
42
|
};
|
|
36
43
|
/** The day's sessions, their times in the exchange's `timeZone`. */
|
|
37
44
|
sessions?: TradingSession[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/market/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,OAAO,GAAG,OAAO,GAAG,SAAS,CAAC;AAElE,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG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