entradex

TotalClaw 作者 totalclaw

使用 EntradeX CLI 进行 DNSE 工作流程。在以下情况下使用:(1) 通过环境变量或配置文件设置 DNSE API 凭据,(2) 读取账户、市场和订单数据,(3) 下单、修改或取消真实交易。

安装 / 下载方式

TotalClaw CLI推荐
totalclaw skills install shop:totalclaw:totalclaw~hieuhani-entradex
cURL直接下载,无需登录
curl -fsSL https://skills.taituai.com/api/skills/totalclaw%3Atotalclaw~hieuhani-entradex/file -o hieuhani-entradex.md
# EntradeX CLI

Install

```bash
npm i -g entradex-cli
```

## Usage

```bash
entradex [global-options] [command]
```

## Configuration

Credential priority order:

1. Config file (`~/.entradex-cli/config.json`) - recommended
2. Environment variables (`DNSE_API_KEY`, `DNSE_API_SECRET`)
3. Global command options (`--api-key`, `--api-secret`)

Setup and inspect config:

```bash
entradex config set --key "<api-key>" --secret "<api-secret>"
entradex config set
entradex config get
entradex config clear
```

## 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](https://www.npmjs.com/package/entradex-cli)
- 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
- `--api-secret <secret>` DNSE API secret
- `--base-url <url>` API base URL (default: `https://openapi.dnse.com.vn`)
- `--debug` Show request details
- `-V, --version` Show CLI version
- `-h, --help` Show help

## Commands

### Config

```bash
entradex config set [--key <key>] [--secret <secret>] [--url <url>]
entradex config get
entradex config clear
```

### Account

```bash
entradex account list
entradex account balances <accountNo>
entradex account loan-packages <accountNo> <marketType> [--symbol <symbol>]
```

### Trade

```bash
entradex trade order <marketType> <symbol> <side> <orderType> <price> <quantity> <tradingToken> [--price-stop <price>]
entradex trade modify <accountNo> <orderId> <marketType> <symbol> <side> <orderType> <price> <quantity> <tradingToken> [--price-stop <price>]
entradex trade cancel <accountNo> <orderId> <marketType> <tradingToken>
```

Parameters:

- `marketType` (enum): `STOCK`, `DERIVATIVE`
- `side` (enum): `NB` (buy), `NS` (sell)
- `orderType` (enum): `ATO`, `ATC`, `LO`, `MTL`, `MOK`, `PLO`
  - `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 `entradex auth create-token`

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

```bash
entradex order list <accountNo> <marketType>
entradex order detail <accountNo> <orderId> <marketType>
entradex order history <accountNo> <marketType> [--from <date>] [--to <date>] [--page-size <size>] [--page-index <index>]
entradex order deals <accountNo> <marketType>
```

### Market

```bash
entradex market secdef <symbol> [--board-id <id>]
entradex market ppse <accountNo> <marketType> <symbol> <price> <loanPackageId>
```

### Auth

```bash
entradex auth send-otp <email> [--otp-type <type>]
entradex auth create-token <otpType> <passcode>
```

### Dry Run

```bash
entradex dry-run accounts
entradex dry-run balances <accountNo>
entradex dry-run order <marketType> <symbol> <side> <orderType> <price> <quantity> [--price-stop <price>]
```

## Common Workflow

```bash
# 1) Configure credentials
entradex config set

# 2) Send OTP
entradex auth send-otp user@example.com

# 3) Create trading token with passcode
entradex auth create-token smart_otp <passcode>

# 4) Place an order
entradex trade order STOCK VIC NB LO 15000 100 <trading-token>
```

---

## 中文说明

# EntradeX CLI

安装

```bash
npm i -g entradex-cli
```

## 用法

```bash
entradex [global-options] [command]
```

## 配置

凭据优先级顺序:

1. 配置文件(`~/.entradex-cli/config.json`)- 推荐
2. 环境变量(`DNSE_API_KEY`、`DNSE_API_SECRET`)
3. 全局命令选项(`--api-key`、`--api-secret`)

设置并查看配置:

```bash
entradex config set --key "<api-key>" --secret "<api-secret>"
entradex config set
entradex config get
entradex config clear
```

## 安全与防护

**使用此技能之前:**

- 核实 npm 包:`npm view entradex-cli` - 检查作者是否为 `hieuhani` 且仓库相符
- 检查包内容:`npm pack entradex-cli --dry-run`,或在 [npmjs.com](https://www.npmjs.com/package/entradex-cli) 上查看
- 将 `DNSE_API_KEY` 和 `DNSE_API_SECRET` 视为高度敏感的交易凭据

**自主执行警告:**

- 此技能可使用所提供的凭据进行**真实交易**
- 考虑使用单独的权限受限账户
- 如怀疑遭到未经授权的访问,请轮换 API 密钥

## 全局选项

- `--api-key <key>` DNSE API key
- `--api-secret <secret>` DNSE API secret
- `--base-url <url>` API 基础 URL(默认:`https://openapi.dnse.com.vn`)
- `--debug` 显示请求详情
- `-V, --version` 显示 CLI 版本
- `-h, --help` 显示帮助

## 命令

### Config

```bash
entradex config set [--key <key>] [--secret <secret>] [--url <url>]
entradex config get
entradex config clear
```

### Account

```bash
entradex account list
entradex account balances <accountNo>
entradex account loan-packages <accountNo> <marketType> [--symbol <symbol>]
```

### Trade

```bash
entradex trade order <marketType> <symbol> <side> <orderType> <price> <quantity> <tradingToken> [--price-stop <price>]
entradex trade modify <accountNo> <orderId> <marketType> <symbol> <side> <orderType> <price> <quantity> <tradingToken> [--price-stop <price>]
entradex trade cancel <accountNo> <orderId> <marketType> <tradingToken>
```

参数:

- `marketType`(枚举):`STOCK`、`DERIVATIVE`
- `side`(枚举):`NB`(买入)、`NS`(卖出)
- `orderType`(枚举):`ATO`、`ATC`、`LO`、`MTL`、`MOK`、`PLO`
  - `ATO`:At The Opening(开盘价)
  - `ATC`:At The Close(收盘价)
  - `LO`:Limit Order(限价单)
  - `MTL`:Market To Limit(市价转限价)
  - `MOK`:Market Order Kill(市价立即成交否则取消)
  - `PLO`:Post Limit Order(盘后限价单)
- `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`,停止并要求用户选择受支持的类型。

### Order

```bash
entradex order list <accountNo> <marketType>
entradex order detail <accountNo> <orderId> <marketType>
entradex order history <accountNo> <marketType> [--from <date>] [--to <date>] [--page-size <size>] [--page-index <index>]
entradex order deals <accountNo> <marketType>
```

### Market

```bash
entradex market secdef <symbol> [--board-id <id>]
entradex market ppse <accountNo> <marketType> <symbol> <price> <loanPackageId>
```

### Auth

```bash
entradex auth send-otp <email> [--otp-type <type>]
entradex auth create-token <otpType> <passcode>
```

### Dry Run

```bash
entradex dry-run accounts
entradex dry-run balances <accountNo>
entradex dry-run order <marketType> <symbol> <side> <orderType> <price> <quantity> [--price-stop <price>]
```

## 常见工作流程

```bash
# 1) Configure credentials
entradex config set

# 2) Send OTP
entradex auth send-otp user@example.com

# 3) Create trading token with passcode
entradex auth create-token smart_otp <passcode>

# 4) Place an order
entradex trade order STOCK VIC NB LO 15000 100 <trading-token>
```