TUI: press Enter on book-cursor level to prefill place-order modal

Đang mở
#34 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

@llcro đang làm issue này rồi.

Từ ngày 6/5/2026.

  • #35 của @llcro — đang mở

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
68/100
Loại issue
Tính năng
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
rust
Lĩnh vực
cli

Hướng nghiên cứu

Bắt đầu từ phần xử lý book_cursor của Market Detail view và PlaceOrderWorkflow hiện có được mở bằng t; đồng thời theo dõi cả đường đi của paper_engine. Thêm nhánh Enter và phần suy ra prefill, sau đó xác minh việc đảo phía bid/ask và hành vi trong paper-mode. Cập nhật lớp phủ trợ giúp của Detail View và footer của con trỏ đang hoạt động, đồng thời xác nhận rằng modal hiển thị giá giới hạn và số lượng đã chọn.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Context

#33 (merged as part of #26 Piece 2) added an interactive book-level cursor on Market Detail view. The cursor lets the user inspect a specific price level — but they can't yet act on it. The natural next step: pressing Enter on a selected level opens the place-order workflow prefilled with that price.

This is the punchline of the cursor work. Without it, Piece 2 is look-but-don't-touch.

Proposed behavior

On Market Detail view with `book_cursor` active, pressing Enter:

  1. Opens the existing place-order workflow (`PlaceOrderWorkflow`, same one `t` triggers).

  2. Prefills:

    • instrument = `detail_instrument`
    • side: opposite of cursor side — `BookCursor::Bid() → SELL` (you're selling into the bid), `BookCursor::Ask() → BUY` (you're buying from the ask).
    • order type = LIMIT (price-aware — MARKET wouldn't make sense given we're explicitly using the selected price).
    • price = the selected level's price, formatted per the instrument's price tick.
    • qty = the selected level's qty. User is free to override. Rationale: "how much is at this level" is a common starting quote; the user will almost always adjust.
  3. Cursor clears on entry (consistent with how `t`, `k`, `m`, `D` already clear it).

UX questions to resolve during implementation

  • Is prefilling qty the right default? Alternatives: leave it empty (force user to type), or use the selected level's cumulative qty (i.e. "sweep through this level"). I lean empty or level-qty. Cumulative is a power-user ask; wait for demand.
  • LIMIT vs LIMIT_POST_ONLY? Limit orders that cross the spread immediately become takers. For maker-intent users the POST_ONLY variant is safer. Propose: LIMIT by default, user can flip to POST_ONLY in the modal.
  • Paper mode? Prefill must work in paper mode too (routes through `paper_engine` instead of REST). Already how `t` behaves; nothing new here, just don't forget to test it.

Scope

In scope:

  • Wire `Enter` on Detail view (only when `book_cursor.is_some()`).
  • Prefill logic in `PlaceOrderWorkflow::new_with_prefill` or an equivalent constructor.
  • Tests: prefill derivation is pure logic — cursor + book → workflow init params. Mutation-verify the side flip (ask → BUY, bid → SELL).
  • Help overlay "Detail View" page updated with `Enter: place limit @ level`.
  • Footer hint updated when cursor active: add `Enter:trade@level`.

Out of scope:

  • Multi-level sweeps / aggregation.
  • MARKET prefill (doesn't make semantic sense when the user explicitly picked a price).
  • Stop / OCO / OTOCO prefill from the cursor — separate workflows, can extend later if demanded.
  • Mouse-click on level to set cursor then Enter — separate UX polish (click-only trade would need a double-click or modifier to avoid accidents).

Risk

  • Low. Reuses `PlaceOrderWorkflow`; new code is the prefill constructor + one Enter branch.
  • Biggest risk: wrong side flip (buying into a bid is not what the user meant). Tests and a clear footer label (`SELL @ 78,550` shown in the modal header) mitigate.

Related

  • #26 — parent feature (Pieces 1 + 2 now merged).
  • #33 — Piece 2 PR; shipped the `book_cursor` state this issue builds on.
  • #32 — session persistence; orthogonal but might eventually persist a "default prefill qty mode" (empty vs level-qty) if users have strong preferences.

Agent-native parity

The equivalent agent action is `cdcx trade limit --side SELL --price

--qty ` — already shipped. An MCP-side helper that reads the book and emits the corresponding trade params would cleanly mirror the TUI binding; file as a separate issue only if we hear demand.

Ngôn ngữ chính
Rust
Star
27
Fork
9
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của crypto-com/cdcx-cli

Tất cả issue của crypto-com/cdcx-cli

Issue tương tự

Thêm issue về Rust

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.