Skip to content

Commit 1815361

Browse files
Quentin-Mclaude
andcommitted
fix(skills): add --reverse to list commands to return newest data first
Without --reverse, all list commands default to oldest-first, silently returning historical records beyond the count limit instead of recent activity. A user with >100 historical orders saw zero open orders returned despite having 19 active ones. Add --reverse to 38 command instances across 10 skill files: - bitmex order list (13 instances) - bitmex execution trade-history (18 instances) - bitmex execution list (3 instances) - bitmex market trades (1 instance, trades only) Verified against live testnet: order list correctly returns 19 open orders, execution trade-history returns most recent trades. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent e7ddbfd commit 1815361

16 files changed

Lines changed: 41 additions & 41 deletions

File tree

skills/bitmex-autonomy-levels/SKILL.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ bitmex market funding --symbol XBTUSD -o json 2>/dev/null
2727
# Account state — auth required, read-only
2828
bitmex account me -o json 2>/dev/null
2929
bitmex position list -o json 2>/dev/null
30-
bitmex order list -o json 2>/dev/null
30+
bitmex order list --reverse -o json 2>/dev/null
3131
bitmex wallet balance -o json 2>/dev/null
3232
```
3333

@@ -62,7 +62,7 @@ bitmex order buy XBTUSD 100 --price 50000 --order-type Limit --validate -o json
6262
bitmex order buy XBTUSD 100 --price 50000 --order-type Limit -o json 2>/dev/null
6363

6464
# Confirm fill
65-
bitmex order list --symbol XBTUSD -o json 2>/dev/null | jq '.[] | {orderID, ordStatus, price, cumQty}'
65+
bitmex order list --reverse --symbol XBTUSD -o json 2>/dev/null | jq '.[] | {orderID, ordStatus, price, cumQty}'
6666
```
6767

6868
Constraints: max qty per order, no compounding without approval, stop loss required.

skills/bitmex-dca-strategy/SKILL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ done
8787
## Track Average Entry Price
8888

