wbportfolio 1.53.0__py2.py3-none-any.whl → 1.54.2__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.
- wbportfolio/migrations/0079_alter_trade_drift_factor.py +19 -0
- wbportfolio/models/transactions/trades.py +6 -6
- {wbportfolio-1.53.0.dist-info → wbportfolio-1.54.2.dist-info}/METADATA +1 -1
- {wbportfolio-1.53.0.dist-info → wbportfolio-1.54.2.dist-info}/RECORD +6 -5
- {wbportfolio-1.53.0.dist-info → wbportfolio-1.54.2.dist-info}/WHEEL +0 -0
- {wbportfolio-1.53.0.dist-info → wbportfolio-1.54.2.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Generated by Django 5.0.14 on 2025-07-08 08:11
|
|
2
|
+
|
|
3
|
+
from decimal import Decimal
|
|
4
|
+
from django.db import migrations, models
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class Migration(migrations.Migration):
|
|
8
|
+
|
|
9
|
+
dependencies = [
|
|
10
|
+
('wbportfolio', '0078_trade_drift_factor'),
|
|
11
|
+
]
|
|
12
|
+
|
|
13
|
+
operations = [
|
|
14
|
+
migrations.AlterField(
|
|
15
|
+
model_name='trade',
|
|
16
|
+
name='drift_factor',
|
|
17
|
+
field=models.DecimalField(decimal_places=8, default=Decimal('1'), help_text='Drift factor to be applied to the previous portfolio weight to get the actual effective weight including daily return', max_digits=16, verbose_name='Drift Factor'),
|
|
18
|
+
),
|
|
19
|
+
]
|
|
@@ -16,7 +16,7 @@ from django.db.models import (
|
|
|
16
16
|
Sum,
|
|
17
17
|
When,
|
|
18
18
|
)
|
|
19
|
-
from django.db.models.functions import Coalesce
|
|
19
|
+
from django.db.models.functions import Coalesce, Round
|
|
20
20
|
from django.db.models.signals import post_save
|
|
21
21
|
from django.dispatch import receiver
|
|
22
22
|
from django.utils.functional import cached_property
|
|
@@ -66,8 +66,8 @@ class TradeQueryset(OrderedModelQuerySet):
|
|
|
66
66
|
),
|
|
67
67
|
Decimal(0),
|
|
68
68
|
),
|
|
69
|
-
effective_weight=F("_previous_weight") * F("drift_factor"),
|
|
70
|
-
target_weight=F("effective_weight") + F("weighting"),
|
|
69
|
+
effective_weight=Round(F("_previous_weight") * F("drift_factor"), precision=8),
|
|
70
|
+
target_weight=Round(F("effective_weight") + F("weighting"), precision=8),
|
|
71
71
|
effective_shares=Coalesce(
|
|
72
72
|
Subquery(
|
|
73
73
|
AssetPosition.objects.filter(
|
|
@@ -226,7 +226,7 @@ class Trade(TransactionMixin, ImportMixin, OrderedModel, models.Model):
|
|
|
226
226
|
)
|
|
227
227
|
drift_factor = models.DecimalField(
|
|
228
228
|
max_digits=16,
|
|
229
|
-
decimal_places=
|
|
229
|
+
decimal_places=8,
|
|
230
230
|
default=Decimal(1.0),
|
|
231
231
|
verbose_name="Drift Factor",
|
|
232
232
|
help_text="Drift factor to be applied to the previous portfolio weight to get the actual effective weight including daily return",
|
|
@@ -485,7 +485,7 @@ class Trade(TransactionMixin, ImportMixin, OrderedModel, models.Model):
|
|
|
485
485
|
date=self._last_effective_date,
|
|
486
486
|
portfolio=self.portfolio,
|
|
487
487
|
).aggregate(s=Sum("weighting"))["s"] or Decimal(0)
|
|
488
|
-
return previous_weight * self.drift_factor
|
|
488
|
+
return round(previous_weight * self.drift_factor, 8)
|
|
489
489
|
|
|
490
490
|
@property
|
|
491
491
|
@admin.display(description="Effective Shares")
|
|
@@ -504,7 +504,7 @@ class Trade(TransactionMixin, ImportMixin, OrderedModel, models.Model):
|
|
|
504
504
|
@property
|
|
505
505
|
@admin.display(description="Target Weight")
|
|
506
506
|
def _target_weight(self) -> Decimal:
|
|
507
|
-
return getattr(self, "target_weight", self._effective_weight + self.weighting)
|
|
507
|
+
return getattr(self, "target_weight", round(self._effective_weight + self.weighting, 8))
|
|
508
508
|
|
|
509
509
|
@property
|
|
510
510
|
@admin.display(description="Target Shares")
|
|
@@ -248,6 +248,7 @@ wbportfolio/migrations/0075_portfolio_initial_position_date_and_more.py,sha256=r
|
|
|
248
248
|
wbportfolio/migrations/0076_alter_dividendtransaction_price_and_more.py,sha256=4g3ok79nw8mTAxHFAqBAdpGKetaPAjv06YSywywt4aU,6106
|
|
249
249
|
wbportfolio/migrations/0077_remove_transaction_currency_and_more.py,sha256=Yf4a3zn2siDtWdIEPEIsj_W87jxOIBwiFVATneU8FxU,29597
|
|
250
250
|
wbportfolio/migrations/0078_trade_drift_factor.py,sha256=26Z3yoiBhMueB-k2R9HaIzg5Qr7BYpdtzlU-65T_cH0,999
|
|
251
|
+
wbportfolio/migrations/0079_alter_trade_drift_factor.py,sha256=2tvPecUxEy60-ELy9wtiuTR2dhJ8HucJjvOEuia4Pp4,627
|
|
251
252
|
wbportfolio/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
252
253
|
wbportfolio/models/__init__.py,sha256=HSpa5xwh_MHQaBpNrq9E0CbdEE5Iq-pDLIsPzZ-TRTg,904
|
|
253
254
|
wbportfolio/models/adjustments.py,sha256=osXWkJZOiansPWYPyHtl7Z121zDWi7u1YMtrBQtbHVo,10272
|
|
@@ -283,7 +284,7 @@ wbportfolio/models/transactions/dividends.py,sha256=mmOdGWR35yndUMoCuG24Y6BdtxDh
|
|
|
283
284
|
wbportfolio/models/transactions/fees.py,sha256=wJtlzbBCAq1UHvv0wqWTE2BEjCF5RMtoaSDS3kODFRo,7112
|
|
284
285
|
wbportfolio/models/transactions/rebalancing.py,sha256=obzgewWKOD4kJbCoF5fhtfDk502QkbrjPKh8T9KDGew,7355
|
|
285
286
|
wbportfolio/models/transactions/trade_proposals.py,sha256=ikc3QMSBBWcBwCdl67_G-OomHuC-Tb9I-KttKkbgWwc,32399
|
|
286
|
-
wbportfolio/models/transactions/trades.py,sha256=
|
|
287
|
+
wbportfolio/models/transactions/trades.py,sha256=yCySLaU0r1f1lHKPYlJ2W6uijGBV6N38WSzFTab1X6Q,33390
|
|
287
288
|
wbportfolio/models/transactions/transactions.py,sha256=XTcUeMUfkf5XTSZaR2UAyGqCVkOhQYk03_vzHLIgf8Q,3807
|
|
288
289
|
wbportfolio/pms/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
289
290
|
wbportfolio/pms/typing.py,sha256=izDCw5g6AUpqXriDDWa9KHpx7D7PSGLddBqhzXgryNQ,7875
|
|
@@ -520,7 +521,7 @@ wbportfolio/viewsets/transactions/mixins.py,sha256=WipvJoi5hylkpD0y9VATe30WAcwIH
|
|
|
520
521
|
wbportfolio/viewsets/transactions/rebalancing.py,sha256=6rIrdK0rtKL1afJ-tYfAGdQVTN2MH1kG_yCeVkmyK8k,1263
|
|
521
522
|
wbportfolio/viewsets/transactions/trade_proposals.py,sha256=zdb9yqyAE1-hcMmxxN3CYePWoPVWIW3WP3v8agErDeY,6210
|
|
522
523
|
wbportfolio/viewsets/transactions/trades.py,sha256=GHOw5jtcqoaHiRrxxxL29c9405QiPisEn4coGELKDrE,22146
|
|
523
|
-
wbportfolio-1.
|
|
524
|
-
wbportfolio-1.
|
|
525
|
-
wbportfolio-1.
|
|
526
|
-
wbportfolio-1.
|
|
524
|
+
wbportfolio-1.54.2.dist-info/METADATA,sha256=LHlogq2kuHLrwNppV-kOmZUIuxkLxWFlTZbxM8FuHao,702
|
|
525
|
+
wbportfolio-1.54.2.dist-info/WHEEL,sha256=tkmg4JIqwd9H8mL30xA7crRmoStyCtGp0VWshokd1Jc,105
|
|
526
|
+
wbportfolio-1.54.2.dist-info/licenses/LICENSE,sha256=jvfVH0SY8_YMHlsJHKe_OajiscQDz4lpTlqT6x24sVw,172
|
|
527
|
+
wbportfolio-1.54.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|