# 1m-trade

Hyperliquid trading and query CLI (HIP-3 supported).

## Install

```bash
pip install 1m-trade
```

## Usage

The CLI command is `hl1m`.

It loads environment variables from:

1. `OPENCLAW_STATE_DIR` (if set)
2. `OPENCLAW_HOME/.openclaw/.1m-trade/.env`
3. `~/.openclaw/.1m-trade/.env`

### Query examples

```bash
hl1m query-user-state
hl1m query-open-orders
hl1m query-meta
hl1m query-kline --coin BTC --period 1m --start 1700000000000 --end 1700003600000
```

### Trading examples

> 需要设置私钥环境变量（例如 `HYPERLIQUID_PRIVATE_KEY`，或 `HYPERLIQUID_PRIVATE_KEY_ENC` + `HYPERLIQUID_PK_ENC_PASSWORD`）。

```bash
hl1m place-order --coin BTC --is-buy true --qty 0.01 --limit-px 60000 --tif Gtc
hl1m market-order --coin BTC --is-buy true --qty 0.01 --slippage 0.02
hl1m cancel-order --coin BTC
hl1m update-leverage --coin BTC --leverage 5 --is-cross true
hl1m market-close --coin BTC --qty 0.01 --slippage 0.02
```

### Wallet examples

```bash
hl1m init-wallet --pri_key 0xYourPrivateKey
hl1m init-wallet --address 0xYourPublicAddress --pri_key 0xYourPrivateKey
hl1m init_wallet --address 0xYourPublicAddress --pri_key 0xYourPrivateKey
```

## License

MIT

