Skip to content

Add rates command#363

Merged
RealCLanger merged 4 commits into
pytr-org:masterfrom
RealCLanger:rates-command
Jun 27, 2026
Merged

Add rates command#363
RealCLanger merged 4 commits into
pytr-org:masterfrom
RealCLanger:rates-command

Conversation

@RealCLanger

@RealCLanger RealCLanger commented Jun 25, 2026

Copy link
Copy Markdown
Collaborator

Summary

This PR introduces a new rates command that fetches current bid/ask prices for a list of ISINs from Trade Republic.

  • ISINs can be passed as positional arguments (pytr rates DE0005140008 US0378331005), read from an input file (-i), or piped via stdin (-i -)
  • Without -o, output is a fixed-column table sorted by name; with -o, a semicolon-delimited CSV is written
  • Supports the same --lang, --decimal-localization, --sort-by-column, and --sort-ascending options as the portfolio command

To avoid duplicating the WebSocket subscription logic, a new tickers.py module has been extracted with shared helpers used by both portfolio and rates:

  • fetch_instrument_details() — fetches name and exchange IDs for a list of positions
  • fetch_tickers() — fetches bid/ask prices with bond price correction (÷100)
  • normalize_lang(), decimal_format() — shared formatting utilities

The portfolio command also gains a new --ignore flag accepting a semicolon-separated list of ISINs to exclude from the output.

Introduces a new `rates` command that fetches current bid/ask prices for
a list of ISINs. ISINs can be passed as positional arguments, read from a
CSV file (-i), or piped via stdin. Output is a fixed-column table to the
console or a semicolon-delimited CSV (-o).

To support code sharing with the existing portfolio command, ticker-fetching
logic (instrument details, ticker subscriptions, bond price correction,
decimal formatting, language normalisation) has been extracted into a new
tickers.py module used by both commands.

Also adds --ignore flag to the portfolio command to exclude specific ISINs.
@RealCLanger RealCLanger merged commit 24163dc into pytr-org:master Jun 27, 2026
@RealCLanger RealCLanger deleted the rates-command branch June 27, 2026 14:34
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.

1 participant