Skip to content

fix(futures-paper): surface stop_price and trigger_signal in orders and order-status - #55

Closed
theghostmac wants to merge 1 commit into
krakenfx:mainfrom
theghostmac:fix/futures-paper-orders-stop-fields
Closed

theghostmac wants to merge 1 commit into
krakenfx:mainfrom
theghostmac:fix/futures-paper-orders-stop-fields

Conversation

@theghostmac

Copy link
Copy Markdown
Contributor

Summary

Surfaces stop_price and trigger_signal in both the table and JSON outputs of kraken futures paper orders and kraken futures paper order-status.

Problem

When a triggered futures paper order (stop, take-profit, or trailing-stop) is placed without a limit --price, order.price is None while order.stop_price and order.trigger_signal hold the trigger parameters.

Previously, execute_orders and execute_order_status in src/commands/futures_paper.rs only projected order.price (— in table mode, null in JSON mode) and omitted stop_price and trigger_signal entirely, making it impossible to inspect stop prices or trigger signals via the CLI or -o json without reading the raw futures_state.json file.

Changes

  • Add Stop Price / Trigger columns and stop_price / trigger_signal JSON fields to kraken futures paper orders.
  • Add Stop Price / Trigger Signal key-value rows and stop_price / trigger_signal JSON fields to kraken futures paper order-status.
  • Extract pure format_open_orders and format_order_status helpers and add unit test orders_and_order_status_surface_stop_price_and_trigger_signal.

Verification & CLI Proof

Before Fix

$ kraken futures paper orders
┌───────────────┬───────────┬──────────────┬───────────────┬────────────┬───────┬────────┬───────────┐
│ [FP] Order ID ┆ Symbol    ┆ PositionSide ┆ Type          ┆ Size       ┆ Price ┆ Status ┆ Client ID │
╞═══════════════╪═══════════╪══════════════╪═══════════════╪════════════╪═══════╪════════╪═══════════╡
│ FP-00003      ┆ PF_XBTUSD ┆ long         ┆ trailing-stop ┆ 0.10000000 ┆ —     ┆ open   ┆ —         │
└───────────────┴───────────┴──────────────┴───────────────┴────────────┴───────┴────────┴───────────┘

$ kraken futures paper order-status FP-00003
┌─────────────────┬───────────────────────────────────┐
│ Field           ┆ Value                             │
╞═════════════════╪═══════════════════════════════════╡
│ Mode            ┆ [FUTURES PAPER] Simulated Trading │
│ Order ID        ┆ FP-00003                          │
│ Symbol          ┆ PF_XBTUSD                         │
│ PositionSide    ┆ long                              │
│ Type            ┆ trailing-stop                     │
│ Size            ┆ 0.10000000                        │
│ Price           ┆ —                                 │
│ Status          ┆ open                              │
│ Client Order ID ┆ —                                 │
│ Leverage        ┆ 10.0x                             │
│ Reduce Only     ┆ false                             │
└─────────────────┴───────────────────────────────────┘

After Fix

$ kraken futures paper orders
┌───────────────┬───────────┬──────────────┬───────────────┬────────────┬───────┬────────────┬─────────┬────────┬───────────┐
│ [FP] Order ID ┆ Symbol    ┆ PositionSide ┆ Type          ┆ Size       ┆ Price ┆ Stop Price ┆ Trigger ┆ Status ┆ Client ID │
╞═══════════════╪═══════════╪══════════════╪═══════════════╪════════════╪═══════╪════════════╪═════════╪════════╪═══════════╡
│ FP-00003      ┆ PF_XBTUSD ┆ long         ┆ trailing-stop ┆ 0.10000000 ┆ —     ┆ 86000.00   ┆ last    ┆ open   ┆ —         │
│ FP-00004      ┆ PF_XBTUSD ┆ long         ┆ stop          ┆ 0.10000000 ┆ —     ┆ 85000.00   ┆ last    ┆ open   ┆ —         │
└───────────────┴───────────┴──────────────┴───────────────┴────────────┴───────┴────────────┴─────────┴────────┴───────────┘

$ kraken futures paper order-status FP-00003
┌─────────────────┬───────────────────────────────────┐
│ Field           ┆ Value                             │
╞═════════════════╪═══════════════════════════════════╡
│ Mode            ┆ [FUTURES PAPER] Simulated Trading │
│ Order ID        ┆ FP-00003                          │
│ Symbol          ┆ PF_XBTUSD                         │
│ PositionSide    ┆ long                              │
│ Type            ┆ trailing-stop                     │
│ Size            ┆ 0.10000000                        │
│ Price           ┆ —                                 │
│ Stop Price      ┆ 86000.00                          │
│ Trigger Signal  ┆ last                              │
│ Status          ┆ open                              │
│ Client Order ID ┆ —                                 │
│ Leverage        ┆ 10.0x                             │
│ Reduce Only     ┆ false                             │
└─────────────────┴───────────────────────────────────┘

$ kraken futures paper order-status FP-00003 -o json | jq
{
  "client_order_id": null,
  "leverage": 10.0,
  "mode": "futures_paper",
  "order_id": "FP-00003",
  "price": null,
  "reduce_only": false,
  "side": "long",
  "size": 0.1,
  "status": "open",
  "stop_price": 86000.0,
  "symbol": "PF_XBTUSD",
  "trigger_signal": "last",
  "type": "trailing-stop"
}

Automated Tests & Lints

  • cargo +nightly fmt --check
  • cargo clippy --all-targets -- -D warnings
  • cargo test --lib orders_and_order_status_surface_stop_price_and_trigger_signal

@MaxOxide

Copy link
Copy Markdown
Contributor

Thanks @theghostmac! This is fixed in v0.5.0. futures paper orders and order-status now show stop_price and trigger_signal. We ported your fix to the new crates/ layout and added you as co-author on the release commit. Closing this PR.

@MaxOxide MaxOxide closed this Oct 29, 2026
needaccforwhonix pushed a commit to needaccforwhonix/kraken-cli that referenced this pull request Nov 7, 2026
Sign in from the browser to create a restricted, expiring Spot API key.
The MCP server and the REPL ship as their own binaries, kraken-mcp and
kraken-shell, installed next to kraken. A paper strategy can go live in
a budget-fenced workspace, and a finished session packages as a recipe.
A timed-out order, cancel, withdrawal or transfer is never resent, and
an envelope that may hide an execution carries "verify_first": true.

Upgrading from 0.4.1 needs action from scripts, agents and MCP clients:
see CHANGELOG.md under 0.5.0.

Includes community fixes from krakenfx#50, krakenfx#51, krakenfx#54, krakenfx#55 and krakenfx#56.

Co-authored-by: theghostmac <83423188+theghostmac@users.noreply.github.com>
Co-authored-by: SashaMIT <33847880+SashaMIT@users.noreply.github.com>
Co-authored-by: sashaphmn <122053040+sashaphmn@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants