Skip to content

Commit

Permalink
factor account header base
Browse files Browse the repository at this point in the history
  • Loading branch information
yellowbean committed Nov 11, 2023
1 parent 8479938 commit 3e486e4
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
8 changes: 6 additions & 2 deletions absbox/local/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,6 @@
intLikeFormula = set(["borrowerNumber","monthsTillMaturity"])
boolLikeFormula = set(["trigger","事件","isMostSenior","最优先"])



op_map = {
">":"G"
,">=":"GE"
Expand Down Expand Up @@ -127,3 +125,9 @@
"chinese":["估值","WAL","Duration","Convexity","AccruedInterest"]
,"english":["Pricing","WAL","Duration","Convexity","AccruedInterest"]
}

#account fields
accountHeader = {
"chinese": {"idx": "日期", "change": "变动额", "bal": ("期初余额", '余额', "期末余额")}
,"english": {"idx": "date", "change": "change", "bal": ("begin balance", 'balance', "end balance")}
}
2 changes: 1 addition & 1 deletion absbox/local/china.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def read(resp):
for f, v in output['fees'].items()}

# aggregate accounts
output['agg_accounts'] = aggAccs(output['accounts'],'cn')
output['agg_accounts'] = aggAccs(output['accounts'],'chinese')

output['pool'] = {}
if deal_content['pool']['futureCf'] is None:
Expand Down
7 changes: 1 addition & 6 deletions absbox/local/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -1580,12 +1580,7 @@ def buildCashReport(cashData):


def aggAccs(x, locale):
_header = {
"cn": {"idx": "日期", "change": "变动额", "bal": ("期初余额", '余额', "期末余额")}
,"en": {"idx": "date", "change": "change", "bal": ("begin balance", 'balance', "end balance")}
}

header = _header[locale]
header = accountHeader[locale]
agg_acc = {}
for k, v in x.items():
acc_by_date = v.groupby(header["idx"])
Expand Down
2 changes: 1 addition & 1 deletion absbox/local/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def read(resp):
for f, v in output['fees'].items()}

# aggregate accounts
output['agg_accounts'] = aggAccs(output['accounts'], 'en')
output['agg_accounts'] = aggAccs(output['accounts'], 'english')

output['pool'] = {}

Expand Down

0 comments on commit 3e486e4

Please sign in to comment.