Skip to content

Commit 21a84cd

Browse files
committed
update deal status
1 parent 9a3d298 commit 21a84cd

File tree

3 files changed

+78
-51
lines changed

3 files changed

+78
-51
lines changed

absbox/local/component.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1265,7 +1265,7 @@ def mkStatus(x: tuple|str):
12651265
case "违约" | "Defaulted":
12661266
return mkTag(("DealDefaulted", None))
12671267
case "结束" | "Ended":
1268-
return mkTag(("Ended"))
1268+
return mkTag(("Ended", None))
12691269
case ("设计", st) | ("PreClosing", st) | ("preclosing", st):
12701270
return mkTag(("PreClosing", mkStatus(st)))
12711271
case _:

docs/source/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
copyright = '2025, Xiaoyu Zhang'
1010
author = 'Xiaoyu Zhang'
1111

12-
release = "0.50.1"
13-
release = "0.50.1"
12+
release = "0.50.2"
13+
release = "0.50.2"
1414

1515
# -- General configuration
1616

docs/source/nbsample/TriggerByPeriod.ipynb

Lines changed: 75 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
},
2121
{
2222
"cell_type": "code",
23-
"execution_count": 2,
23+
"execution_count": 7,
2424
"id": "bccf1e85",
2525
"metadata": {},
2626
"outputs": [],
@@ -90,31 +90,23 @@
9090
},
9191
{
9292
"cell_type": "code",
93-
"execution_count": 3,
93+
"execution_count": 9,
9494
"id": "33ca4042",
9595
"metadata": {},
9696
"outputs": [
9797
{
9898
"data": {
9999
"text/html": [
100-
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">Connecting engine server -&gt; <span style=\"color: #0000ff; text-decoration-color: #0000ff; text-decoration: underline\">https://absbox.org/api/dev</span>\n",
100+
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">Connecting engine server -&gt; <span style=\"color: #0000ff; text-decoration-color: #0000ff; text-decoration: underline\">http://localhost:8081</span>\n",
101101
"</pre>\n"
102102
],
103103
"text/plain": [
104-
"Connecting engine server -> \u001b[4;94mhttps://absbox.org/api/dev\u001b[0m\n"
104+
"Connecting engine server -> \u001b[4;94mhttp://localhost:8081\u001b[0m\n"
105105
]
106106
},
107107
"metadata": {},
108108
"output_type": "display_data"
109109
},
110-
{
111-
"name": "stderr",
112-
"output_type": "stream",
113-
"text": [
114-
"/home/xiaoyu/repo/AbsBox/lib/python3.13/site-packages/urllib3/connectionpool.py:1097: InsecureRequestWarning: Unverified HTTPS request is being made to host 'absbox.org'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#tls-warnings\n",
115-
" warnings.warn(\n"
116-
]
117-
},
118110
{
119111
"data": {
120112
"text/html": [
@@ -135,30 +127,57 @@
135127
},
136128
{
137129
"cell_type": "code",
138-
"execution_count": 4,
139-
"id": "83f7a2f5",
130+
"execution_count": 10,
131+
"id": "affc23dc-659d-46da-8432-e5043c7c77f7",
140132
"metadata": {},
141133
"outputs": [
142134
{
143-
"name": "stderr",
144-
"output_type": "stream",
145-
"text": [
146-
"/home/xiaoyu/repo/AbsBox/lib/python3.13/site-packages/urllib3/connectionpool.py:1097: InsecureRequestWarning: Unverified HTTPS request is being made to host 'absbox.org'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#tls-warnings\n",
147-
" warnings.warn(\n"
148-
]
149-
},
135+
"data": {
136+
"text/plain": [
137+
"{'BeginDistributionWF': {'periodTest': {'trgName': '',\n",
138+
" 'trgCondition': {'tag': 'IfRateByPeriodCurve',\n",
139+
" 'contents': ['GE',\n",
140+
" {'tag': 'CumulativePoolDefaultedRate', 'contents': None},\n",
141+
" {'tag': 'DealStatInt', 'contents': 'BondPaidPeriod'},\n",
142+
" {'tag': 'CurrentVal',\n",
143+
" 'contents': [[0, 0.014], [12, 0.035], [24, 0.06]]}]},\n",
144+
" 'trgEffects': {'tag': 'DealStatusTo',\n",
145+
" 'contents': {'tag': 'Ended', 'contents': None}},\n",
146+
" 'trgStatus': False,\n",
147+
" 'trgCurable': False}}}"
148+
]
149+
},
150+
"execution_count": 10,
151+
"metadata": {},
152+
"output_type": "execute_result"
153+
}
154+
],
155+
"source": [
156+
"test01.json['contents']['triggers']"
157+
]
158+
},
159+
{
160+
"cell_type": "code",
161+
"execution_count": 11,
162+
"id": "83f7a2f5",
163+
"metadata": {},
164+
"outputs": [
150165
{
151-
"ename": "EngineError",
152-
"evalue": "Error in $.triggers.BeginDistributionWF.periodTest.trgEffects: key \"contents\" not found",
153-
"output_type": "error",
154-
"traceback": [
155-
"\u001b[31m---------------------------------------------------------------------------\u001b[39m",
156-
"\u001b[31mEngineError\u001b[39m Traceback (most recent call last)",
157-
"\u001b[36mCell\u001b[39m\u001b[36m \u001b[39m\u001b[32mIn[4]\u001b[39m\u001b[32m, line 1\u001b[39m\n\u001b[32m----> \u001b[39m\u001b[32m1\u001b[39m r = \u001b[43mlocalAPI\u001b[49m\u001b[43m.\u001b[49m\u001b[43mrun\u001b[49m\u001b[43m(\u001b[49m\u001b[43mtest01\u001b[49m\n\u001b[32m 2\u001b[39m \u001b[43m \u001b[49m\u001b[43m,\u001b[49m\u001b[43mpoolAssump\u001b[49m\u001b[43m \u001b[49m\u001b[43m=\u001b[49m\u001b[43m \u001b[49m\u001b[43m(\u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mPool\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m(\u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mMortgage\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m{\u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mCDR\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[32;43m0.02\u001b[39;49m\u001b[43m}\u001b[49m\u001b[43m,\u001b[49m\u001b[38;5;28;43;01mNone\u001b[39;49;00m\u001b[43m,\u001b[49m\u001b[38;5;28;43;01mNone\u001b[39;49;00m\u001b[43m,\u001b[49m\u001b[38;5;28;43;01mNone\u001b[39;49;00m\u001b[43m)\u001b[49m\n\u001b[32m 3\u001b[39m \u001b[43m \u001b[49m\u001b[43m,\u001b[49m\u001b[38;5;28;43;01mNone\u001b[39;49;00m\n\u001b[32m 4\u001b[39m \u001b[43m \u001b[49m\u001b[43m,\u001b[49m\u001b[38;5;28;43;01mNone\u001b[39;49;00m\u001b[43m)\u001b[49m\n\u001b[32m 5\u001b[39m \u001b[43m \u001b[49m\u001b[43m,\u001b[49m\u001b[43mread\u001b[49m\u001b[43m=\u001b[49m\u001b[38;5;28;43;01mTrue\u001b[39;49;00m\u001b[43m)\u001b[49m\n",
158-
"\u001b[36mFile \u001b[39m\u001b[32m~/repo/AbsBox/absbox/client.py:357\u001b[39m, in \u001b[36mAPI.run\u001b[39m\u001b[34m(self, deal, poolAssump, runAssump, read, showWarning, rtn, debug)\u001b[39m\n\u001b[32m 354\u001b[39m \u001b[38;5;28;01mif\u001b[39;00m debug:\n\u001b[32m 355\u001b[39m \u001b[38;5;28;01mreturn\u001b[39;00m req\n\u001b[32m--> \u001b[39m\u001b[32m357\u001b[39m result = \u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43m_send_req\u001b[49m\u001b[43m(\u001b[49m\u001b[43mreq\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43murl\u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 359\u001b[39m \u001b[38;5;28;01mif\u001b[39;00m result \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mor\u001b[39;00m \u001b[33m'\u001b[39m\u001b[33merror\u001b[39m\u001b[33m'\u001b[39m \u001b[38;5;129;01min\u001b[39;00m result \u001b[38;5;129;01mor\u001b[39;00m \u001b[33m'\u001b[39m\u001b[33mLeft\u001b[39m\u001b[33m'\u001b[39m \u001b[38;5;129;01min\u001b[39;00m result:\n\u001b[32m 360\u001b[39m leftVal = result.get(\u001b[33m\"\u001b[39m\u001b[33mLeft\u001b[39m\u001b[33m\"\u001b[39m,\u001b[33m\"\u001b[39m\u001b[33m\"\u001b[39m)\n",
159-
"\u001b[36mFile \u001b[39m\u001b[32m~/repo/AbsBox/absbox/client.py:825\u001b[39m, in \u001b[36mAPI._send_req\u001b[39m\u001b[34m(self, _req, _url, timeout, headers)\u001b[39m\n\u001b[32m 823\u001b[39m \u001b[38;5;28;01mraise\u001b[39;00m AbsboxError(\u001b[33m\"\u001b[39m\u001b[33m❌ Failed to get response from server\u001b[39m\u001b[33m\"\u001b[39m)\n\u001b[32m 824\u001b[39m \u001b[38;5;28;01mif\u001b[39;00m r.status_code != \u001b[32m200\u001b[39m:\n\u001b[32m--> \u001b[39m\u001b[32m825\u001b[39m \u001b[38;5;28;01mraise\u001b[39;00m EngineError(r)\n\u001b[32m 826\u001b[39m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[32m 827\u001b[39m \u001b[38;5;28;01mreturn\u001b[39;00m json.loads(r.text)\n",
160-
"\u001b[31mEngineError\u001b[39m: Error in $.triggers.BeginDistributionWF.periodTest.trgEffects: key \"contents\" not found"
161-
]
166+
"data": {
167+
"text/html": [
168+
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">Warning Message from server:Bond A1 is not paid off\n",
169+
"Bond B is not paid off\n",
170+
"Oustanding pool cashflow hasn't been collected yetfromList <span style=\"font-weight: bold\">[(</span>PoolConsol,<span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">20</span><span style=\"font-weight: bold\">)]</span>\n",
171+
"</pre>\n"
172+
],
173+
"text/plain": [
174+
"Warning Message from server:Bond A1 is not paid off\n",
175+
"Bond B is not paid off\n",
176+
"Oustanding pool cashflow hasn't been collected yetfromList \u001b[1m[\u001b[0m\u001b[1m(\u001b[0mPoolConsol,\u001b[1;36m20\u001b[0m\u001b[1m)\u001b[0m\u001b[1m]\u001b[0m\n"
177+
]
178+
},
179+
"metadata": {},
180+
"output_type": "display_data"
162181
}
163182
],
164183
"source": [
@@ -171,7 +190,7 @@
171190
},
172191
{
173192
"cell_type": "code",
174-
"execution_count": 22,
193+
"execution_count": 12,
175194
"id": "315c009c",
176195
"metadata": {},
177196
"outputs": [
@@ -209,37 +228,37 @@
209228
" <tr>\n",
210229
" <th>2021-07-26</th>\n",
211230
" <td>False</td>\n",
212-
" <td>&lt;Tag:Right 6.290909090909091e-3 GE Just 1.4e-2&gt;</td>\n",
231+
" <td>&lt;Tag:Right 6.290909090909091e-3 &gt;= Just 1.4e-2&gt;</td>\n",
213232
" </tr>\n",
214233
" <tr>\n",
215234
" <th>2021-08-20</th>\n",
216235
" <td>False</td>\n",
217-
" <td>&lt;Tag:Right 7.736363636363637e-3 GE Just 1.4e-2&gt;</td>\n",
236+
" <td>&lt;Tag:Right 7.736363636363637e-3 &gt;= Just 1.4e-2&gt;</td>\n",
218237
" </tr>\n",
219238
" <tr>\n",
220239
" <th>2021-09-20</th>\n",
221240
" <td>False</td>\n",
222-
" <td>&lt;Tag:Right 9.172727272727273e-3 GE Just 1.4e-2&gt;</td>\n",
241+
" <td>&lt;Tag:Right 9.172727272727273e-3 &gt;= Just 1.4e-2&gt;</td>\n",
223242
" </tr>\n",
224243
" <tr>\n",
225244
" <th>2021-10-20</th>\n",
226245
" <td>False</td>\n",
227-
" <td>&lt;Tag:Right 1.0554545454545455e-2 GE Just 1.4e-2&gt;</td>\n",
246+
" <td>&lt;Tag:Right 1.0554545454545455e-2 &gt;= Just 1.4e-2&gt;</td>\n",
228247
" </tr>\n",
229248
" <tr>\n",
230249
" <th>2021-11-20</th>\n",
231250
" <td>False</td>\n",
232-
" <td>&lt;Tag:Right 1.1836363636363636e-2 GE Just 1.4e-2&gt;</td>\n",
251+
" <td>&lt;Tag:Right 1.1836363636363636e-2 &gt;= Just 1.4e-2&gt;</td>\n",
233252
" </tr>\n",
234253
" <tr>\n",
235254
" <th>2021-12-20</th>\n",
236255
" <td>False</td>\n",
237-
" <td>&lt;Tag:Right 1.3109090909090909e-2 GE Just 1.4e-2&gt;</td>\n",
256+
" <td>&lt;Tag:Right 1.3109090909090909e-2 &gt;= Just 1.4e-2&gt;</td>\n",
238257
" </tr>\n",
239258
" <tr>\n",
240259
" <th>2022-01-20</th>\n",
241260
" <td>True</td>\n",
242-
" <td>&lt;Tag:Right 1.4281818181818182e-2 GE Just 1.4e-2&gt;</td>\n",
261+
" <td>&lt;Tag:Right 1.4281818181818182e-2 &gt;= Just 1.4e-2&gt;</td>\n",
243262
" </tr>\n",
244263
" </tbody>\n",
245264
"</table>\n",
@@ -248,23 +267,31 @@
248267
"text/plain": [
249268
" status memo\n",
250269
"date \n",
251-
"2021-07-26 False <Tag:Right 6.290909090909091e-3 GE Just 1.4e-2>\n",
252-
"2021-08-20 False <Tag:Right 7.736363636363637e-3 GE Just 1.4e-2>\n",
253-
"2021-09-20 False <Tag:Right 9.172727272727273e-3 GE Just 1.4e-2>\n",
254-
"2021-10-20 False <Tag:Right 1.0554545454545455e-2 GE Just 1.4e-2>\n",
255-
"2021-11-20 False <Tag:Right 1.1836363636363636e-2 GE Just 1.4e-2>\n",
256-
"2021-12-20 False <Tag:Right 1.3109090909090909e-2 GE Just 1.4e-2>\n",
257-
"2022-01-20 True <Tag:Right 1.4281818181818182e-2 GE Just 1.4e-2>"
270+
"2021-07-26 False <Tag:Right 6.290909090909091e-3 >= Just 1.4e-2>\n",
271+
"2021-08-20 False <Tag:Right 7.736363636363637e-3 >= Just 1.4e-2>\n",
272+
"2021-09-20 False <Tag:Right 9.172727272727273e-3 >= Just 1.4e-2>\n",
273+
"2021-10-20 False <Tag:Right 1.0554545454545455e-2 >= Just 1.4e-2>\n",
274+
"2021-11-20 False <Tag:Right 1.1836363636363636e-2 >= Just 1.4e-2>\n",
275+
"2021-12-20 False <Tag:Right 1.3109090909090909e-2 >= Just 1.4e-2>\n",
276+
"2022-01-20 True <Tag:Right 1.4281818181818182e-2 >= Just 1.4e-2>"
258277
]
259278
},
260-
"execution_count": 22,
279+
"execution_count": 12,
261280
"metadata": {},
262281
"output_type": "execute_result"
263282
}
264283
],
265284
"source": [
266285
"r['triggers']['BeginDistributionWF']['periodTest']"
267286
]
287+
},
288+
{
289+
"cell_type": "code",
290+
"execution_count": null,
291+
"id": "c3613ed9-381c-471e-80fd-01a2d25ac7ed",
292+
"metadata": {},
293+
"outputs": [],
294+
"source": []
268295
}
269296
],
270297
"metadata": {

0 commit comments

Comments
 (0)