From 1e7199aa57540e84e1e4c2320f0dea23d536fabb Mon Sep 17 00:00:00 2001 From: Shing Yuen <94164655+byshing@users.noreply.github.com> Date: Wed, 20 May 2026 12:33:36 +0800 Subject: [PATCH] fix: remove deprecated /api/v1/order/closePosition endpoint The POST /order/closePosition endpoint has been deprecated by BitMEX. Removes the `close-position` subcommand from `bitmex order` and its entry from the tool catalog. Bump version to 1.0.1. --- Cargo.lock | 2 +- Cargo.toml | 2 +- agents/tool-catalog.json | 13 ------------- src/cli/commands/order.rs | 16 ---------------- 4 files changed, 2 insertions(+), 31 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5010ec5..416df35 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -220,7 +220,7 @@ dependencies = [ [[package]] name = "bitmex-cli" -version = "1.0.0" +version = "1.0.1" dependencies = [ "assert_cmd", "axum", diff --git a/Cargo.toml b/Cargo.toml index a767b18..3cc0f03 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bitmex-cli" -version = "1.0.0" +version = "1.0.1" edition = "2024" description = "BitMEX CLI — trade, query, and manage your BitMEX account from the terminal" license = "MIT" diff --git a/agents/tool-catalog.json b/agents/tool-catalog.json index 6ef7b4d..0ba3c9b 100644 --- a/agents/tool-catalog.json +++ b/agents/tool-catalog.json @@ -291,19 +291,6 @@ ], "example": "bitmex order cancel-after 60000 -o json" }, - { - "name": "order close-position", - "command": "bitmex order close-position ", - "group": "order", - "description": "[DANGEROUS] Close a position with a market order.", - "auth_required": true, - "dangerous": true, - "parameters": [ - {"name": "symbol", "type": "string", "required": true}, - {"name": "price", "type": "number", "required": false} - ], - "example": "bitmex order close-position XBTUSD -o json" - }, { "name": "order list", "command": "bitmex order list", diff --git a/src/cli/commands/order.rs b/src/cli/commands/order.rs index b2c041e..cc4f0d0 100644 --- a/src/cli/commands/order.rs +++ b/src/cli/commands/order.rs @@ -91,12 +91,6 @@ pub(crate) enum OrderCommand { CancelAfter { timeout: u64, }, - /// Close a position with a market order. - ClosePosition { - symbol: String, - #[arg(long)] - price: Option, - }, /// List open (or all) orders. List { #[arg(long)] @@ -219,16 +213,6 @@ pub(crate) async fn run( Ok(CommandOutput::from_json(val)) } - OrderCommand::ClosePosition { symbol, price } => { - if !ctx.force { - confirm_destructive(&format!("Close position for {}?", symbol))?; - } - let mut body = json!({ "symbol": symbol }); - if let Some(p) = price { body["price"] = json!(p); } - let val = client.post("/order/closePosition", &body, creds).await?; - Ok(CommandOutput::from_json(val)) - } - OrderCommand::List { symbol, filter, count, reverse, start_time, end_time, } => {