Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Flag to Set Start/End Dates to Earliest/Latest Day of Year #7

Open
prikhi opened this issue Mar 19, 2020 · 6 comments
Open

Add Flag to Set Start/End Dates to Earliest/Latest Day of Year #7

prikhi opened this issue Mar 19, 2020 · 6 comments

Comments

@prikhi
Copy link
Owner

prikhi commented Mar 19, 2020

Currently, the start/end dates are based on the entry dates in the journal file. Start is the earliest entry's date, end is the last entry's date.

Add a new flag to set the start/end dates to the first day of the earliest year and the last day of the latest year, respectively.

@cgo
Copy link

cgo commented Feb 26, 2022

That is actually something that I was missing just now!

@prikhi
Copy link
Owner Author

prikhi commented Mar 13, 2022

@cgo Would you want something like --year 2022 to fetch all prices for only 2022, or something more general like --year to expand the start/end dates to Jan 1st of the earliest year in the journal & Dec 31st of the latest year in the journal?

@cgo
Copy link

cgo commented Mar 13, 2022

@prikhi thanks for coming back! I was thinking more along the lines of --period (and then a time period), and one option that fetches prices newer than the latest recorded price that is already in the target journal file.
So that each time I want to get the latest prices, not all the date range has to be fetched.
Not sure that is understandable enough, does this make sense to you?

@prikhi
Copy link
Owner Author

prikhi commented Mar 13, 2022

Yes something like --period "2022-01 to 2022-06" for fetching the first 6 months of 2022? And a separate option like --newer-only that would output prices for 2022-04-21 -> today if the last price directive in the journal was for 2022-04-20?

We actually don't have to worry about fetching too many prices - AlphaVantage always returns all the history they have in one single API call, our code then filters the response for the dates we care about.

That said, either of those flags will take a bit more time to implement compared to --year YYYY or --full-years flags, especially if --newer-only should generate date ranges on a per-commodity basis. I'll have to see if the hledger library exposes something that would make implementing --period trivial.

@simonmichael
Copy link

simonmichael commented Mar 14, 2022

It's nice for users when addons can provide flags somewhat consistent with hledger's. periodFromRawOpts could be a useful helper here, but it's not exported. We should change that.

@cgo
Copy link

cgo commented Mar 15, 2022

Yes something like that, and more like what @simonmichael was saying in his reply I guess.

Interesting that Alphavantage is just sending all they have, I didn't know that. Seems a bit wasteful on their side.

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

No branches or pull requests

3 participants