Expand description
bezant — command-line tool for the IBKR Client Portal Web API.
Wraps [bezant::Client] with a clap-powered CLI so ops / shell users can
poke the Gateway without pulling in the Rust crate as a dependency.
Output format defaults to JSON (machine-readable, pipe-friendly). Pass
--output table for a human-readable table on subcommands where one
makes sense (positions, accounts, orders); the table renderer falls
back to JSON for endpoints whose shape isn’t tabular (tickle,
health).
Every subcommand prints to stdout on success and a non-zero exit on
failure. Errors are printed to stderr as a one-line bezant: <message>
followed by indented caused by: lines for each layer of the error chain.
§Environment
| Env var | Default | Meaning |
|---|---|---|
IBKR_GATEWAY_URL | https://localhost:5000/v1/api | Base URL of the Client Portal Gateway |
BEZANT_VERIFY_TLS | false | Set to true to enforce cert validation |
Structs§
- Cli 🔒
Enums§
- Cmd 🔒
- Output
Format 🔒
Functions§
- array_
table 🔒 - Render a JSON array of objects as a table whose columns are the supplied field names. Returns None when the body isn’t an array (caller falls back to JSON).
- decode_
json 🔒 - fetch_
json 🔒 - Fetch a JSON body by building a path relative to the Gateway base URL.
- kv_
table 🔒 - Render a JSON object as a 2-column “field / value” table.
- main 🔒
- paginated_
positions 🔒 - Walk pages of
/portfolio/{id}/positions/{page}until a short page arrives or we hit the safety cap. Emits a stderr warning when the cap fires so the caller knows results were truncated — silently hittingMAX_POSITION_PAGESwas a coverage gap flagged in review. - print_
json 🔒 - render 🔒
- Render
bodyeither as JSON (always works) or viato_tableif the caller supplied a tabular projection AND--output tablewas passed.to_tablereturnsNonewhen the endpoint shape doesn’t have a useful table form (e.g.ticklereturns just a session id). - run 🔒
- value_
cell 🔒 - Stringify a JSON value for table display. Strings without quotes, nulls as a literal “-” (so empty cells stand out), nested objects/arrays compact-JSON’d to keep rows readable.