This commit is contained in:
youngcw 2023-06-01 17:10:22 -07:00
commit 10c3bb523e
5 changed files with 130 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
afcu/*

14
afcu.sh Normal file
View File

@ -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/last_afcu_date)
python3 -m ofxtools.scripts.ofxget stmt americafirst --pretty -u $acct --password $PW --checking $checkingid --bankid $bankid -s $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

1
amex_ofx.sh Normal file
View File

@ -0,0 +1 @@
python3 -m ofxtools.scripts.ofxget stmt amex -u calebyoung94

15
macu.sh Normal file
View File

@ -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/last_macu_date)
python3 -m ofxtools.scripts.ofxget stmt macu --pretty -u $login --password $PW --checking $checkingid --bankid $bankid -s $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

99
parse_ofx.py Normal file
View File

@ -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);