wbportfolio 1.46.4__py2.py3-none-any.whl → 1.46.5__py2.py3-none-any.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 wbportfolio might be problematic. Click here for more details.

@@ -1,8 +1,21 @@
1
+ import numpy as np
1
2
  import pandas as pd
2
3
  from skfolio import Portfolio as BasePortfolio
3
4
 
4
5
 
5
6
  class Portfolio(BasePortfolio):
7
+ @property
8
+ def all_weights_per_observation(self) -> pd.DataFrame:
9
+ """DataFrame of the Portfolio weights containing even near zero weight per observation."""
10
+ weights = self.weights
11
+ assets = self.assets
12
+ df = pd.DataFrame(
13
+ np.ones((len(self.observations), len(assets))) * weights,
14
+ index=self.observations,
15
+ columns=assets,
16
+ )
17
+ return df
18
+
6
19
  def get_next_weights(self, returns: pd.Series) -> dict[int, float]:
7
20
  """
8
21
  Given the next returns, compute the next weights of this portfolio
@@ -13,7 +26,7 @@ class Portfolio(BasePortfolio):
13
26
  Returns:
14
27
  A dictionary of weights (instrument ids as keys and weights as values)
15
28
  """
16
- weights = self.weights_per_observation.iloc[-1, :].T
29
+ weights = self.all_weights_per_observation.iloc[-1, :].T
17
30
  if weights.sum() != 0:
18
31
  weights /= weights.sum()
19
32
  contribution = weights * (returns + 1.0)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: wbportfolio
3
- Version: 1.46.4
3
+ Version: 1.46.5
4
4
  Author-email: Christopher Wittlinger <c.wittlinger@stainly.com>
5
5
  License-File: LICENSE
6
6
  Requires-Dist: cryptography==3.4.*
@@ -279,7 +279,7 @@ wbportfolio/models/transactions/transactions.py,sha256=4THsE4xqdigZAwWKYfTNRLPJl
279
279
  wbportfolio/pms/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
280
280
  wbportfolio/pms/typing.py,sha256=lRWh9alcstZzwA04hFSPZfOFbCjaVPWtUpWnurnsh8c,6014
281
281
  wbportfolio/pms/analytics/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
282
- wbportfolio/pms/analytics/portfolio.py,sha256=9vB_nJHNro1E0RP3IQH3Mv76zU2vGeLIl4AGbE2NpTU,1089
282
+ wbportfolio/pms/analytics/portfolio.py,sha256=93hcHEuBOPi534El2HVCIyjs9MBQMX7dIZ97JIpNV1c,1535
283
283
  wbportfolio/pms/statistics/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
284
284
  wbportfolio/pms/trading/__init__.py,sha256=R_yLKc54sCak8A1cW0O1Aszrcv5KV8mC_3h17Hr20e4,36
285
285
  wbportfolio/pms/trading/handler.py,sha256=Xpgo719S0jE1wUTTyGFpYccPEIg9GXghWEAdYawJbrk,7165
@@ -517,7 +517,7 @@ wbportfolio/viewsets/transactions/rebalancing.py,sha256=6rIrdK0rtKL1afJ-tYfAGdQV
517
517
  wbportfolio/viewsets/transactions/trade_proposals.py,sha256=fYTvvRk7k5xsBzbIgJvU4I4OrllF0VkhlrekD4GVgDk,4296
518
518
  wbportfolio/viewsets/transactions/trades.py,sha256=wdtEWN1V5wsmesR3mRxPmTJUIAmDmqaNsfIhOB57kqY,16330
519
519
  wbportfolio/viewsets/transactions/transactions.py,sha256=ixDp-nsNA8t_A06rBCT19hOMJHy0iRmdz1XKdV1OwAs,4450
520
- wbportfolio-1.46.4.dist-info/METADATA,sha256=LBAxC3QZKE6WC_N1GU_qjaePjDQK7cKDct9pQqUaBKw,734
521
- wbportfolio-1.46.4.dist-info/WHEEL,sha256=tkmg4JIqwd9H8mL30xA7crRmoStyCtGp0VWshokd1Jc,105
522
- wbportfolio-1.46.4.dist-info/licenses/LICENSE,sha256=jvfVH0SY8_YMHlsJHKe_OajiscQDz4lpTlqT6x24sVw,172
523
- wbportfolio-1.46.4.dist-info/RECORD,,
520
+ wbportfolio-1.46.5.dist-info/METADATA,sha256=uhGKIh1jRNfdf699MnvWNcKT4X5XUDkk8e3NWtmf91o,734
521
+ wbportfolio-1.46.5.dist-info/WHEEL,sha256=tkmg4JIqwd9H8mL30xA7crRmoStyCtGp0VWshokd1Jc,105
522
+ wbportfolio-1.46.5.dist-info/licenses/LICENSE,sha256=jvfVH0SY8_YMHlsJHKe_OajiscQDz4lpTlqT6x24sVw,172
523
+ wbportfolio-1.46.5.dist-info/RECORD,,