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

Question about behaviour of -r flag #107

Open
emin-ec opened this issue Jul 23, 2020 · 3 comments
Open

Question about behaviour of -r flag #107

emin-ec opened this issue Jul 23, 2020 · 3 comments

Comments

@emin-ec
Copy link

emin-ec commented Jul 23, 2020

I have a question about the -r flag. When I do

ledger-autosync -L -m 90 - a 'My Vanguard Account'

I only get transactions from the last week or so.

But when I add the -r flag to do

ledger-autosync -r -L -m 90 - a 'My Vanguard Account'

I get transactions going back a few months.

I understand that -r is for resync but I thought I could achieve the same effect by not providing a ledger file or ~/.ledgerrc. But it seems like either ledger-autosync or ofxclient is somehow storing some information about what it thinks it has downloaded. Any thoughts on that? For example, is there a hidden file somewhere that l-a or ofxclient uses for this?

The reason I ask is that in trying to describe how to get started with l-a from a blank setup I shouldn't need to use the -r flag but it seems like for some reason the -r is necessary.

@egh
Copy link
Owner

egh commented Jul 23, 2020

Hi @emin-ec

Honestly, I'm not sure the logic is great. There is no stored information, but probably the logic should be improved. The intended behavior should be that l-a will go back up to 90 days to get data that isn't already present in your ledger file. So you are correct, you shouldn't need that -r flag. There is probably a bug in the code. I'll take a look!

@emin63
Copy link
Contributor

emin63 commented Jul 23, 2020

OK, I think the problem is in the code snippet below from sync.py:

    def get_new_txns(self, acct, max_days=999999, resync=False):
        if resync or (max_days < 7):
            days = max_days
        else:
            days = 7

I'm not sure on the difference between days and max_days but the logic above doesn't seem right. if resync is False, why should days = 7?

Btw, sorry for some postings as emin63 and others as emin-ec. The latter is my work account but I will try to use the former as it is my personal account.

@egh
Copy link
Owner

egh commented Jul 23, 2020

days is an iterator that gets increased as the code requests more and more days of data until it finds something it's aware of. At least, that is how it is supposed to work. And no worries about the github accounts - I didn't even notice :)

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