From f51af6dd4460b94edc9081e8cd7aceb20a5f5b94 Mon Sep 17 00:00:00 2001 From: Aaron Lindsay Date: Tue, 28 Mar 2017 19:42:16 -0400 Subject: [PATCH] cmd/ofx: Play nice with Fidelity Fidelity (Netbenefits at least) returns an error of DTEND is the current day, so request 'yesterday' by default. --- cmd/ofx/invdownload.go | 5 +++-- cmd/ofx/invtransactions.go | 11 +++++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/cmd/ofx/invdownload.go b/cmd/ofx/invdownload.go index 97fad8c..b6d7c90 100644 --- a/cmd/ofx/invdownload.go +++ b/cmd/ofx/invdownload.go @@ -52,10 +52,11 @@ func invDownload() { BrokerId: ofxgo.String(brokerId), AcctId: ofxgo.String(acctId), }, - DtStart: ofxgo.Date(time.Now().AddDate(-1, 0, 0)), - DtEnd: ofxgo.Date(time.Now()), + DtStart: ofxgo.Date(time.Now().AddDate(-1, 0, 0)), // a year ago + DtEnd: ofxgo.Date(time.Now().AddDate(0, 0, -1)), // Some FIs (*cough* Fidelity) return errors if DTEND is the current day Include: true, IncludeOO: true, + PosDtAsOf: ofxgo.Date(time.Now()), IncludePos: true, IncludeBalance: true, Include401K: true, diff --git a/cmd/ofx/invtransactions.go b/cmd/ofx/invtransactions.go index a4c97ae..5ca74cf 100644 --- a/cmd/ofx/invtransactions.go +++ b/cmd/ofx/invtransactions.go @@ -38,12 +38,15 @@ func invTransactions() { BrokerId: ofxgo.String(brokerId), AcctId: ofxgo.String(acctId), }, - DtStart: ofxgo.Date(time.Now().AddDate(-1, 0, 0)), - DtEnd: ofxgo.Date(time.Now()), + DtStart: ofxgo.Date(time.Now().AddDate(-1, 0, 0)), // a year ago + DtEnd: ofxgo.Date(time.Now().AddDate(0, 0, -1)), // Some FIs (*cough* Fidelity) return errors if DTEND is the current day Include: true, + IncludeOO: true, + PosDtAsOf: ofxgo.Date(time.Now()), + IncludePos: true, IncludeBalance: true, - // TODO Include401K: true, - // TODO Include401KBal: true, + Include401K: true, + Include401KBal: true, } query.Investments = append(query.Investments, &statementRequest)