-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
61 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,40 @@ | ||
import streamlit as st | ||
import key as k | ||
|
||
import key as k | ||
|
||
st.write('## Assets') | ||
|
||
st.write('## Account Balances') | ||
accounts = {'txbl': 'taxable', 'txDef': 'tax-deferred', 'txFree': 'tax-exempt'} | ||
col1, col2 = st.columns(2, gap='small', vertical_alignment='top')#, border=False) | ||
col1, col2 = st.columns(2, gap='small', vertical_alignment='top') | ||
with col1: | ||
iname0 = st.session_state.iname0 | ||
for key in accounts: | ||
nkey = key+str(0) | ||
k.init(nkey, 0) | ||
ret = k.getNum('%s %s account ($k)' % (iname0, accounts[key]), nkey) | ||
nkey = key+str(0) | ||
k.init(nkey, 0) | ||
ret = k.getNum('%s %s account ($k)' % (iname0, accounts[key]), nkey) | ||
|
||
with col2: | ||
if st.session_state.status == 'married': | ||
iname1 = st.session_state.iname1 | ||
for key in accounts: | ||
nkey = key+str(1) | ||
k.init(nkey, 0) | ||
ret = k.getNum('%s %s account ($k)' % (iname1, accounts[key]), nkey) | ||
nkey = key+str(1) | ||
k.init(nkey, 0) | ||
ret = k.getNum('%s %s account ($k)' % (iname1, accounts[key]), nkey) | ||
|
||
if st.session_state.status == 'married': | ||
st.write('#### Beneficiary fractions') | ||
col1, col2, col3 = st.columns(3, gap='small', vertical_alignment='top')#, border=False) | ||
col1, col2, col3 = st.columns(3, gap='small', vertical_alignment='top') | ||
with col1: | ||
nkey = 'benf'+str(0) | ||
k.init(nkey, 1) | ||
ret = k.getNum('Beneficiary fraction (%s)' % accounts['txbl'], nkey) | ||
nkey = 'benf'+str(0) | ||
k.init(nkey, 1) | ||
ret = k.getNum('Beneficiary fraction (%s)' % accounts['txbl'], nkey) | ||
|
||
with col2: | ||
nkey = 'benf'+str(1) | ||
k.init(nkey, 1) | ||
ret = k.getNum('Beneficiary fraction (%s)' % accounts['txDef'], nkey) | ||
nkey = 'benf'+str(1) | ||
k.init(nkey, 1) | ||
ret = k.getNum('Beneficiary fraction (%s)' % accounts['txDef'], nkey) | ||
|
||
with col3: | ||
nkey = 'benf'+str(2) | ||
k.init(nkey, 1) | ||
ret = k.getNum('Beneficiary fraction (%s)' % accounts['txFree'], nkey) | ||
nkey = 'benf'+str(2) | ||
k.init(nkey, 1) | ||
ret = k.getNum('Beneficiary fraction (%s)' % accounts['txFree'], nkey) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,50 @@ | ||
import streamlit as st | ||
|
||
|
||
def dump(): | ||
print('Dump:', st.session_state) | ||
|
||
|
||
def push(key): | ||
# print('pushing', key, 'as', st.session_state['_'+key]) | ||
st.session_state[key] = st.session_state['_'+key] | ||
# dump() | ||
|
||
|
||
def store(key, val): | ||
# print('storing', key, 'as', val) | ||
st.session_state[key] = val | ||
# dump() | ||
|
||
|
||
def init(key, val): | ||
if key not in st.session_state: | ||
# print('init', key, 'as', val) | ||
st.session_state[key] = val | ||
# dump() | ||
|
||
|
||
def getNum(text, nkey, disabled=False, callback=push): | ||
return st.number_input(text, | ||
value=st.session_state[nkey], | ||
disabled=disabled, | ||
on_change=callback, args=[nkey], key='_'+nkey) | ||
return st.number_input(text, | ||
value=st.session_state[nkey], | ||
disabled=disabled, | ||
on_change=callback, args=[nkey], key='_'+nkey) | ||
|
||
|
||
def getText(text, nkey, disabled=False, callback=push): | ||
return st.text_input(text, | ||
value=st.session_state[nkey], | ||
disabled=disabled, | ||
on_change=callback, args=[nkey], key='_'+nkey) | ||
return st.text_input(text, | ||
value=st.session_state[nkey], | ||
disabled=disabled, | ||
on_change=callback, args=[nkey], key='_'+nkey) | ||
|
||
|
||
def getRadio(text, choices, nkey, callback=push): | ||
return st.radio(text, choices, | ||
index=choices.index(st.session_state[nkey]), | ||
on_change=callback, args=[nkey], key='_'+nkey, | ||
horizontal=True) | ||
|
||
|
||
def getToggle(text, nkey, callback=push): | ||
return st.toggle(text, value=st.session_state[nkey], | ||
on_change=callback, args=[nkey], key='_'+nkey) | ||
on_change=callback, args=[nkey], key='_'+nkey) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,5 +17,5 @@ | |
st.Page('Monte_Carlo.py'), | ||
st.Page('Summary.py'), | ||
st.Page('Logs.py'), | ||
]) | ||
]) | ||
pg.run() |