tea-bond 0.3.11__cp38-abi3-manylinux_2_28_x86_64.whl → 0.3.12__cp38-abi3-manylinux_2_28_x86_64.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/bond.py +4 -2
- pybond/download.py +0 -2
- pybond/pd.py +5 -1
- pybond/pnl.py +30 -0
- pybond/polars_utils.py +3 -1
- pybond/pybond.abi3.so +0 -0
- {tea_bond-0.3.11.dist-info → tea_bond-0.3.12.dist-info}/METADATA +1 -1
- {tea_bond-0.3.11.dist-info → tea_bond-0.3.12.dist-info}/RECORD +9 -9
- {tea_bond-0.3.11.dist-info → tea_bond-0.3.12.dist-info}/WHEEL +1 -1
pybond/bond.py
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
3
|
import os
|
|
4
|
-
from datetime import date
|
|
5
4
|
from importlib.util import find_spec
|
|
6
5
|
from pathlib import Path
|
|
6
|
+
from typing import TYPE_CHECKING
|
|
7
7
|
|
|
8
8
|
from .pybond import Bond as _BondRS
|
|
9
9
|
from .pybond import Future, download_bond
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
if TYPE_CHECKING:
|
|
12
|
+
from datetime import date
|
|
13
|
+
|
|
12
14
|
|
|
13
15
|
WIND_AVAILABLE = find_spec("WindPy") is not None
|
|
14
16
|
|
pybond/download.py
CHANGED
pybond/pd.py
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
from typing import TYPE_CHECKING
|
|
4
|
+
|
|
4
5
|
import polars as pl
|
|
5
6
|
|
|
6
7
|
from .pl import Bonds as PlBonds
|
|
7
8
|
from .pl import Futures as PlFutures
|
|
8
9
|
from .pl import TfEvaluators as PlTfEvaluators
|
|
9
10
|
|
|
11
|
+
if TYPE_CHECKING:
|
|
12
|
+
import pandas as pd
|
|
13
|
+
|
|
10
14
|
|
|
11
15
|
class TfEvaluators:
|
|
12
16
|
"""
|
pybond/pnl.py
CHANGED
|
@@ -108,3 +108,33 @@ def calc_bond_trade_pnl(
|
|
|
108
108
|
symbol="calc_bond_trade_pnl",
|
|
109
109
|
is_elementwise=False,
|
|
110
110
|
)
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
def trading_from_pos(
|
|
114
|
+
time: IntoExpr,
|
|
115
|
+
pos: IntoExpr,
|
|
116
|
+
open: IntoExpr,
|
|
117
|
+
finish_price: IntoExpr | None = None,
|
|
118
|
+
cash: float = 1e8,
|
|
119
|
+
multiplier: float = 1,
|
|
120
|
+
qty_tick: float = 1.0,
|
|
121
|
+
*,
|
|
122
|
+
stop_on_finish: bool = False,
|
|
123
|
+
) -> pl.Expr:
|
|
124
|
+
time = parse_into_expr(time)
|
|
125
|
+
pos = parse_into_expr(pos)
|
|
126
|
+
open = parse_into_expr(open)
|
|
127
|
+
finish_price = parse_into_expr(finish_price)
|
|
128
|
+
kwargs = {
|
|
129
|
+
"cash": cash,
|
|
130
|
+
"multiplier": multiplier,
|
|
131
|
+
"qty_tick": qty_tick,
|
|
132
|
+
"stop_on_finish": stop_on_finish,
|
|
133
|
+
"finish_price": None,
|
|
134
|
+
}
|
|
135
|
+
return register_plugin(
|
|
136
|
+
args=[time, pos, open, finish_price],
|
|
137
|
+
kwargs=kwargs,
|
|
138
|
+
symbol="trading_from_pos",
|
|
139
|
+
is_elementwise=False,
|
|
140
|
+
)
|
pybond/polars_utils.py
CHANGED
|
@@ -2,11 +2,13 @@ from __future__ import annotations
|
|
|
2
2
|
|
|
3
3
|
import re
|
|
4
4
|
from pathlib import Path
|
|
5
|
-
from typing import TYPE_CHECKING, Any
|
|
5
|
+
from typing import TYPE_CHECKING, Any
|
|
6
6
|
|
|
7
7
|
import polars as pl
|
|
8
8
|
|
|
9
9
|
if TYPE_CHECKING:
|
|
10
|
+
from collections.abc import Sequence
|
|
11
|
+
|
|
10
12
|
from polars.type_aliases import IntoExpr, PolarsDataType
|
|
11
13
|
|
|
12
14
|
|
pybond/pybond.abi3.so
CHANGED
|
Binary file
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
pybond.libs/libcrypto-bdaed0ea.so.1.1,sha256=139pMIscUR4G4LSsPQqa4a6gvQfgJkaBLV3uAwFZ52E,3215921
|
|
2
2
|
pybond.libs/libssl-60250281.so.1.1,sha256=lvG3sRY8xl4pqF8jYg7IcBT2ooMalVFhXE_JDs917IA,666857
|
|
3
3
|
pybond/__init__.py,sha256=PZtjd-T5E7phzVqVVTN1Y4LxY1U9LICMwjqeb3vejWA,545
|
|
4
|
-
pybond/bond.py,sha256=
|
|
5
|
-
pybond/download.py,sha256=
|
|
4
|
+
pybond/bond.py,sha256=KZIkkBnr4NeUfH-ImYj_7vngB57P3vjGQNdpdbT25vc,6580
|
|
5
|
+
pybond/download.py,sha256=tupGa38tEhwErRiQHLitRtm_HMaWH5VPeAh30FqIqDs,4149
|
|
6
6
|
pybond/ffi/__init__.py,sha256=x4FSqdM-SZPir9DL_XSMjoO9c4CWsyE5XfQr4GraGsg,94
|
|
7
7
|
pybond/ffi/bond.py,sha256=8SFjwBtf-t0uEEgdgdP2TCHkTr-pJCvVsJ7qIKsdh6c,1586
|
|
8
8
|
pybond/ffi/datetime.py,sha256=84vkmBhIf0HH4NEFeMLFbf83D_VewB5-PKeaDUobNmE,1989
|
|
@@ -17,12 +17,12 @@ pybond/nb/nb_datetime.py,sha256=9fLD9rnfpHQ-cvX4H6PoFh_O3jgk475ZKrG8q_UxT34,1026
|
|
|
17
17
|
pybond/nb/nb_duration.py,sha256=FSX1y2JbHB_SJn-hcVe-7Zf2v0xpQKKZ1MfWBY7d7IQ,1639
|
|
18
18
|
pybond/nb/nb_evaluators.py,sha256=fCYxcvW717_1E4qY9AV8R5Pv8eTvWqKk3Zj-zMU1kiw,14987
|
|
19
19
|
pybond/nb/nb_time.py,sha256=LaqXfcNvmYD_lZ2u108MwrxCXoVCBX3cr3oOnPp3c1g,8649
|
|
20
|
-
pybond/pd.py,sha256=
|
|
20
|
+
pybond/pd.py,sha256=nqOEm0yw-2pRpx-3sut3zrYptdeZYYDKKk1bw6crIt0,13359
|
|
21
21
|
pybond/pl.py,sha256=eXu_rcggdBKXLuzyLj65StIw45Jfu44EmTNi06WOBbo,13486
|
|
22
|
-
pybond/pnl.py,sha256=
|
|
23
|
-
pybond/polars_utils.py,sha256=
|
|
24
|
-
pybond/pybond.abi3.so,sha256=
|
|
22
|
+
pybond/pnl.py,sha256=upJxtjJyD00eKKJsz7CR6ONXm6UeqCE3AIODZGDE2wQ,3465
|
|
23
|
+
pybond/polars_utils.py,sha256=u14yoK9Qx4TC2oPq-zVk7d1XOLY8nGc1H8Nf9jt0R6c,2599
|
|
24
|
+
pybond/pybond.abi3.so,sha256=tCxKye6LEQSC9jRqcc6AEJdld64Sv2mgQ8ZuG9mt8yE,30544273
|
|
25
25
|
pybond/pybond.pyi,sha256=xME119HJzVNqNCJ9FapVaQg1amxbNHlbd-qfFyiuhL4,11230
|
|
26
|
-
tea_bond-0.3.
|
|
27
|
-
tea_bond-0.3.
|
|
28
|
-
tea_bond-0.3.
|
|
26
|
+
tea_bond-0.3.12.dist-info/METADATA,sha256=LZOQ6O98UhsurMn3R23Kvk5klAjsDmqmo6xabz8cnzc,258
|
|
27
|
+
tea_bond-0.3.12.dist-info/WHEEL,sha256=aOjTN5bAUkIqIK1JFnJz3vA_KyYjKKgPFflJ6PJ2YX0,106
|
|
28
|
+
tea_bond-0.3.12.dist-info/RECORD,,
|