quote-observer 1.8.1 → 2.0.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/{cmd/ma.js → core.js} +5 -4
- package/index.js +1 -2
- package/package.json +1 -1
- package/{api/quote.js → services/kline.js} +7 -8
- package/api/index.js +0 -11
- package/cmd/index.js +0 -10
- /package/{api → services}/futu.js +0 -0
package/{cmd/ma.js → core.js}
RENAMED
|
@@ -5,8 +5,9 @@
|
|
|
5
5
|
* @Last Modified time: 2021-11-09 10:43:03
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
const logger = require('
|
|
9
|
-
const
|
|
8
|
+
const logger = require('./logger')();
|
|
9
|
+
const Futu = require('./services/futu');
|
|
10
|
+
const KLine = require('./services/kline');
|
|
10
11
|
|
|
11
12
|
// https://github.com/Marak/colors.js/blob/56de9f0983f68cd0a08c5b76d10a783e4b881716/lib/styles.js
|
|
12
13
|
const styleCodes = {
|
|
@@ -99,7 +100,7 @@ function sale_signal(code, now) {
|
|
|
99
100
|
}
|
|
100
101
|
|
|
101
102
|
function start() {
|
|
102
|
-
let quotes = [...STOCKS_MAP.keys()].map(code =>
|
|
103
|
+
let quotes = [...STOCKS_MAP.keys()].map(code => KLine(code, 10));
|
|
103
104
|
Promise.all(quotes).then(resps => {
|
|
104
105
|
console.reset();
|
|
105
106
|
console.log((new Date()).toTimeString().split(' ')[0]);
|
|
@@ -142,7 +143,7 @@ function update_stocks() {
|
|
|
142
143
|
// SH,SZ,HK,US => [ 'SH', 'SZ', 'HK', 'US' ]
|
|
143
144
|
const markets = String(global.config?.opts?.market || '').trim()
|
|
144
145
|
.split(',').map(v => v.trim().toUpperCase()).filter(v => v);
|
|
145
|
-
return Promise.all([
|
|
146
|
+
return Promise.all([Futu.position(), Futu.following()]).then(([holders, follows]) => {
|
|
146
147
|
STOCKS_MAP.clear();
|
|
147
148
|
[
|
|
148
149
|
...Object.values(holders),
|
package/index.js
CHANGED
|
@@ -11,7 +11,6 @@ global.MARKET = {};
|
|
|
11
11
|
global.config = require('rc')('stock');
|
|
12
12
|
const { program } = require('commander');
|
|
13
13
|
const pkg = require('./package.json');
|
|
14
|
-
const cmd = require('./cmd');
|
|
15
14
|
|
|
16
15
|
program
|
|
17
16
|
.version(pkg.version)
|
|
@@ -31,4 +30,4 @@ console.reset = function () {
|
|
|
31
30
|
console.clear();
|
|
32
31
|
};
|
|
33
32
|
|
|
34
|
-
|
|
33
|
+
require('./core')();
|
package/package.json
CHANGED
|
@@ -5,16 +5,17 @@
|
|
|
5
5
|
* @Last Modified time: 2021-06-01 14:30:29
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
//
|
|
9
|
-
//
|
|
10
|
-
//
|
|
8
|
+
// https://web.ifzq.gtimg.cn/appstock/app/usfqkline/get?_var=kline_dayqfq¶m=usTSLA.OQ,day,,,10,qfq&r=0.2834233560574715
|
|
9
|
+
// https://web.ifzq.gtimg.cn/appstock/app/hkfqkline/get?_var=kline_dayqfq¶m=hk00700,day,,,10,qfq&r=0.283423356057471500
|
|
10
|
+
// https://web.ifzq.gtimg.cn/appstock/app/fqkline/get?_var=kline_dayqfq¶m=sz399006,day,,,10,qfq&r=0.4519900299757633000
|
|
11
11
|
|
|
12
12
|
const fs = require('fs');
|
|
13
13
|
const axios = require('axios');
|
|
14
14
|
const logger = require('../logger')();
|
|
15
15
|
const querystring = require('querystring');
|
|
16
|
+
const quote_conf = global.config.quote || {};
|
|
16
17
|
|
|
17
|
-
const base_url = `
|
|
18
|
+
const base_url = quote_conf.base_url || `https://web.ifzq.gtimg.cn/appstock/app`;
|
|
18
19
|
const path_mkt = {
|
|
19
20
|
SH: `/fqkline/get`,
|
|
20
21
|
SZ: `/fqkline/get`,
|
|
@@ -38,7 +39,7 @@ const save_resp = (data) => {
|
|
|
38
39
|
}
|
|
39
40
|
};
|
|
40
41
|
|
|
41
|
-
function
|
|
42
|
+
function kline(id, days = 10) {
|
|
42
43
|
let [mkt, code] = id.split('.');
|
|
43
44
|
if (!code) {
|
|
44
45
|
logger.info(`Query ${id}: index skip`);
|
|
@@ -68,6 +69,4 @@ function kline_dayqfq(id, days = 10) {
|
|
|
68
69
|
});
|
|
69
70
|
}
|
|
70
71
|
|
|
71
|
-
module.exports =
|
|
72
|
-
kline_dayqfq,
|
|
73
|
-
};
|
|
72
|
+
module.exports = kline;
|
package/api/index.js
DELETED
package/cmd/index.js
DELETED
|
File without changes
|