TUI: press Enter on book-cursor level to prefill place-order modal
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 68/100
Línea de trabajo
Comienza por el manejo de book_cursor de la Market Detail view y por el PlaceOrderWorkflow existente que se abre mediante t; sigue también la ruta de paper_engine. Añade la rama Enter y la derivación del prefill, y verifica los cambios de lado bid/ask y el comportamiento en paper-mode. Actualiza la superposición de ayuda de Detail View y el pie de página del cursor activo, y confirma que el modal muestra el precio límite y la cantidad seleccionados.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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:
-
Opens the existing place-order workflow (`PlaceOrderWorkflow`, same one `t` triggers).
-
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.
-
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.
- Lenguaje dominante
- Rust
- Estrellas
- 27
- Forks
- 9
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de crypto-com/cdcx-cli
-
TUI: orderbook renders unreadable colours on macOS Terminal.app (truecolor RGB not supported)Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
crypto-com/cdcx-cli#36 ·
-
Dificultad 4/5 3-5 días Aptitud para principiantes 52/100
crypto-com/cdcx-cli#32 ·
Todos los issues de crypto-com/cdcx-cli
Issues similares
-
bug priority: low ui
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
storytold/gridcraft#3446 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
seabeectl verify exits 0 when verification failsPosiblemente ocupada @theyottaboy la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
NationalSecurityAgency/seabee#73 ·
Los mantenedores suelen responder en 4 días
-
ready-for-agent
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
neilsh/stunt-reel#220 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
Los mantenedores suelen responder en 1 día