Title: Add --limit / -n flag to cap returned data points#11
Open
Loboston wants to merge 2 commits into
Open
Conversation
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.
Why
Most Alpha Vantage endpoints return large datasets by default. The --limit / -n flag gives users a quick way to preview the most recent N data points without processing the full response.
Testing
Manually tested against TIME_SERIES_DAILY, TIME_SERIES_WEEKLY, TIME_SERIES_MONTHLY, FX_DAILY, FX_WEEKLY,
DIGITAL_CURRENCY_DAILY, and SMA. Also added 5 unit tests covering all code paths, the first test suite in this repo.
Examples
1.
marketdata-cli TIME_SERIES_DAILY AAPL --limit 5
timestamp,open,high,low,close,volume
2026-03-20,247.9750,249.1999,246.0000,247.9900,87139466
2026-03-19,249.4000,251.8300,247.3000,248.9600,34864082
2026-03-18,252.6250,254.9400,249.0000,249.9400,35757874
2026-03-17,252.9550,255.1300,252.1800,254.2300,32361607
2026-03-16,252.1050,253.8850,249.8800,252.8200,32074209
marketdata-cli fx_weekly --from_symbol USD --to_symbol EUR -n 5
timestamp,open,high,low,close
2026-03-19,0.87600,0.87620,0.86080,0.86280
2026-03-13,0.86430,0.87630,0.85690,0.87590
2026-03-06,0.84710,0.86720,0.84710,0.86070
2026-02-27,0.84830,0.84980,0.84470,0.84640
2026-02-20,0.84250,0.85160,0.84180,0.84870