8989
```bash
90-
bitmex execution trade-history --symbol XBTUSD --count 100 -o json 2>/dev/null | \
90+
bitmex execution trade-history --symbol XBTUSD --reverse --count 100 -o json 2>/dev/null | \
9191
jq '
9292
[.[] | select(.side == "Buy" and .execType == "Trade")] |
9393
{

skills/bitmex-error-recovery/SKILL.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ bitmex order buy XBTUSD 100 --price 50000 \
7373
--cl-ord-id "$CL_ORD_ID" -o json 2>/dev/null
7474

7575
# On network error, check if order exists before retrying
76-
EXISTING=$(bitmex order list --symbol XBTUSD -o json 2>/dev/null | \
76+
EXISTING=$(bitmex order list --reverse --symbol XBTUSD -o json 2>/dev/null | \
7777
jq --arg id "$CL_ORD_ID" '[.[] | select(.clOrdID == $id)]')
7878

7979
COUNT=$(echo "$EXISTING" | jq 'length')
@@ -102,11 +102,11 @@ done
102102

103103
```bash
104104
ORDER_ID="<id>"
105-
STATUS=$(bitmex order list --symbol XBTUSD -o json 2>/dev/null | \
105+
STATUS=$(bitmex order list --reverse --symbol XBTUSD -o json 2>/dev/null | \
106106
jq -r --arg id "$ORDER_ID" '.[] | select(.orderID == $id) | .ordStatus')
107-
FILLED=$(bitmex order list --symbol XBTUSD -o json 2>/dev/null | \
107+
FILLED=$(bitmex order list --reverse --symbol XBTUSD -o json 2>/dev/null | \
108108
jq -r --arg id "$ORDER_ID" '.[] | select(.orderID == $id) | .cumQty')
109-
REMAINING=$(bitmex order list --symbol XBTUSD -o json 2>/dev/null | \
109+
REMAINING=$(bitmex order list --reverse --symbol XBTUSD -o json 2>/dev/null | \
110110
jq -r --arg id "$ORDER_ID" '.[] | select(.orderID == $id) | .leavesQty')
111111

112112
echo "Status: $STATUS | Filled: $FILLED | Remaining: $REMAINING"

skills/bitmex-fee-optimization/SKILL.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ bitmex account commission -o json 2>/dev/null | jq '.XBTUSD'
101101

102102
```bash
103103
# Sum fees paid over last 500 executions
104-
bitmex execution trade-history --count 500 -o json 2>/dev/null | \
104+
bitmex execution trade-history --reverse --count 500 -o json 2>/dev/null | \
105105
jq '
106106
{
107107
total_fee: (map(.commission // 0) | add),
@@ -115,7 +115,7 @@ bitmex execution trade-history --count 500 -o json 2>/dev/null | \
115115
## Maker vs Taker Split
116116

117117
```bash
118-
bitmex execution trade-history --count 500 -o json 2>/dev/null | \
118+
bitmex execution trade-history --reverse --count 500 -o json 2>/dev/null | \
119119
jq '
120120
{
121121
maker_count: (map(select(.commission < 0)) | length),

skills/bitmex-market-intel/SKILL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ bitmex market orderbook XBTUSD --depth 1 -o json 2>/dev/null | \
5151

5252
```bash
5353
# Last 100 trades
54-
bitmex market trades --symbol XBTUSD --count 100 -o json 2>/dev/null | \
54+
bitmex market trades --symbol XBTUSD --reverse --count 100 -o json 2>/dev/null | \
5555
jq '[.[] | {timestamp, side, price, size}]'
5656

5757
# Bucketed candles (OHLCV)

skills/bitmex-order-execution/SKILL.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ bitmex account margin --currency XBt -o json 2>/dev/null | \
2626
jq '{availableMargin, marginBalance, marginLeverage}'
2727

2828
# 3. Check for stale open orders
29-
bitmex order list --symbol XBTUSD -o json 2>/dev/null | \
29+
bitmex order list --reverse --symbol XBTUSD -o json 2>/dev/null | \
3030
jq '[.[] | select(.ordStatus == "New" or .ordStatus == "PartiallyFilled") | {orderID, side, price, leavesQty}]'
3131
```
3232

@@ -67,7 +67,7 @@ ORDER_ID=$(echo "$ORDER" | jq -r '.orderID')
6767
Via REST polling:
6868

6969
```bash
70-
bitmex order list --symbol XBTUSD -o json 2>/dev/null | \
70+
bitmex order list --reverse --symbol XBTUSD -o json 2>/dev/null | \
7171
jq --arg id "$ORDER_ID" '.[] | select(.orderID == $id) | {ordStatus, cumQty, leavesQty, avgPx}'
7272
```
7373

skills/bitmex-order-types/SKILL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ bitmex order buy XBTUSD 100 --price 50000 --order-type Limit \
127127
Change price or qty on an open order without cancelling and re-placing:
128128

129129
```bash
130-
ORDER_ID=$(bitmex order list --symbol XBTUSD -o json 2>/dev/null | \
130+
ORDER_ID=$(bitmex order list --reverse --symbol XBTUSD -o json 2>/dev/null | \
131131
jq -r '[.[] | select(.ordStatus=="New")][0].orderID')
132132

133133
bitmex order amend --order-id "$ORDER_ID" --price 50500 -o json 2>/dev/null

skills/bitmex-portfolio-intel/SKILL.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,15 @@ bitmex position list --symbol XBTUSD -o json 2>/dev/null | jq '.[0]'
4949

5050
```bash
5151
# Last 100 trades
52-
bitmex execution trade-history --count 100 -o json 2>/dev/null | \
52+
bitmex execution trade-history --reverse --count 100 -o json 2>/dev/null | \
5353
jq '[.[] | {timestamp, symbol, side, lastPx, lastQty, commission, execType}]'
5454

5555
# Filter by symbol
56-
bitmex execution trade-history --symbol XBTUSD --count 100 -o json 2>/dev/null | \
56+
bitmex execution trade-history --symbol XBTUSD --reverse --count 100 -o json 2>/dev/null | \
5757
jq '[.[] | select(.execType == "Trade") | {timestamp, side, lastPx, lastQty}]'
5858

5959
# PnL summary from trade history
60-
bitmex execution trade-history --count 500 -o json 2>/dev/null | \
60+
bitmex execution trade-history --reverse --count 500 -o json 2>/dev/null | \
6161
jq '
6262
{
6363
total_trades: length,
@@ -72,11 +72,11 @@ bitmex execution trade-history --count 500 -o json 2>/dev/null | \
7272

7373
```bash
7474
# All executions including funding, settlement, and trades
75-
bitmex execution list --count 100 -o json 2>/dev/null | \
75+
bitmex execution list --reverse --count 100 -o json 2>/dev/null | \
7676
jq '[.[] | {timestamp, symbol, execType, side, lastPx, lastQty, commission}]'
7777

7878
# Funding payments received/paid
79-
bitmex execution list --count 200 -o json 2>/dev/null | \
79+
bitmex execution list --reverse --count 200 -o json 2>/dev/null | \
8080
jq '[.[] | select(.execType == "Funding") | {timestamp, symbol, commission, realisedPnl}]'
8181
```
8282

@@ -137,6 +137,6 @@ bitmex account margin --currency XBt -o json 2>/dev/null | \
137137
jq '"Balance: \(.marginBalance) sats | Unrealised PnL: \(.unrealisedPnl) sats"'
138138
bitmex position list -o json 2>/dev/null | \
139139
jq '"Positions: \([.[] | select(.isOpen == true)] | length)"'
140-
bitmex order list -o json 2>/dev/null | \
140+
bitmex order list --reverse -o json 2>/dev/null | \
141141
jq '"Open orders: \([.[] | select(.ordStatus == "New" or .ordStatus == "PartiallyFilled")] | length)"'
142142
```

skills/bitmex-recipe-daily-pnl-report/SKILL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ TODAY=$(date -u +%Y-%m-%d)
2222
### 1. Fetch today's trade history
2323

2424
```bash
25-
bitmex execution trade-history --count 500 -o json \
25+
bitmex execution trade-history --reverse --count 500 -o json \
2626
| jq --arg d "$TODAY" '[.[] | select(.timestamp | startswith($d))]' \
2727
> /tmp/trades_today.json
2828
```

skills/bitmex-recipe-morning-market-brief/SKILL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ bitmex account margin -o json \
6262
### 6. Open orders
6363

6464
```bash
65-
bitmex order list -o json \
65+
bitmex order list --reverse -o json \
6666
| jq '[.[] | {orderID, symbol, side, orderQty, price, ordStatus}]'
6767
```
6868

0 commit comments

Comments
 (0)