@watsonserve/stock-base 0.0.22 → 0.0.23
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/close-time.js +1 -0
- package/index.js +2 -2
- package/package.json +1 -1
- package/types/close-time.d.ts +1 -0
- package/types/dividend-loader.d.ts +1 -1
- package/types/helper.d.ts +0 -8
- package/types/index.d.ts +2 -7
- package/types/stock.d.ts +15 -1
package/close-time.js
CHANGED
|
@@ -2,6 +2,7 @@ import { EnMarket } from './stock.js';
|
|
|
2
2
|
export const A_MIN_MS = 60000;
|
|
3
3
|
export const A_HOUR_MS = 3600000;
|
|
4
4
|
export const A_DAY_MS = 86400000;
|
|
5
|
+
export const A_DAY_S = 86400;
|
|
5
6
|
// 夏令时:3月最后一个周日凌晨1AM开始夏令时,10月最后一个周日凌晨2AM结束夏令时
|
|
6
7
|
function isDST_ByUK(timestamp) {
|
|
7
8
|
const date = new Date(timestamp);
|
package/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { A_DAY_S } from './close-time.js';
|
|
1
2
|
import { DividendLoader } from './dividend-loader.js';
|
|
2
3
|
export * from './stock.js';
|
|
3
4
|
export * from './log.js';
|
|
4
|
-
export
|
|
5
|
-
const A_DAY_S = 86400;
|
|
5
|
+
export * from './helper.js';
|
|
6
6
|
function parseUTCDate(str) {
|
|
7
7
|
return ~~(Date.UTC(+str.slice(0, 4), +str.slice(4, 6) - 1, +str.slice(6, 8)) / 1000);
|
|
8
8
|
}
|
package/package.json
CHANGED
package/types/close-time.d.ts
CHANGED
package/types/helper.d.ts
CHANGED
|
@@ -1,12 +1,4 @@
|
|
|
1
1
|
import { EnMarket } from './stock.js';
|
|
2
|
-
export interface IDiv {
|
|
3
|
-
nc: string;
|
|
4
|
-
annc: number;
|
|
5
|
-
ex: number;
|
|
6
|
-
paid: number;
|
|
7
|
-
currency: string;
|
|
8
|
-
amount: number;
|
|
9
|
-
}
|
|
10
2
|
export declare function sleep(t?: number): Promise<unknown>;
|
|
11
3
|
export declare function splitFullNc(fullNc: string): {
|
|
12
4
|
nc: string;
|
package/types/index.d.ts
CHANGED
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
import { DividendLoader } from './dividend-loader.js';
|
|
2
|
+
import { IHoliday } from './stock.js';
|
|
2
3
|
export * from './stock.js';
|
|
3
4
|
export * from './log.js';
|
|
4
|
-
export
|
|
5
|
-
export interface IHoliday {
|
|
6
|
-
market: string;
|
|
7
|
-
title: string;
|
|
8
|
-
start: number;
|
|
9
|
-
end: number;
|
|
10
|
-
}
|
|
5
|
+
export * from './helper.js';
|
|
11
6
|
export declare class StockLoader extends DividendLoader {
|
|
12
7
|
loadHolidaysSG(year: number): Promise<IHoliday[]>;
|
|
13
8
|
loadHolidaysHK(): Promise<IHoliday[]>;
|
package/types/stock.d.ts
CHANGED
|
@@ -38,7 +38,7 @@ export interface StockPoint {
|
|
|
38
38
|
st: IStock;
|
|
39
39
|
}
|
|
40
40
|
export interface IDividend {
|
|
41
|
-
|
|
41
|
+
currency: string;
|
|
42
42
|
amount?: number;
|
|
43
43
|
ratio?: number;
|
|
44
44
|
annc: Date;
|
|
@@ -46,6 +46,20 @@ export interface IDividend {
|
|
|
46
46
|
paid: Date;
|
|
47
47
|
announcement_URL?: string;
|
|
48
48
|
}
|
|
49
|
+
export interface IDiv {
|
|
50
|
+
nc: string;
|
|
51
|
+
annc: number;
|
|
52
|
+
ex: number;
|
|
53
|
+
paid: number;
|
|
54
|
+
currency: string;
|
|
55
|
+
amount: number;
|
|
56
|
+
}
|
|
57
|
+
export interface IHoliday {
|
|
58
|
+
market: string;
|
|
59
|
+
title: string;
|
|
60
|
+
start: number;
|
|
61
|
+
end: number;
|
|
62
|
+
}
|
|
49
63
|
export declare class Stock {
|
|
50
64
|
nc: string;
|
|
51
65
|
name: string;
|