tea-bond 0.3.12__cp38-abi3-win_amd64.whl → 0.3.14__cp38-abi3-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of tea-bond might be problematic. Click here for more details.
pybond/pd.py
CHANGED
|
@@ -291,6 +291,12 @@ class TfEvaluators:
|
|
|
291
291
|
"last_trading_date"
|
|
292
292
|
].to_pandas()
|
|
293
293
|
|
|
294
|
+
@property
|
|
295
|
+
def remain_year(self):
|
|
296
|
+
return self.pl_df.select(remain_year=self._evaluators.remain_year)[
|
|
297
|
+
"remain_year"
|
|
298
|
+
].to_pandas()
|
|
299
|
+
|
|
294
300
|
|
|
295
301
|
class Bonds:
|
|
296
302
|
"""
|
|
@@ -387,6 +393,12 @@ class Bonds:
|
|
|
387
393
|
"remain_cp_num"
|
|
388
394
|
].to_pandas()
|
|
389
395
|
|
|
396
|
+
def remain_year(self, date: str | pd.Series):
|
|
397
|
+
df = pl.DataFrame({"bond": self.bond, "date": date})
|
|
398
|
+
return df.select(remain_year=PlBonds("bond").remain_year("date"))[
|
|
399
|
+
"remain_year"
|
|
400
|
+
].to_pandas()
|
|
401
|
+
|
|
390
402
|
|
|
391
403
|
class Futures:
|
|
392
404
|
def __init__(self, future: str | pd.Series):
|
pybond/pl.py
CHANGED
|
@@ -269,6 +269,27 @@ class TfEvaluators:
|
|
|
269
269
|
"""
|
|
270
270
|
return self._call_plugin("evaluators_last_trading_date")
|
|
271
271
|
|
|
272
|
+
@property
|
|
273
|
+
def remain_year(self):
|
|
274
|
+
"""
|
|
275
|
+
Calculate bond remaining year (债券剩余期限).
|
|
276
|
+
|
|
277
|
+
Args:
|
|
278
|
+
date: Evaluation date column expression
|
|
279
|
+
|
|
280
|
+
Returns:
|
|
281
|
+
Polars expression for bond remaining year
|
|
282
|
+
"""
|
|
283
|
+
return self._call_plugin("bonds_remain_year")
|
|
284
|
+
|
|
285
|
+
@property
|
|
286
|
+
def carry_date(self):
|
|
287
|
+
return self._call_plugin("bonds_carry_date")
|
|
288
|
+
|
|
289
|
+
@property
|
|
290
|
+
def maturity_date(self):
|
|
291
|
+
return self._call_plugin("bonds_maturity_date")
|
|
292
|
+
|
|
272
293
|
|
|
273
294
|
class Bonds:
|
|
274
295
|
"""
|
|
@@ -310,6 +331,18 @@ class Bonds:
|
|
|
310
331
|
reinvest_rate=None,
|
|
311
332
|
)
|
|
312
333
|
|
|
334
|
+
def remain_year(self, date: IntoExpr = "date"):
|
|
335
|
+
"""
|
|
336
|
+
Calculate remain year for the bond (剩余期限).
|
|
337
|
+
"""
|
|
338
|
+
return self._evaluator(date=date).remain_year
|
|
339
|
+
|
|
340
|
+
def carry_date(self):
|
|
341
|
+
return self._evaluator().carry_date
|
|
342
|
+
|
|
343
|
+
def maturity_date(self):
|
|
344
|
+
return self._evaluator().maturity_date
|
|
345
|
+
|
|
313
346
|
def accrued_interest(self, date: IntoExpr = "date"):
|
|
314
347
|
"""
|
|
315
348
|
Calculate accrued interest for the bond (应计利息).
|
pybond/pnl.py
CHANGED
|
@@ -115,7 +115,7 @@ def trading_from_pos(
|
|
|
115
115
|
pos: IntoExpr,
|
|
116
116
|
open: IntoExpr,
|
|
117
117
|
finish_price: IntoExpr | None = None,
|
|
118
|
-
cash:
|
|
118
|
+
cash: IntoExpr = 1e8,
|
|
119
119
|
multiplier: float = 1,
|
|
120
120
|
qty_tick: float = 1.0,
|
|
121
121
|
*,
|
|
@@ -125,15 +125,16 @@ def trading_from_pos(
|
|
|
125
125
|
pos = parse_into_expr(pos)
|
|
126
126
|
open = parse_into_expr(open)
|
|
127
127
|
finish_price = parse_into_expr(finish_price)
|
|
128
|
+
cash = parse_into_expr(cash)
|
|
128
129
|
kwargs = {
|
|
129
|
-
"cash":
|
|
130
|
-
"multiplier": multiplier,
|
|
131
|
-
"qty_tick": qty_tick,
|
|
130
|
+
"cash": None,
|
|
131
|
+
"multiplier": float(multiplier),
|
|
132
|
+
"qty_tick": float(qty_tick),
|
|
132
133
|
"stop_on_finish": stop_on_finish,
|
|
133
134
|
"finish_price": None,
|
|
134
135
|
}
|
|
135
136
|
return register_plugin(
|
|
136
|
-
args=[time, pos, open, finish_price],
|
|
137
|
+
args=[time, pos, open, finish_price, cash],
|
|
137
138
|
kwargs=kwargs,
|
|
138
139
|
symbol="trading_from_pos",
|
|
139
140
|
is_elementwise=False,
|
pybond/pybond.pyd
CHANGED
|
Binary file
|
|
@@ -15,12 +15,12 @@ pybond/nb/nb_datetime.py,sha256=sg3Vmg2n2P_A186QgOGSOKBq-Tr72ht_Yw064yYrWXE,1067
|
|
|
15
15
|
pybond/nb/nb_duration.py,sha256=bndVSHdG_yV0_vEWeAHd9Lq_UQ-8nkPnEC9cN2A2ca4,1709
|
|
16
16
|
pybond/nb/nb_evaluators.py,sha256=GBsW3UuGf8iVUWr2DTISXzdYoGV5ITEOVFJivBNmWkc,15544
|
|
17
17
|
pybond/nb/nb_time.py,sha256=5KNrWYcPwZUHoxvZKvh3qdhjB0DjRkxbUzONSv6OfhY,8928
|
|
18
|
-
pybond/pd.py,sha256=
|
|
19
|
-
pybond/pl.py,sha256=
|
|
20
|
-
pybond/pnl.py,sha256=
|
|
18
|
+
pybond/pd.py,sha256=ghqoO9-wB0f3yjpYf5BMbz0Mu8Z1BVTbngcf1G4_Y9Y,14234
|
|
19
|
+
pybond/pl.py,sha256=lGNnf85fJpad0wOjxehyJCBUWbzbRAdhrY5iW6Tg-zc,14850
|
|
20
|
+
pybond/pnl.py,sha256=gIrKG-okNwDiMdfCy8Kz8wE7jgnVAGYCstFvxIncCwk,3662
|
|
21
21
|
pybond/polars_utils.py,sha256=XJ7DXpBfMEm3DilAun7E8S_6ShqQxi--ZSFV8CyRCxA,2697
|
|
22
|
-
pybond/pybond.pyd,sha256=
|
|
22
|
+
pybond/pybond.pyd,sha256=zvNhqF6sjTBxXHQCP0-Eg29xFzPkZBKwzOrSeUbRVio,23701504
|
|
23
23
|
pybond/pybond.pyi,sha256=qzOfqoysuUW7rnZYxEmGEJXK_UrCjMvQ29Y_mJOBN1Y,11621
|
|
24
|
-
tea_bond-0.3.
|
|
25
|
-
tea_bond-0.3.
|
|
26
|
-
tea_bond-0.3.
|
|
24
|
+
tea_bond-0.3.14.dist-info/METADATA,sha256=pyYrjVnz2Oweg6SfVp5iaXUbHUGl6L4EHe2DM5Oy3OY,258
|
|
25
|
+
tea_bond-0.3.14.dist-info/WHEEL,sha256=CG8OzNtm0LMpJ2zhrjswlO8N-965OeMLklsQAG-nMvQ,94
|
|
26
|
+
tea_bond-0.3.14.dist-info/RECORD,,
|
|
File without changes
|