koishi-plugin-monetary-bourse 3.0.0-alpha.16 → 3.0.0-alpha.18
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/lib/index.js +2 -15
- package/package.json +1 -1
- package/readme.md +3 -2
package/lib/index.js
CHANGED
|
@@ -33,12 +33,7 @@ var import_koishi2 = require("koishi");
|
|
|
33
33
|
var import_koishi = require("koishi");
|
|
34
34
|
var import_path = require("path");
|
|
35
35
|
var import_fs = require("fs");
|
|
36
|
-
var
|
|
37
|
-
var import_meta = {};
|
|
38
|
-
var templatesDir = (0, import_path.resolve)(
|
|
39
|
-
(0, import_url.fileURLToPath)(new URL(".", import_meta.url)),
|
|
40
|
-
"templates"
|
|
41
|
-
);
|
|
36
|
+
var templatesDir = (0, import_path.resolve)(__dirname, "templates");
|
|
42
37
|
async function renderHoldingImage(ctx, logger2, username, holding, pending, currency) {
|
|
43
38
|
try {
|
|
44
39
|
const templatePath = (0, import_path.resolve)(templatesDir, "holding-card.html");
|
|
@@ -132,14 +127,6 @@ async function renderStockImage(ctx, logger2, data, name2, viewLabel, current, h
|
|
|
132
127
|
}) : [];
|
|
133
128
|
const templatePath = (0, import_path.resolve)(templatesDir, "stock-chart.html");
|
|
134
129
|
let html = await import_fs.promises.readFile(templatePath, "utf-8");
|
|
135
|
-
const g2Path = (0, import_path.resolve)(templatesDir, "g2.min.js");
|
|
136
|
-
let g2Script = "";
|
|
137
|
-
try {
|
|
138
|
-
g2Script = await import_fs.promises.readFile(g2Path, "utf-8");
|
|
139
|
-
g2Script = g2Script.replace(/<\/script>/g, "<\\/script>");
|
|
140
|
-
} catch (err) {
|
|
141
|
-
logger2.warn(`renderStockImage: failed to read local G2 script: ${g2Path}`, err);
|
|
142
|
-
}
|
|
143
130
|
const colorScheme = {
|
|
144
131
|
mainColor: isUp ? "#f23645" : "#089981",
|
|
145
132
|
gradientStart: isUp ? "rgba(242, 54, 69, 0.25)" : "rgba(8, 153, 129, 0.25)",
|
|
@@ -179,7 +166,7 @@ async function renderStockImage(ctx, logger2, data, name2, viewLabel, current, h
|
|
|
179
166
|
"{{TIMES}}": JSON.stringify(data.map((d) => d.time)),
|
|
180
167
|
"{{TIMESTAMPS}}": JSON.stringify(data.map((d) => d.timestamp)),
|
|
181
168
|
"{{KLINE_DATA}}": JSON.stringify(klineData),
|
|
182
|
-
"{{G2_SCRIPT}}":
|
|
169
|
+
"{{G2_SCRIPT}}": ""
|
|
183
170
|
};
|
|
184
171
|
for (const [key, value] of Object.entries(replacements)) {
|
|
185
172
|
html = html.replace(new RegExp(key, "g"), () => value);
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
本插件模拟了一个具备自动宏观调控、25种经典K线形态、智能概率博弈和可视化交割单的深度拟真股票市场。用户可以使用机器人通用的货币(如信用点)进行股票买卖、炒股理财。
|
|
8
8
|
|
|
9
|
-
> 版本:**3.0.0-alpha.
|
|
9
|
+
> 版本:**3.0.0-alpha.18**
|
|
10
10
|
|
|
11
11
|
## ✨ 特性
|
|
12
12
|
|
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
- **`stock [interval]`**
|
|
40
40
|
- 查看股市行情。
|
|
41
41
|
- 参数 `interval`: 可选 `day` (日线)、`week` (周线),不填默认为实时走势(最近100条)。
|
|
42
|
+
- 实时视图使用折线图展示连续价格,`day` 按 2 小时一根 K 线聚合过去 24 小时,`week` 按 14 小时一根 K 线聚合过去 7 天。
|
|
42
43
|
- 示例:`stock` (查看实时), `stock day` (查看日线)。
|
|
43
44
|
|
|
44
45
|
- **`stock.buy <amount>`**
|
|
@@ -156,4 +157,4 @@ A: 股价采用 **"智能期望模型"** 驱动,更贴近真实博弈:
|
|
|
156
157
|
**开发者**: BYWled
|
|
157
158
|
**仓库**: `koishi-plugin-monetary-bourse`
|
|
158
159
|
|
|
159
|
-
萌新编写,部分借助了AI的力量,若有纰漏,还望海涵QwQ
|
|
160
|
+
萌新编写,部分借助了AI的力量,若有纰漏,还望海涵QwQ
|