wbportfolio 1.50.13__py2.py3-none-any.whl → 1.50.15__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,5 +1,6 @@
1
1
  from contextlib import suppress
2
2
  from datetime import date, timedelta
3
+ from decimal import Decimal
3
4
  from typing import Generator
4
5
 
5
6
  import pandas as pd
@@ -182,7 +183,7 @@ class StopLossMixin(backend.AbstractRuleBackend):
182
183
  )
183
184
  weighting = self.product.portfolio.assets.filter(
184
185
  underlying_quote=instrument, date=previous_portfolio_date
185
- ).aggregate(s=Sum("weighting"))["s"]
186
+ ).aggregate(s=Sum("weighting"))["s"] or Decimal("0.0")
186
187
  report_details["Portfolio Impact"] = f"{float(weighting) * total_perf:+,.2%}"
187
188
  report_details["Field"] = field_label
188
189
  if self.benchmark:
@@ -159,10 +159,13 @@ class TestImportMixinModel:
159
159
  underlying_instrument=instrument, date=val_date, portfolio=product_portfolio.portfolio
160
160
  )
161
161
  assert a
162
- # and as this is an import handle by the assetposition handler, we expect the underlying instrument price to be created from the position initial price
163
- assert InstrumentPrice.objects.get(
164
- instrument=instrument, date=val_date, calculated=False, net_value=a.initial_price
165
- )
162
+ if instrument.is_cash:
163
+ assert InstrumentPrice.objects.get(instrument=instrument, date=val_date, calculated=False, net_value=1)
164
+ else:
165
+ # and as this is an import handle by the assetposition handler, we expect the underlying instrument price to be created from the position initial price
166
+ assert InstrumentPrice.objects.get(
167
+ instrument=instrument, date=val_date, calculated=False, net_value=a.initial_price
168
+ )
166
169
 
167
170
  # Import already existing data
168
171
  data["data"][0]["initial_price"] *= 2
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: wbportfolio
3
- Version: 1.50.13
3
+ Version: 1.50.15
4
4
  Author-email: Christopher Wittlinger <c.wittlinger@stainly.com>
5
5
  License-File: LICENSE
6
6
  Requires-Dist: cryptography==3.4.*
@@ -305,7 +305,7 @@ wbportfolio/risk_management/backends/exposure_portfolio.py,sha256=8T97J0pbnGdme_
305
305
  wbportfolio/risk_management/backends/instrument_list_portfolio.py,sha256=Sh8PZHHKFAl4Aw8fOlu17fUSiEFYYemb-B0iltAXc10,4186
306
306
  wbportfolio/risk_management/backends/liquidity_risk.py,sha256=OnuUypmN86RDnch1JOb8UJo5j1z1_X7sjazqAo7cbwM,3694
307
307
  wbportfolio/risk_management/backends/liquidity_stress_instrument.py,sha256=oitzsaZu-HhYn9Avku3322GtDmf6QGsfyRzGPGZoM1Y,3612
308
- wbportfolio/risk_management/backends/mixins.py,sha256=C7D8MXInl3m05GiLxQP4K5uomq4mpvi81zqsCiXq6g0,10006
308
+ wbportfolio/risk_management/backends/mixins.py,sha256=g0hkQRjn3-S6vMIai6t2_tf6uWoG_D3WdamQwDTlMu0,10052
309
309
  wbportfolio/risk_management/backends/product_integrity.py,sha256=3BbQBYYzLdj2iuQb9QOIgPjWMz1FaPkvEJoNgxWVfz0,4598
310
310
  wbportfolio/risk_management/backends/stop_loss_instrument.py,sha256=qIzeV26TRdbgG8-Nsh5O0NPMrPmIXeaRdPR-EF_uaLo,1128
311
311
  wbportfolio/risk_management/backends/stop_loss_portfolio.py,sha256=yiDa3FkZKdrmHSf8p1XmT8RhJW6KyiMuypYpY39SiO8,1674
@@ -369,7 +369,7 @@ wbportfolio/tests/models/test_assets.py,sha256=rb9PrPuodVEnN2LcoOqNWfsb064Ar0NF4
369
369
  wbportfolio/tests/models/test_custodians.py,sha256=WnFA4R-deVL7DSKufGE0mcFUdU05otNfGvmG4psiIh4,340
370
370
  wbportfolio/tests/models/test_customer_trades.py,sha256=50By281j-nJ43jwRWK_KxNQGv6SuimT9e_ejgu6b19o,4942
371
371
  wbportfolio/tests/models/test_dividends.py,sha256=SVkIW3OqN4-9tq1HIvJm8_8rOyNTHbJKFiN075DeGGc,162
372
- wbportfolio/tests/models/test_imports.py,sha256=bjzUsc6jzqtqrj8c_Pz7cBeIFhDR4z_BWfySdflq8Yg,7810
372
+ wbportfolio/tests/models/test_imports.py,sha256=B-bgiPljOvyLb8iaUGGkA8IN2JLT5GaMDwXO-yyUB1I,7999
373
373
  wbportfolio/tests/models/test_instrument_mixins.py,sha256=avX7a7Ovdzm_2v8JpSmrzqPo52qmIEa33c074D5KFCU,2206
374
374
  wbportfolio/tests/models/test_merge.py,sha256=sdsjiZsmR6vsUKwTa5kkvL6QTeAZqtd_EPWPI11FKGY,6497
375
375
  wbportfolio/tests/models/test_portfolio_cash_flow.py,sha256=X8dsXexsb1b0lBiuGzu40ps_Az_1UmmKT0eo1vbXH94,5792
@@ -522,7 +522,7 @@ wbportfolio/viewsets/transactions/rebalancing.py,sha256=6rIrdK0rtKL1afJ-tYfAGdQV
522
522
  wbportfolio/viewsets/transactions/trade_proposals.py,sha256=iQpC_Thbj56SmM05vPRsF1JZguGBDaTUH3I-_iCHCV0,5958
523
523
  wbportfolio/viewsets/transactions/trades.py,sha256=-yJ4j8NJTu2VWyhCq5BXGNND_925Ietoxx9k07SLVh0,21634
524
524
  wbportfolio/viewsets/transactions/transactions.py,sha256=ixDp-nsNA8t_A06rBCT19hOMJHy0iRmdz1XKdV1OwAs,4450
525
- wbportfolio-1.50.13.dist-info/METADATA,sha256=oZpg0l3b4-g-FGv8pIHG5APdtWAPXPpv8VFOJYK8KVg,703
526
- wbportfolio-1.50.13.dist-info/WHEEL,sha256=tkmg4JIqwd9H8mL30xA7crRmoStyCtGp0VWshokd1Jc,105
527
- wbportfolio-1.50.13.dist-info/licenses/LICENSE,sha256=jvfVH0SY8_YMHlsJHKe_OajiscQDz4lpTlqT6x24sVw,172
528
- wbportfolio-1.50.13.dist-info/RECORD,,
525
+ wbportfolio-1.50.15.dist-info/METADATA,sha256=XhkbGoCb8d0GC6Qht9v_KL2Ytc7R89GjA1VgLldo8io,703
526
+ wbportfolio-1.50.15.dist-info/WHEEL,sha256=tkmg4JIqwd9H8mL30xA7crRmoStyCtGp0VWshokd1Jc,105
527
+ wbportfolio-1.50.15.dist-info/licenses/LICENSE,sha256=jvfVH0SY8_YMHlsJHKe_OajiscQDz4lpTlqT6x24sVw,172
528
+ wbportfolio-1.50.15.dist-info/RECORD,,