-
Notifications
You must be signed in to change notification settings - Fork 130
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
Account class #120
Account class #120
Conversation
@jiffyclub So I can have multiple account objects right? And on my end I will name the account objects and enable and disable them or should that be on your end? @mkreilly We should probably start with a tangible example. A few questions below... For instance, do you want to start with a TIF district where you identify parcels in the district and we add money to the accounts based on appreciation from the base year price? Do we have an easily accessible TIF identifier attached to parcels - I guess I need identifiers for both potential senders and potential receivers. The subaccount will be defined for each jurisdiction? For now, maybe we withdraw money from the account each year starting with those buildings that are eligible as receivers and are closest to profitable and then build them until the account runs dry? |
Yup, no global state here. Make as many accounts as needed, they'll stay separate. I'm not sure what you mean by "enable and disable", but I was thinking of usage like this: tif = Account('tif')
sim.add_injectable('tif', tif) or @sim.injectable('tif', cache=True)
def tif():
return Account('tif') And then write models that add transactions or do other necessary things. @sim.model('update_tif')
def update_tif(tif, tif_buildings, ...):
transactions = ... # calculate things
tif.add_transactions(transactions) |
This is reasonable. By disabled I mean that accounts will need to be turned off to see the impact of the account on the simulation. I can handle that though. @mkreilly Another question. Do the funds from multiple accounts get merged and then you can withdraw from them as a single source of funds? |
@jiffyclub is there a way to iterate through subaccounts and to get the balance for each subaccount? If not, I think we will need to add this. I can just do it from the transactions for now but it's probably a nice method to add? |
There's no sub-account level accounting as it relates to the balance. E.g. you don't initiate the account with different balances for each sub-account. We can quickly add a method that totals all the transactions for a given sub-account. Is that what you need, or do you need to track initial balances for each sub-account as well? |
That's what I need. I don't need to set initial balances at the subaccount level. I imagine just a groupby and a sum, but better to hide that from me. |
Okay, I can add that real quick. |
041d51c adds a for sa, total in account.iter_subaccounts():
# do stuff Does that look like what you need? |
Yes that looks perfect |
normally feasibility has a hierarchical index of (form, attribute) - this allows you to pass a dataframe of just attibutes when you're only developing one form at a time
@jiffyclub I think this can be merged whenever you're ready. I've been able to apply the case study we worked out with Mike with the currently available features. |
Account class for tracking money
For tracking money. Right now it has
.add_transaction(amount, subaccount, metadata)
,.add_transactions(transactions)
, and.to_frame()
methods. You can access the balance or list of transactions via the.balance
and.transactions
attributes, respectively. What else does it need?