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

Account class #120

Merged
merged 11 commits into from
Nov 25, 2014
Merged

Account class #120

merged 11 commits into from
Nov 25, 2014

Conversation

jiffyclub
Copy link
Member

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?

@fscottfoti
Copy link
Contributor

@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?

@jiffyclub
Copy link
Member Author

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)

@fscottfoti
Copy link
Contributor

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?

@fscottfoti
Copy link
Contributor

@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?

@jiffyclub
Copy link
Member Author

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?

@fscottfoti
Copy link
Contributor

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.

@jiffyclub
Copy link
Member Author

Okay, I can add that real quick.

@jiffyclub
Copy link
Member Author

041d51c adds a .iter_subaccounts() method that yields tuples of subaccount name and transaction totals. So you'd do something like:

for sa, total in account.iter_subaccounts():
    # do stuff

Does that look like what you need?

@fscottfoti
Copy link
Contributor

Yes that looks perfect

fscottfoti and others added 5 commits November 10, 2014 15:25
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
@fscottfoti
Copy link
Contributor

@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.

jiffyclub added a commit that referenced this pull request Nov 25, 2014
Account class for tracking money
@jiffyclub jiffyclub merged commit b7f8930 into master Nov 25, 2014
@jiffyclub jiffyclub deleted the accounts branch November 25, 2014 21:09
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

Successfully merging this pull request may close these issues.

None yet

2 participants