Add rates command#363
Merged
Merged
Conversation
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.
d733772 to
ccc9b53
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR introduces a new
ratescommand that fetches current bid/ask prices for a list of ISINs from Trade Republic.pytr rates DE0005140008 US0378331005), read from an input file (-i), or piped via stdin (-i -)-o, output is a fixed-column table sorted by name; with-o, a semicolon-delimited CSV is written--lang,--decimal-localization,--sort-by-column, and--sort-ascendingoptions as the portfolio commandTo avoid duplicating the WebSocket subscription logic, a new
tickers.pymodule has been extracted with shared helpers used by bothportfolioandrates:fetch_instrument_details()— fetches name and exchange IDs for a list of positionsfetch_tickers()— fetches bid/ask prices with bond price correction (÷100)normalize_lang(),decimal_format()— shared formatting utilitiesThe portfolio command also gains a new
--ignoreflag accepting a semicolon-separated list of ISINs to exclude from the output.