EntradeX CLI
Install
CODEBLOCK0
Usage
CODEBLOCK1
Configuration
Credential priority order:
- 1. Config file (
~/.entradex-cli/config.json) - recommended - Environment variables (
DNSE_API_KEY, DNSE_API_SECRET) - Global command options (
--api-key, --api-secret)
Setup and inspect config:
CODEBLOCK2
Security & Safety
Before using this skill:
- - Verify the npm package:
npm view entradex-cli - check author is hieuhani and repository matches - Inspect package contents:
npm pack entradex-cli --dry-run or view on npmjs.com - Treat
DNSE_API_KEY and DNSE_API_SECRET as highly sensitive trading credentials
Autonomous execution warning:
- - This skill can place real trades using provided credentials
- Consider using a separate limited-permission account
- Rotate API keys if you suspect unauthorized access
Global Options
- -
--api-key <key> DNSE API key - INLINECODE11 DNSE API secret
- INLINECODE12 API base URL (default:
https://openapi.dnse.com.vn) - INLINECODE14 Show request details
- INLINECODE15 Show CLI version
- INLINECODE16 Show help
Commands
Config
CODEBLOCK3
Account
CODEBLOCK4
Trade
CODEBLOCK5
Parameters:
- -
marketType (enum): STOCK, INLINECODE19 - INLINECODE20 (enum):
NB (buy), NS (sell) - INLINECODE23 (enum):
ATO, ATC, LO, MTL, MOK, INLINECODE29
-
ATO: At The Opening
-
ATC: At The Close
-
LO: Limit Order
-
MTL: Market To Limit
-
MOK: Market Order Kill
-
PLO: Post Limit Order
- -
price (number): unit price; follow DNSE tick-size/market constraints
- If
orderType=LO,
price must be greater than
0.
- If
orderType is anything other than
LO (
ATO,
ATC,
MTL,
MOK,
PLO),
price must be exactly
0.
- -
quantity (integer): order quantity; must satisfy market lot rules
- For
marketType=STOCK, valid quantity is either:
- Board lot: multiples of 100 (
100,
200, ...)
- Odd lot: integers from
1 to
99
- For
marketType=STOCK, values like
101,
102, ... are invalid odd lots and must be rejected.
- -
tradingToken (string): token from INLINECODE59
Normalization rules for user intent:
- - If user says
buy/sell, map to NB/NS. - Uppercase enum-style params before execution (
marketType, side, orderType). - If user provides an unsupported enum value, stop and ask for a valid value.
- If
orderType is not supported by the target market/session, stop and ask user to choose a supported type.
Order
CODEBLOCK6
Market
CODEBLOCK7
Auth
CODEBLOCK8
Dry Run
CODEBLOCK9
Common Workflow
CODEBLOCK10
EntradeX CLI
安装
bash
npm i -g entradex-cli
使用
bash
entradex [全局选项] [命令]
配置
凭证优先级顺序:
- 1. 配置文件(~/.entradex-cli/config.json)- 推荐
- 环境变量(DNSEAPIKEY、DNSEAPISECRET)
- 全局命令选项(--api-key、--api-secret)
设置和查看配置:
bash
entradex config set --key --secret
entradex config set
entradex config get
entradex config clear
安全与保障
使用此技能前:
- - 验证 npm 包:npm view entradex-cli - 检查作者是否为 hieuhani 且仓库地址匹配
- 检查包内容:npm pack entradex-cli --dry-run 或在 npmjs.com 上查看
- 将 DNSEAPIKEY 和 DNSEAPI_SECRET 视为高度敏感的交易凭证
自主执行警告:
- - 此技能可以使用提供的凭证进行真实交易
- 考虑使用单独的有限权限账户
- 如怀疑未经授权访问,请轮换 API 密钥
全局选项
- - --api-key DNSE API 密钥
- --api-secret DNSE API 密钥
- --base-url API 基础 URL(默认:https://openapi.dnse.com.vn)
- --debug 显示请求详情
- -V, --version 显示 CLI 版本
- -h, --help 显示帮助
命令
配置
bash
entradex config set [--key ] [--secret ] [--url ]
entradex config get
entradex config clear
账户
bash
entradex account list
entradex account balances
entradex account loan-packages [--symbol ]
交易
bash
entradex trade order [--price-stop ]
entradex trade modify [--price-stop ]
entradex trade cancel
参数:
- - marketType(枚举):STOCK(股票)、DERIVATIVE(衍生品)
- side(枚举):NB(买入)、NS(卖出)
- orderType(枚举):ATO、ATC、LO、MTL、MOK、PLO
- ATO:开盘竞价
- ATC:收盘竞价
- LO:限价单
- MTL:市价转限价
- MOK:市价即撤单
- PLO:挂单限价
- - price(数字):单价;遵循 DNSE 最小变动价位/市场约束
- 如果 orderType=LO,price 必须大于 0。
- 如果 orderType 不是 LO(即 ATO、ATC、MTL、MOK、PLO),price 必须恰好为 0。
- - quantity(整数):订单数量;必须满足市场整手规则
- 对于 marketType=STOCK,有效数量为:
- 整手:100 的倍数(100、200、...)
- 零股:1 到 99 的整数
- 对于 marketType=STOCK,101、102 等值为无效零股,必须拒绝。
- - tradingToken(字符串):来自 entradex auth create-token 的令牌
用户意图的规范化规则:
- - 如果用户说 buy/sell,映射为 NB/NS。
- 执行前将枚举类型参数大写(marketType、side、orderType)。
- 如果用户提供不支持的枚举值,停止并询问有效值。
- 如果目标市场/交易时段不支持 orderType,停止并让用户选择支持的类型。
订单
bash
entradex order list
entradex order detail
entradex order history [--from ] [--to ] [--page-size ] [--page-index ]
entradex order deals
市场
bash
entradex market secdef [--board-id ]
entradex market ppse
认证
bash
entradex auth send-otp [--otp-type ]
entradex auth create-token
模拟运行
bash
entradex dry-run accounts
entradex dry-run balances
entradex dry-run order [--price-stop ]
常见工作流程
bash
1) 配置凭证
entradex config set
2) 发送 OTP
entradex auth send-otp user@example.com
3) 使用密码创建交易令牌
entradex auth create-token smart_otp
4) 下单
entradex trade order STOCK VIC NB LO 15000 100