commit 10c3bb523eb28e55113d424bfb1518313fd2a68e Author: youngcw Date: Thu Jun 1 17:10:22 2023 -0700 init diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b4ff2b1 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +afcu/* diff --git a/afcu.sh b/afcu.sh new file mode 100644 index 0000000..24fdf73 --- /dev/null +++ b/afcu.sh @@ -0,0 +1,14 @@ +PW="P6j5d&C8RBzy1m!W0h@A" +acct="22624662" +checkingid="${acct}~9" +savingsid="${acct}~1" +visaid="${acct}~6" +moneymrktid="${acct}~7" +bankid=324377516 +lastdate=$( afcu/checking.ofx +python3 -m ofxtools.scripts.ofxget stmt americafirst --pretty -u $acct --password $PW --savings $savingsid --bankid $bankid -s $lastdate > afcu/savings.ofx +python3 -m ofxtools.scripts.ofxget stmt americafirst --pretty -u $acct --password $PW --creditcard $visaid --bankid $bankid -s $lastdate > afcu/visa.ofx +python3 -m ofxtools.scripts.ofxget stmt americafirst --pretty -u $acct --password $PW --moneymrkt $moneymrktid --bankid $bankid -s $lastdate > afcu/mm.ofx +date +%Y%m%d > afcu/last_afcu_date diff --git a/amex_ofx.sh b/amex_ofx.sh new file mode 100644 index 0000000..e86f81b --- /dev/null +++ b/amex_ofx.sh @@ -0,0 +1 @@ +python3 -m ofxtools.scripts.ofxget stmt amex -u calebyoung94 diff --git a/macu.sh b/macu.sh new file mode 100644 index 0000000..a3e5ba1 --- /dev/null +++ b/macu.sh @@ -0,0 +1,15 @@ +PW="p7xVHXq2*pCG4i!9td*B" +login="calebyoung94" +acct="9061150" +checkingid="${acct}~50" +savingsid="${acct}~1" +visaid="${acct}~6" +#moneymrktid="${acct}~7" +bankid=324079555 +lastdate=$( macu/checking.ofx +#python3 -m ofxtools.scripts.ofxget stmt macu --pretty -u $login --password $PW --savings $savingsid --bankid $bankid -s $lastdate > macu/savings.ofx +#python3 -m ofxtools.scripts.ofxget stmt macu --pretty -u $login --password $PW --creditcard $visaid --bankid $bankid -s $lastdate > macu/visa.ofx +#python3 -m ofxtools.scripts.ofxget stmt macu --pretty -u $login --password $PW --moneymrkt $moneymrktid --bankid $bankid -s $lastdate > macu/mm.ofx +date +%Y%m%d > macu/last_macu_date diff --git a/parse_ofx.py b/parse_ofx.py new file mode 100644 index 0000000..ab94bb4 --- /dev/null +++ b/parse_ofx.py @@ -0,0 +1,99 @@ +import codecs +import json +from ofxparse import OfxParser +with codecs.open('./afcu.ofx',encoding="us-ascii") as fileobj: + ofx = OfxParser.parse(fileobj) + +# The OFX object + +ofx.account # An Account object + +# AccountType +# (Unknown, Bank, CreditCard, Investment) + +# Account + +account = ofx.account +account.account_id # The account number +account.number # The account number (deprecated -- returns account_id) +account.routing_number # The bank routing number +account.branch_id # Transit ID / branch number +account.type # An AccountType object +account.statement # A Statement object +account.institution # An Institution object + +# InvestmentAccount(Account) + +#account.brokerid # Investment broker ID +account.statement # An InvestmentStatement object + +# Institution + +institution = account.institution +institution.organization +institution.fid + +# Statement + +statement = account.statement +statement.start_date # The start date of the transactions +statement.end_date # The end date of the transactions +statement.balance # The money in the account as of the statement date +statement.available_balance # The money available from the account as of the statement date +statement.transactions # A list of Transaction objects + +# InvestmentStatement + +statement = account.statement +#statement.positions # A list of Position objects +statement.transactions # A list of InvestmentTransaction objects + +# Transaction + +for transaction in statement.transactions: + #print("payee:%s"%transaction.payee) + #print("type:%s"%transaction.type) + transaction.date + transaction.user_date + transaction.amount + transaction.id + transaction.memo + transaction.sic + transaction.mcc + transaction.checknum + +# InvestmentTransaction + +#for transaction in statement.transactions: +# transaction.type +# transaction.tradeDate +# transaction.settleDate +# transaction.memo +# transaction.security # A Security object +# transaction.income_type +# transaction.units +# transaction.unit_price +# transaction.comission +# transaction.fees +# transaction.total +# transaction.tferaction + +# Positions + +#for position in statement.positions: +# position.security # A Security object +# position.units +# position.unit_price +# position.market_value + +# Security + +#security = transaction.security +## or +#security = position.security +#security.uniqueid +#security.name +#security.ticker +#security.memo +js=json.dumps(ofx.account.statement.__dict__) +print(js);