@watsonserve/stock-base 0.1.3 → 0.1.5
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/package.json +1 -4
- package/price-loader.js +1 -1
- package/us-holiday.js +3 -2
package/package.json
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@watsonserve/stock-base",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"types": "./types/index.d.ts",
|
|
8
|
-
"scripts": {
|
|
9
|
-
"build": "rm -rf ./dist && tsc && node ./build.mjs"
|
|
10
|
-
},
|
|
11
8
|
"keywords": [],
|
|
12
9
|
"author": "",
|
|
13
10
|
"license": "ISC",
|
package/price-loader.js
CHANGED
|
@@ -7,7 +7,7 @@ export default class PriceLoader extends HistoryLoader {
|
|
|
7
7
|
try {
|
|
8
8
|
const data = new Map();
|
|
9
9
|
for (const nc of ncs) {
|
|
10
|
-
const body = await this.get('https://finance.pae.baidu.com/
|
|
10
|
+
const body = await this.get('https://finance.pae.baidu.com/vapi/v1/sug', { wd: `USD${nc}`, skip_login: 1, finClientType: 'pc' });
|
|
11
11
|
const fx = body.Result.stock[0];
|
|
12
12
|
data.set(nc, +fx.price);
|
|
13
13
|
}
|
package/us-holiday.js
CHANGED
|
@@ -54,7 +54,7 @@ END:VEVENT
|
|
|
54
54
|
`;
|
|
55
55
|
}
|
|
56
56
|
function toUTCs(d) {
|
|
57
|
-
return ~~(Date.UTC(d.getFullYear(), d.getMonth()
|
|
57
|
+
return ~~(Date.UTC(d.getFullYear(), d.getMonth(), d.getDate()) / 1000);
|
|
58
58
|
}
|
|
59
59
|
/**
|
|
60
60
|
* 生成美股休市 & 提前收盘日历(ICS格式)
|
|
@@ -117,6 +117,7 @@ export function generateUSHolidays(year) {
|
|
|
117
117
|
xmasDate = Date.UTC(year, 11, 24);
|
|
118
118
|
during = 1;
|
|
119
119
|
}
|
|
120
|
+
xmasDate /= 1000;
|
|
120
121
|
events.push({ title, start: xmasDate, end: xmasDate + (A_DAY_S << during) });
|
|
121
|
-
return events;
|
|
122
|
+
return events.map(item => Object.assign(item, { market: 'US' }));
|
|
122
123
|
}
|