@aalis/plugin-okx-trading 0.11.1 → 0.13.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/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +36 -36
- package/dist/index.js.map +1 -1
- package/dist/locales/en.d.ts +28 -0
- package/dist/locales/en.d.ts.map +1 -0
- package/dist/locales/en.js +28 -0
- package/dist/locales/en.js.map +1 -0
- package/dist/texts.d.ts +55 -0
- package/dist/texts.d.ts.map +1 -0
- package/dist/texts.js +36 -0
- package/dist/texts.js.map +1 -0
- package/package.json +6 -6
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* 动真金白银 / 改仓位:visibility restricted(最低等级 2
|
|
2
|
+
* 动真金白银 / 改仓位:visibility restricted(最低等级 2,等级 2 起或 owner 可驱动)。
|
|
3
3
|
* 堵"任意 visitor 驱动 LLM 用 owner 真钱下单/划转"。不加逐单 confirm —— okx 刻意保留
|
|
4
4
|
* 实时/算法交易能力(见实盘安全闸注释),改用「等级门禁 + 一次性显式 confirmRealMoney」。
|
|
5
5
|
* 注意:与 ACCOUNT_READ_OKX_TOOLS 必须互斥——capabilityMinLevel 里 risk 会遮蔽
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AA0FA;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,aAa7B,CAAC;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,aAgCjC,CAAC;;;;;;AAOH,wBAOG"}
|
package/dist/index.js
CHANGED
|
@@ -2,6 +2,7 @@ import { tools } from '@aalis/api-tools';
|
|
|
2
2
|
import { config, definePlugin, logger, optional } from '@aalis/core';
|
|
3
3
|
import { configError, defineConfig, parseConfig } from '@aalis/schema-config';
|
|
4
4
|
import { OkxClient } from './client.js';
|
|
5
|
+
import { t } from './texts.js';
|
|
5
6
|
import { registerAccountTools } from './tools/account.js';
|
|
6
7
|
import { registerAlgoTools } from './tools/algo.js';
|
|
7
8
|
import { registerMarketTools } from './tools/market.js';
|
|
@@ -15,79 +16,77 @@ const configSchema = defineConfig({
|
|
|
15
16
|
label: 'API Key',
|
|
16
17
|
required: true,
|
|
17
18
|
secret: true,
|
|
18
|
-
description: '
|
|
19
|
-
default: '',
|
|
19
|
+
description: t('apiKeyDescription'),
|
|
20
20
|
onInvalid: 'error',
|
|
21
21
|
},
|
|
22
|
-
secretKey: { type: 'string', label: 'Secret Key', required: true, secret: true,
|
|
22
|
+
secretKey: { type: 'string', label: 'Secret Key', required: true, secret: true, onInvalid: 'error' },
|
|
23
23
|
passphrase: {
|
|
24
24
|
type: 'string',
|
|
25
25
|
label: 'Passphrase',
|
|
26
26
|
required: true,
|
|
27
27
|
secret: true,
|
|
28
|
-
description: '
|
|
29
|
-
default: '',
|
|
28
|
+
description: t('passphraseDescription'),
|
|
30
29
|
onInvalid: 'error',
|
|
31
30
|
},
|
|
32
31
|
baseUrl: {
|
|
33
32
|
type: 'string',
|
|
34
|
-
label: '
|
|
33
|
+
label: t('baseUrlLabel'),
|
|
35
34
|
default: 'https://www.okx.com',
|
|
36
35
|
onInvalid: 'error',
|
|
37
|
-
description: '
|
|
36
|
+
description: t('baseUrlDescription'),
|
|
38
37
|
},
|
|
39
38
|
demo: {
|
|
40
39
|
type: 'boolean',
|
|
41
|
-
label: '
|
|
40
|
+
label: t('demoLabel'),
|
|
42
41
|
default: true,
|
|
43
42
|
onInvalid: 'error',
|
|
44
|
-
description: '
|
|
43
|
+
description: t('demoDescription'),
|
|
45
44
|
},
|
|
46
45
|
confirmRealMoney: {
|
|
47
46
|
type: 'boolean',
|
|
48
|
-
label: '
|
|
47
|
+
label: t('confirmRealMoneyLabel'),
|
|
49
48
|
default: false,
|
|
50
49
|
onInvalid: 'error',
|
|
51
|
-
description: '
|
|
50
|
+
description: t('confirmRealMoneyDescription'),
|
|
52
51
|
},
|
|
53
|
-
timeoutMs: { type: 'number', label: '
|
|
52
|
+
timeoutMs: { type: 'number', label: t('timeoutMsLabel'), default: 15000 },
|
|
54
53
|
enableTrading: {
|
|
55
54
|
type: 'boolean',
|
|
56
|
-
label: '
|
|
55
|
+
label: t('enableTradingLabel'),
|
|
57
56
|
default: true,
|
|
58
57
|
onInvalid: 'error',
|
|
59
|
-
description: '
|
|
58
|
+
description: t('enableTradingDescription'),
|
|
60
59
|
},
|
|
61
60
|
enableAlgo: {
|
|
62
61
|
type: 'boolean',
|
|
63
|
-
label: '
|
|
62
|
+
label: t('enableAlgoLabel'),
|
|
64
63
|
default: false,
|
|
65
64
|
onInvalid: 'error',
|
|
66
|
-
description: '
|
|
65
|
+
description: t('enableAlgoDescription'),
|
|
67
66
|
},
|
|
68
67
|
enableTransfer: {
|
|
69
68
|
type: 'boolean',
|
|
70
|
-
label: '
|
|
69
|
+
label: t('enableTransferLabel'),
|
|
71
70
|
default: false,
|
|
72
71
|
onInvalid: 'error',
|
|
73
|
-
description: '
|
|
72
|
+
description: t('enableTransferDescription'),
|
|
74
73
|
},
|
|
75
74
|
defaultPageLimit: {
|
|
76
75
|
type: 'number',
|
|
77
|
-
label: '
|
|
76
|
+
label: t('defaultPageLimitLabel'),
|
|
78
77
|
default: 20,
|
|
79
|
-
description: '
|
|
78
|
+
description: t('defaultPageLimitDescription'),
|
|
80
79
|
},
|
|
81
80
|
maxPageLimit: {
|
|
82
81
|
type: 'number',
|
|
83
|
-
label: '
|
|
82
|
+
label: t('maxPageLimitLabel'),
|
|
84
83
|
default: 100,
|
|
85
|
-
description: '
|
|
84
|
+
description: t('maxPageLimitDescription'),
|
|
86
85
|
},
|
|
87
86
|
});
|
|
88
87
|
// ===== 工具权限三分名单(模块级导出,测试做补集断言防漏网)=====
|
|
89
88
|
/**
|
|
90
|
-
* 动真金白银 / 改仓位:visibility restricted(最低等级 2
|
|
89
|
+
* 动真金白银 / 改仓位:visibility restricted(最低等级 2,等级 2 起或 owner 可驱动)。
|
|
91
90
|
* 堵"任意 visitor 驱动 LLM 用 owner 真钱下单/划转"。不加逐单 confirm —— okx 刻意保留
|
|
92
91
|
* 实时/算法交易能力(见实盘安全闸注释),改用「等级门禁 + 一次性显式 confirmRealMoney」。
|
|
93
92
|
* 注意:与 ACCOUNT_READ_OKX_TOOLS 必须互斥——capabilityMinLevel 里 risk 会遮蔽
|
|
@@ -151,20 +150,20 @@ export const ACCOUNT_READ_OKX_TOOLS = new Set([
|
|
|
151
150
|
const uses = { tools: optional(tools), logger, config };
|
|
152
151
|
export default definePlugin({
|
|
153
152
|
name: '@aalis/plugin-okx-trading',
|
|
154
|
-
displayName: '
|
|
153
|
+
displayName: t('displayName'),
|
|
155
154
|
subsystem: 'external',
|
|
156
155
|
configSchema,
|
|
157
156
|
uses,
|
|
158
157
|
apply: registerOkxTools,
|
|
159
158
|
});
|
|
160
159
|
function registerOkxTools({ tools: baseTools, logger, config }) {
|
|
161
|
-
const parsed = parseConfig(configSchema, config, logger);
|
|
162
|
-
if (!parsed.apiKey || !parsed.secretKey || !parsed.passphrase) {
|
|
163
|
-
logger.warn('OKX 交易插件缺少 API 凭证,已跳过初始化');
|
|
164
|
-
return;
|
|
165
|
-
}
|
|
160
|
+
const parsed = parseConfig(configSchema, config.use, logger.use);
|
|
166
161
|
if (!URL.canParse(parsed.baseUrl) || new URL(parsed.baseUrl).username || new URL(parsed.baseUrl).password) {
|
|
167
|
-
throw configError('
|
|
162
|
+
throw configError(t('baseUrlNotPlain'));
|
|
163
|
+
}
|
|
164
|
+
// 插件在 baseUrl 后面拼路径,带查询串或片段(含末尾单个 ?)时拼出来的地址是坏的,所以按原文判
|
|
165
|
+
if (/[?#]/.test(parsed.baseUrl)) {
|
|
166
|
+
throw configError(t('baseUrlHasQuery'));
|
|
168
167
|
}
|
|
169
168
|
const maxPageLimit = Math.max(1, Math.min(1000, parsed.maxPageLimit || 100));
|
|
170
169
|
const cfg = {
|
|
@@ -179,16 +178,17 @@ function registerOkxTools({ tools: baseTools, logger, config }) {
|
|
|
179
178
|
timeoutMs: cfg.timeoutMs,
|
|
180
179
|
});
|
|
181
180
|
const modeLabel = cfg.demo ? '模拟盘' : '实盘';
|
|
182
|
-
logger.info(`OKX 交易插件已初始化 (${modeLabel})`);
|
|
183
|
-
baseTools.registerGroup({
|
|
181
|
+
logger.use.info(`OKX 交易插件已初始化 (${modeLabel})`);
|
|
182
|
+
baseTools.use.registerGroup({
|
|
184
183
|
name: 'okx',
|
|
185
|
-
label: '
|
|
184
|
+
label: t('displayName'),
|
|
185
|
+
summary: cfg.demo ? t('groupSummaryDemo') : t('groupSummaryLive'),
|
|
186
186
|
description: `OKX 虚拟币交易工具集 (${modeLabel}),提供行情查询、账户管理、下单交易等功能`,
|
|
187
187
|
});
|
|
188
188
|
// 工具代理:自动注入 groups;权限档在这一个点按三分名单派发(见模块级名单注释)。
|
|
189
189
|
const reg = tool => {
|
|
190
190
|
const toolName = tool.definition.function.name;
|
|
191
|
-
return baseTools.register({
|
|
191
|
+
return baseTools.use.register({
|
|
192
192
|
...tool,
|
|
193
193
|
groups: ['okx'],
|
|
194
194
|
visibility: MUTATING_OKX_TOOLS.has(toolName) ? 'restricted' : tool.visibility,
|
|
@@ -204,8 +204,8 @@ function registerOkxTools({ tools: baseTools, logger, config }) {
|
|
|
204
204
|
// 不加逐单人工确认(保留实时/算法交易能力)——以「一次性显式确认 + 启动告警」替代。
|
|
205
205
|
const tradingArmed = cfg.demo || cfg.confirmRealMoney;
|
|
206
206
|
if (!cfg.demo) {
|
|
207
|
-
logger.warn(cfg.confirmRealMoney
|
|
208
|
-
? '
|
|
207
|
+
logger.use.warn(cfg.confirmRealMoney
|
|
208
|
+
? '注意:OKX 处于实盘模式,LLM 可用真实资金下单/撤单/划转/提币,且无逐单人工确认,请确认这是本意。'
|
|
209
209
|
: 'OKX 处于实盘(demo:false)但未设 confirmRealMoney:true,已禁用交易/策略/划转工具(仅保留查询)。');
|
|
210
210
|
}
|
|
211
211
|
if (cfg.enableTrading && tradingArmed)
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAgB,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACnF,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAC9E,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,CAAC,EAAE,MAAM,YAAY,CAAC;AAC/B,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAE5D,MAAM,YAAY,GAAG,YAAY,CAAC;IAChC,MAAM,EAAE;QACN,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,SAAS;QAChB,QAAQ,EAAE,IAAI;QACd,MAAM,EAAE,IAAI;QACZ,WAAW,EAA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AAG,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;IACzF,IAAI,GAAG,CAAC,cAAc,IAAI,YAAY;QAAE,qBAAqB,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;AACxF,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
readonly displayName: "OKX trading";
|
|
3
|
+
readonly groupSummaryDemo: "OKX crypto trading tools (demo trading): market data, account management, order placement and more";
|
|
4
|
+
readonly groupSummaryLive: "OKX crypto trading tools (live trading): market data, account management, order placement and more";
|
|
5
|
+
readonly apiKeyDescription: "The API Key created in the OKX settings";
|
|
6
|
+
readonly passphraseDescription: "The passphrase set when creating the API key";
|
|
7
|
+
readonly baseUrlLabel: "API address";
|
|
8
|
+
readonly baseUrlDescription: "Live trading address by default; can be changed to a custom domain";
|
|
9
|
+
readonly demoLabel: "Demo trading";
|
|
10
|
+
readonly demoDescription: "When on, the simulated trading environment is used; testing in demo trading first is strongly recommended";
|
|
11
|
+
readonly confirmRealMoneyLabel: "Confirm live trading risk";
|
|
12
|
+
readonly confirmRealMoneyDescription: "Only when demo trading is off (demo:false) and real money is used, this must be set to true explicitly to confirm the risk; otherwise trading tools such as placing or cancelling orders, strategies, transfers and withdrawals are not exposed, and only queries remain.";
|
|
13
|
+
readonly timeoutMsLabel: "Request timeout (ms)";
|
|
14
|
+
readonly enableTradingLabel: "Enable trading tools";
|
|
15
|
+
readonly enableTradingDescription: "When off, only query tools remain and placing or cancelling orders is not exposed";
|
|
16
|
+
readonly enableAlgoLabel: "Enable algo orders";
|
|
17
|
+
readonly enableAlgoDescription: "Enable take-profit / stop-loss and trigger order tools";
|
|
18
|
+
readonly enableTransferLabel: "Enable fund transfers";
|
|
19
|
+
readonly enableTransferDescription: "Enable the funding account transfer tool";
|
|
20
|
+
readonly defaultPageLimitLabel: "Default page size";
|
|
21
|
+
readonly defaultPageLimitDescription: "Used by endpoints that query orders, bills, fills and the like when the LLM passes no limit.";
|
|
22
|
+
readonly maxPageLimitLabel: "Max page size";
|
|
23
|
+
readonly maxPageLimitDescription: "A limit passed by the LLM is capped to this value; the entries found are handed to the model in full, so raising it makes each tool result larger. The OKX API itself usually returns at most 100 per page (300 for a few endpoints).";
|
|
24
|
+
readonly baseUrlNotPlain: "baseUrl must be a complete URL without a user name or password";
|
|
25
|
+
readonly baseUrlHasQuery: "baseUrl must not contain a query string or fragment (anything after ? or #): the plugin appends paths to it";
|
|
26
|
+
};
|
|
27
|
+
export default _default;
|
|
28
|
+
//# sourceMappingURL=en.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"en.d.ts","sourceRoot":"","sources":["../../src/locales/en.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,wBAgCG"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { defineLocale } from '@aalis/schema-i18n';
|
|
2
|
+
export default defineLocale()({
|
|
3
|
+
displayName: 'OKX trading',
|
|
4
|
+
groupSummaryDemo: 'OKX crypto trading tools (demo trading): market data, account management, order placement and more',
|
|
5
|
+
groupSummaryLive: 'OKX crypto trading tools (live trading): market data, account management, order placement and more',
|
|
6
|
+
apiKeyDescription: 'The API Key created in the OKX settings',
|
|
7
|
+
passphraseDescription: 'The passphrase set when creating the API key',
|
|
8
|
+
baseUrlLabel: 'API address',
|
|
9
|
+
baseUrlDescription: 'Live trading address by default; can be changed to a custom domain',
|
|
10
|
+
demoLabel: 'Demo trading',
|
|
11
|
+
demoDescription: 'When on, the simulated trading environment is used; testing in demo trading first is strongly recommended',
|
|
12
|
+
confirmRealMoneyLabel: 'Confirm live trading risk',
|
|
13
|
+
confirmRealMoneyDescription: 'Only when demo trading is off (demo:false) and real money is used, this must be set to true explicitly to confirm the risk; otherwise trading tools such as placing or cancelling orders, strategies, transfers and withdrawals are not exposed, and only queries remain.',
|
|
14
|
+
timeoutMsLabel: 'Request timeout (ms)',
|
|
15
|
+
enableTradingLabel: 'Enable trading tools',
|
|
16
|
+
enableTradingDescription: 'When off, only query tools remain and placing or cancelling orders is not exposed',
|
|
17
|
+
enableAlgoLabel: 'Enable algo orders',
|
|
18
|
+
enableAlgoDescription: 'Enable take-profit / stop-loss and trigger order tools',
|
|
19
|
+
enableTransferLabel: 'Enable fund transfers',
|
|
20
|
+
enableTransferDescription: 'Enable the funding account transfer tool',
|
|
21
|
+
defaultPageLimitLabel: 'Default page size',
|
|
22
|
+
defaultPageLimitDescription: 'Used by endpoints that query orders, bills, fills and the like when the LLM passes no limit.',
|
|
23
|
+
maxPageLimitLabel: 'Max page size',
|
|
24
|
+
maxPageLimitDescription: 'A limit passed by the LLM is capped to this value; the entries found are handed to the model in full, so raising it makes each tool result larger. The OKX API itself usually returns at most 100 per page (300 for a few endpoints).',
|
|
25
|
+
baseUrlNotPlain: 'baseUrl must be a complete URL without a user name or password',
|
|
26
|
+
baseUrlHasQuery: 'baseUrl must not contain a query string or fragment (anything after ? or #): the plugin appends paths to it',
|
|
27
|
+
});
|
|
28
|
+
//# sourceMappingURL=en.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"en.js","sourceRoot":"","sources":["../../src/locales/en.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGlD,eAAe,YAAY,EAAU,CAAC;IACpC,WAAW,EAAE,aAAa;IAC1B,gBAAgB,EACd,oGAAoG;IACtG,gBAAgB,EACd,oGAAoG;IACtG,iBAAiB,EAAE,yCAAyC;IAC5D,qBAAqB,EAAE,8CAA8C;IACrE,YAAY,EAAE,aAAa;IAC3B,kBAAkB,EAAE,oEAAoE;IACxF,SAAS,EAAE,cAAc;IACzB,eAAe,EACb,2GAA2G;IAC7G,qBAAqB,EAAE,2BAA2B;IAClD,2BAA2B,EACzB,2QAA2Q;IAC7Q,cAAc,EAAE,sBAAsB;IACtC,kBAAkB,EAAE,sBAAsB;IAC1C,wBAAwB,EAAE,mFAAmF;IAC7G,eAAe,EAAE,oBAAoB;IACrC,qBAAqB,EAAE,wDAAwD;IAC/E,mBAAmB,EAAE,uBAAuB;IAC5C,yBAAyB,EAAE,0CAA0C;IACrE,qBAAqB,EAAE,mBAAmB;IAC1C,2BAA2B,EACzB,8FAA8F;IAChG,iBAAiB,EAAE,eAAe;IAClC,uBAAuB,EACrB,uOAAuO;IACzO,eAAe,EAAE,gEAAgE;IACjF,eAAe,EACb,6GAA6G;CAChH,CAAC,CAAC"}
|
package/dist/texts.d.ts
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
declare const SOURCE: {
|
|
2
|
+
readonly displayName: "OKX 交易";
|
|
3
|
+
readonly groupSummaryDemo: "OKX 虚拟币交易工具集(模拟盘),提供行情查询、账户管理、下单交易等功能";
|
|
4
|
+
readonly groupSummaryLive: "OKX 虚拟币交易工具集(实盘),提供行情查询、账户管理、下单交易等功能";
|
|
5
|
+
readonly apiKeyDescription: "在 OKX 设置中创建的 API Key";
|
|
6
|
+
readonly passphraseDescription: "创建 API 时设定的口令";
|
|
7
|
+
readonly baseUrlLabel: "API 地址";
|
|
8
|
+
readonly baseUrlDescription: "默认实盘地址,可改为自定义域名";
|
|
9
|
+
readonly demoLabel: "模拟盘";
|
|
10
|
+
readonly demoDescription: "启用后将使用模拟交易环境,强烈建议先在模拟盘测试";
|
|
11
|
+
readonly confirmRealMoneyLabel: "确认实盘风险";
|
|
12
|
+
readonly confirmRealMoneyDescription: "仅当关闭模拟盘(demo:false)、用真实资金时,须显式设为 true 以确认风险;否则不暴露下单/撤单/策略/划转/提币等交易工具,仅保留查询。";
|
|
13
|
+
readonly timeoutMsLabel: "请求超时 (ms)";
|
|
14
|
+
readonly enableTradingLabel: "启用交易工具";
|
|
15
|
+
readonly enableTradingDescription: "关闭后仅保留查询类工具,不暴露下单/撤单操作";
|
|
16
|
+
readonly enableAlgoLabel: "启用策略委托";
|
|
17
|
+
readonly enableAlgoDescription: "启用止盈止损 / 计划委托工具";
|
|
18
|
+
readonly enableTransferLabel: "启用资金划转";
|
|
19
|
+
readonly enableTransferDescription: "启用资金账户划转工具";
|
|
20
|
+
readonly defaultPageLimitLabel: "分页查询默认条数";
|
|
21
|
+
readonly defaultPageLimitDescription: "查询订单/账单/成交明细等接口,LLM 未传 limit 时使用。";
|
|
22
|
+
readonly maxPageLimitLabel: "分页查询最大条数";
|
|
23
|
+
readonly maxPageLimitDescription: "LLM 传入的 limit 会被 cap 到该值;查到的条目整份交给模型,调大会增加单次工具结果的体积。OKX API 本身单页一般最多 100(个别接口 300)。";
|
|
24
|
+
readonly baseUrlNotPlain: "baseUrl 需为不带用户名或密码的完整 URL";
|
|
25
|
+
readonly baseUrlHasQuery: "baseUrl 不能带查询串或片段(? 或 # 之后的部分):插件在它后面拼接路径";
|
|
26
|
+
};
|
|
27
|
+
export type Source = typeof SOURCE;
|
|
28
|
+
export declare const t: import("@aalis/schema-i18n").TextFactory<{
|
|
29
|
+
readonly displayName: "OKX 交易";
|
|
30
|
+
readonly groupSummaryDemo: "OKX 虚拟币交易工具集(模拟盘),提供行情查询、账户管理、下单交易等功能";
|
|
31
|
+
readonly groupSummaryLive: "OKX 虚拟币交易工具集(实盘),提供行情查询、账户管理、下单交易等功能";
|
|
32
|
+
readonly apiKeyDescription: "在 OKX 设置中创建的 API Key";
|
|
33
|
+
readonly passphraseDescription: "创建 API 时设定的口令";
|
|
34
|
+
readonly baseUrlLabel: "API 地址";
|
|
35
|
+
readonly baseUrlDescription: "默认实盘地址,可改为自定义域名";
|
|
36
|
+
readonly demoLabel: "模拟盘";
|
|
37
|
+
readonly demoDescription: "启用后将使用模拟交易环境,强烈建议先在模拟盘测试";
|
|
38
|
+
readonly confirmRealMoneyLabel: "确认实盘风险";
|
|
39
|
+
readonly confirmRealMoneyDescription: "仅当关闭模拟盘(demo:false)、用真实资金时,须显式设为 true 以确认风险;否则不暴露下单/撤单/策略/划转/提币等交易工具,仅保留查询。";
|
|
40
|
+
readonly timeoutMsLabel: "请求超时 (ms)";
|
|
41
|
+
readonly enableTradingLabel: "启用交易工具";
|
|
42
|
+
readonly enableTradingDescription: "关闭后仅保留查询类工具,不暴露下单/撤单操作";
|
|
43
|
+
readonly enableAlgoLabel: "启用策略委托";
|
|
44
|
+
readonly enableAlgoDescription: "启用止盈止损 / 计划委托工具";
|
|
45
|
+
readonly enableTransferLabel: "启用资金划转";
|
|
46
|
+
readonly enableTransferDescription: "启用资金账户划转工具";
|
|
47
|
+
readonly defaultPageLimitLabel: "分页查询默认条数";
|
|
48
|
+
readonly defaultPageLimitDescription: "查询订单/账单/成交明细等接口,LLM 未传 limit 时使用。";
|
|
49
|
+
readonly maxPageLimitLabel: "分页查询最大条数";
|
|
50
|
+
readonly maxPageLimitDescription: "LLM 传入的 limit 会被 cap 到该值;查到的条目整份交给模型,调大会增加单次工具结果的体积。OKX API 本身单页一般最多 100(个别接口 300)。";
|
|
51
|
+
readonly baseUrlNotPlain: "baseUrl 需为不带用户名或密码的完整 URL";
|
|
52
|
+
readonly baseUrlHasQuery: "baseUrl 不能带查询串或片段(? 或 # 之后的部分):插件在它后面拼接路径";
|
|
53
|
+
}>;
|
|
54
|
+
export {};
|
|
55
|
+
//# sourceMappingURL=texts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"texts.d.ts","sourceRoot":"","sources":["../src/texts.ts"],"names":[],"mappings":"AAIA,QAAA,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;CA2BF,CAAC;AACX,MAAM,MAAM,MAAM,GAAG,OAAO,MAAM,CAAC;AAEnC,eAAO,MAAM,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;EAKZ,CAAC"}
|
package/dist/texts.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// 本插件自己的原文字典:显示名(同为工具分组名)与分组概述(模拟盘、实盘两句)、配置项与配置报错
|
|
2
|
+
import { defineTexts } from '@aalis/schema-i18n';
|
|
3
|
+
import en from './locales/en.js';
|
|
4
|
+
const SOURCE = {
|
|
5
|
+
displayName: 'OKX 交易',
|
|
6
|
+
groupSummaryDemo: 'OKX 虚拟币交易工具集(模拟盘),提供行情查询、账户管理、下单交易等功能',
|
|
7
|
+
groupSummaryLive: 'OKX 虚拟币交易工具集(实盘),提供行情查询、账户管理、下单交易等功能',
|
|
8
|
+
apiKeyDescription: '在 OKX 设置中创建的 API Key',
|
|
9
|
+
passphraseDescription: '创建 API 时设定的口令',
|
|
10
|
+
baseUrlLabel: 'API 地址',
|
|
11
|
+
baseUrlDescription: '默认实盘地址,可改为自定义域名',
|
|
12
|
+
demoLabel: '模拟盘',
|
|
13
|
+
demoDescription: '启用后将使用模拟交易环境,强烈建议先在模拟盘测试',
|
|
14
|
+
confirmRealMoneyLabel: '确认实盘风险',
|
|
15
|
+
confirmRealMoneyDescription: '仅当关闭模拟盘(demo:false)、用真实资金时,须显式设为 true 以确认风险;否则不暴露下单/撤单/策略/划转/提币等交易工具,仅保留查询。',
|
|
16
|
+
timeoutMsLabel: '请求超时 (ms)',
|
|
17
|
+
enableTradingLabel: '启用交易工具',
|
|
18
|
+
enableTradingDescription: '关闭后仅保留查询类工具,不暴露下单/撤单操作',
|
|
19
|
+
enableAlgoLabel: '启用策略委托',
|
|
20
|
+
enableAlgoDescription: '启用止盈止损 / 计划委托工具',
|
|
21
|
+
enableTransferLabel: '启用资金划转',
|
|
22
|
+
enableTransferDescription: '启用资金账户划转工具',
|
|
23
|
+
defaultPageLimitLabel: '分页查询默认条数',
|
|
24
|
+
defaultPageLimitDescription: '查询订单/账单/成交明细等接口,LLM 未传 limit 时使用。',
|
|
25
|
+
maxPageLimitLabel: '分页查询最大条数',
|
|
26
|
+
maxPageLimitDescription: 'LLM 传入的 limit 会被 cap 到该值;查到的条目整份交给模型,调大会增加单次工具结果的体积。OKX API 本身单页一般最多 100(个别接口 300)。',
|
|
27
|
+
baseUrlNotPlain: 'baseUrl 需为不带用户名或密码的完整 URL',
|
|
28
|
+
baseUrlHasQuery: 'baseUrl 不能带查询串或片段(? 或 # 之后的部分):插件在它后面拼接路径',
|
|
29
|
+
};
|
|
30
|
+
export const t = defineTexts({
|
|
31
|
+
ns: '@aalis/plugin-okx-trading',
|
|
32
|
+
language: 'zh-CN',
|
|
33
|
+
source: SOURCE,
|
|
34
|
+
locales: { en },
|
|
35
|
+
});
|
|
36
|
+
//# sourceMappingURL=texts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"texts.js","sourceRoot":"","sources":["../src/texts.ts"],"names":[],"mappings":"AAAA,kDAAkD;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAEjC,MAAM,MAAM,GAAG;IACb,WAAW,EAAE,QAAQ;IACrB,gBAAgB,EAAE,uCAAuC;IACzD,gBAAgB,EAAE,sCAAsC;IACxD,iBAAiB,EAAE,sBAAsB;IACzC,qBAAqB,EAAE,eAAe;IACtC,YAAY,EAAE,QAAQ;IACtB,kBAAkB,EAAE,iBAAiB;IACrC,SAAS,EAAE,KAAK;IAChB,eAAe,EAAE,0BAA0B;IAC3C,qBAAqB,EAAE,QAAQ;IAC/B,2BAA2B,EACzB,6EAA6E;IAC/E,cAAc,EAAE,WAAW;IAC3B,kBAAkB,EAAE,QAAQ;IAC5B,wBAAwB,EAAE,wBAAwB;IAClD,eAAe,EAAE,QAAQ;IACzB,qBAAqB,EAAE,iBAAiB;IACxC,mBAAmB,EAAE,QAAQ;IAC7B,yBAAyB,EAAE,YAAY;IACvC,qBAAqB,EAAE,UAAU;IACjC,2BAA2B,EAAE,mCAAmC;IAChE,iBAAiB,EAAE,UAAU;IAC7B,uBAAuB,EACrB,qFAAqF;IACvF,eAAe,EAAE,2BAA2B;IAC5C,eAAe,EAAE,2CAA2C;CACpD,CAAC;AAGX,MAAM,CAAC,MAAM,CAAC,GAAG,WAAW,CAAC;IAC3B,EAAE,EAAE,2BAA2B;IAC/B,QAAQ,EAAE,OAAO;IACjB,MAAM,EAAE,MAAM;IACd,OAAO,EAAE,EAAE,EAAE,EAAE;CAChB,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aalis/plugin-okx-trading",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -24,17 +24,17 @@
|
|
|
24
24
|
"dist"
|
|
25
25
|
],
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@aalis/schema-config": ">=0.
|
|
28
|
-
"@aalis/
|
|
27
|
+
"@aalis/schema-config": ">=0.16.0 <1.0.0",
|
|
28
|
+
"@aalis/schema-i18n": ">=0.1.0 <1.0.0",
|
|
29
|
+
"@aalis/api-tools": ">=0.12.0 <1.0.0"
|
|
29
30
|
},
|
|
30
31
|
"devDependencies": {
|
|
31
32
|
"@types/node": "^22.0.0",
|
|
32
33
|
"typescript": "^5.7.0",
|
|
33
|
-
"@aalis/core": "0.
|
|
34
|
-
"@aalis/api-webui": "0.11.1"
|
|
34
|
+
"@aalis/core": "0.21.0"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
|
-
"@aalis/core": ">=0.
|
|
37
|
+
"@aalis/core": ">=0.21.0 <1.0.0"
|
|
38
38
|
},
|
|
39
39
|
"aalis": {
|
|
40
40
|
"service": {
|