wbportfolio 1.44.0__py2.py3-none-any.whl → 1.44.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.

@@ -7,6 +7,7 @@ from wbcore.utils.date import current_financial_quarter
7
7
  from wbcrm.models.accounts import Account, AccountRole
8
8
  from wbfdm.models import Classification, ClassificationGroup
9
9
  from wbfdm.preferences import get_default_classification_group
10
+ from wbportfolio.filters.transactions.mixins import OppositeSharesFieldMethodMixin
10
11
  from wbportfolio.models import Product, ProductGroup
11
12
  from wbportfolio.models.transactions.claim import Claim, ClaimGroupbyChoice
12
13
  from wbportfolio.preferences import get_monthly_nnm_target
@@ -140,7 +141,23 @@ class CommissionBaseFilterSet(wb_filters.FilterSet):
140
141
  return queryset
141
142
 
142
143
 
143
- class ClaimFilter(CommissionBaseFilterSet):
144
+ class ClaimFilter(OppositeSharesFieldMethodMixin, CommissionBaseFilterSet):
145
+ # we have to redefine the mixin fields because django_filters does not allow class extension with mixin
146
+ opposite_shares = wb_filters.NumberFilter(
147
+ field_name="shares",
148
+ label="Opposite Shares",
149
+ method="filter_opposite_shares",
150
+ lookup_icon="±",
151
+ lookup_label="Opposite",
152
+ )
153
+ opposite_approximate_shares = wb_filters.NumberFilter(
154
+ field_name="shares",
155
+ label="Opposite Approximite Shares",
156
+ method="filter_opposite_approximate_shares",
157
+ lookup_icon="≈±",
158
+ lookup_label="Opposite Approximate (+- 10%)",
159
+ )
160
+
144
161
  pending_approval = wb_filters.BooleanFilter(label="Pending Approval", method="boolean_pending_approval")
145
162
  linked_trade = wb_filters.BooleanFilter(method="filter_trade_isnotnull", label="Trade Linked")
146
163
  in_charge_of_customer = wb_filters.ModelChoiceFilter(
@@ -0,0 +1,12 @@
1
+ class OppositeSharesFieldMethodMixin:
2
+ def filter_opposite_shares(self, queryset, name, value):
3
+ return queryset.filter(shares=value * -1)
4
+
5
+ def filter_opposite_approximate_shares(self, queryset, name, value):
6
+ value = float(value)
7
+ value_lower_bound = -0.9 * value
8
+ value_higher_bound = -1.1 * value
9
+
10
+ if value > 0:
11
+ return queryset.filter(shares__lte=value_lower_bound, shares__gte=value_higher_bound)
12
+ return queryset.filter(shares__lte=value_higher_bound, shares__gte=value_lower_bound)
@@ -6,11 +6,27 @@ from wbcrm.models.accounts import Account
6
6
  from wbfdm.models import Instrument
7
7
  from wbportfolio.models import Product, Trade
8
8
  from wbportfolio.models.transactions.claim import Claim
9
+ from .mixins import OppositeSharesFieldMethodMixin
9
10
 
10
11
  from .transactions import TransactionFilterSet
11
12
 
12
13
 
13
- class TradeFilter(TransactionFilterSet):
14
+ class TradeFilter(OppositeSharesFieldMethodMixin, TransactionFilterSet):
15
+ # we have to redefine the mixin fields because django_filters does not allow class extension with mixin
16
+ opposite_shares = wb_filters.NumberFilter(
17
+ field_name="shares",
18
+ label="Opposite Shares",
19
+ method="filter_opposite_shares",
20
+ lookup_icon="±",
21
+ lookup_label="Opposite",
22
+ )
23
+ opposite_approximate_shares = wb_filters.NumberFilter(
24
+ field_name="shares",
25
+ label="Opposite Approximite Shares",
26
+ method="filter_opposite_approximate_shares",
27
+ lookup_icon="≈±",
28
+ lookup_label="Opposite Approximate (+- 10%)",
29
+ )
14
30
  transaction_date = wb_filters.DateRangeFilter(
15
31
  method=wb_filters.DateRangeFilter.base_date_range_filter_method,
16
32
  label="Date Range",
@@ -159,34 +175,6 @@ class SubscriptionRedemptionFilterSet(TradeFilter):
159
175
  label_key=Product.get_representation_label_key(),
160
176
  )
161
177
 
162
- opposite_shares = wb_filters.NumberFilter(
163
- field_name="shares",
164
- label="Opposite Shares",
165
- method="filter_opposite_shares",
166
- lookup_icon="±",
167
- lookup_label="Opposite",
168
- )
169
-
170
- def filter_opposite_shares(self, queryset, name, value):
171
- return queryset.filter(shares=value * -1)
172
-
173
- opposite_approximate_shares = wb_filters.NumberFilter(
174
- field_name="shares",
175
- label="Opposite Approximite Shares",
176
- method="filter_opposite_approximate_shares",
177
- lookup_icon="≈±",
178
- lookup_label="Opposite Approximate (+- 10%)",
179
- )
180
-
181
- def filter_opposite_approximate_shares(self, queryset, name, value):
182
- value = float(value)
183
- value_lower_bound = -0.9 * value
184
- value_higher_bound = -1.1 * value
185
-
186
- if value > 0:
187
- return queryset.filter(shares__lte=value_lower_bound, shares__gte=value_higher_bound)
188
- return queryset.filter(shares__lte=value_higher_bound, shares__gte=value_lower_bound)
189
-
190
178
  class Meta:
191
179
  model = Trade
192
180
  fields = {
@@ -154,7 +154,7 @@ class AssetPositionImportHandler(ImportExportHandler):
154
154
  if (custodian_rel := portfolio.dependency_through.get(type="CUSTODIAN")) and portfolio.assets.latest(
155
155
  "date"
156
156
  ).date >= latest_date:
157
- custodian_portfolio = custodian_rel.first().dependency_portfolio
157
+ custodian_portfolio = custodian_rel.dependency_portfolio
158
158
  differences = portfolio.check_related_portfolio_at_date(latest_date, custodian_portfolio)
159
159
  if differences.exists():
160
160
  for user in User.objects.filter(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: wbportfolio
3
- Version: 1.44.0
3
+ Version: 1.44.2
4
4
  Author-email: Christopher Wittlinger <c.wittlinger@stainly.com>
5
5
  License-File: LICENSE
6
6
  Requires-Dist: cryptography==3.4.*
@@ -91,9 +91,10 @@ wbportfolio/filters/products.py,sha256=Zo-k7maW4R5OrqJDB-hVTfOIyFoK1KZ8gU0nsDbfw
91
91
  wbportfolio/filters/roles.py,sha256=-yDD_18nFL7aGGiIlO2R0SrFDV8eXD_9vnT_u9-6q-g,919
92
92
  wbportfolio/filters/signals.py,sha256=by7XgXoQYnaW-4Rr1NvQDUUPusrJ0Qj5QnrXBdOhHQM,3888
93
93
  wbportfolio/filters/transactions/__init__.py,sha256=gGXXvQypleQOdKrH1-donElIAWtgCltm0_IqFr9pa7c,630
94
- wbportfolio/filters/transactions/claim.py,sha256=hzknQP6vuXkOSLvrgatoO7_DoqQpJGWw6FfMQsbqYsM,15617
94
+ wbportfolio/filters/transactions/claim.py,sha256=wLQUokT5x0cUXqJF8j21zNCd2eAA9qE4e2ZGzUuHO18,16331
95
95
  wbportfolio/filters/transactions/fees.py,sha256=9iqJuF31pf8C18OyNseSIgBZPDyWxgpBWu6S7nEJaoo,2133
96
- wbportfolio/filters/transactions/trades.py,sha256=bYnHGBCmL5NO5XTeAcDNbWPSACHT8diPC4x0IbKDLC8,9665
96
+ wbportfolio/filters/transactions/mixins.py,sha256=TEV3MUsiQTeu4NdFYHMIIMonmC7CdFF80JTpWYIvfRQ,550
97
+ wbportfolio/filters/transactions/trades.py,sha256=wXWBKe-yv2ihpOlccRvQoyMQ6Oi_JSiIvGV6mtdqpfA,9341
97
98
  wbportfolio/filters/transactions/transactions.py,sha256=zkaEkYRXAMtF6U0iyOAdB44mFmRhaoE6czOVSgtlWVM,3537
98
99
  wbportfolio/fixtures/product_factsheets.yaml,sha256=z5o-viDbgwWkssDJXZYayasFgw1nJ0uiOiYrJNDkRtg,5455
99
100
  wbportfolio/fixtures/wbportfolio.yaml.gz,sha256=902nxQZM6VcVcc0wI9AYaSedcJIfsK5letLF31j1Jdg,1479453
@@ -114,7 +115,7 @@ wbportfolio/import_export/backends/wbfdm/dividend.py,sha256=iAQXnYPXmtG_Jrc8THAJ
114
115
  wbportfolio/import_export/backends/wbfdm/mixin.py,sha256=JNtjgqGLson1nu_Chqb8MWyuiF3Ws8ox2vapxIRBYKE,400
115
116
  wbportfolio/import_export/handlers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
116
117
  wbportfolio/import_export/handlers/adjustment.py,sha256=6bdTIYFmc8_HFxcdwtnYwglMyCfAD8XrTIrEb2zWY0g,1757
117
- wbportfolio/import_export/handlers/asset_position.py,sha256=jDbUevWbjBGWsSr4GHCPHmgKnWuTazdU2DRx0-ac_lY,8700
118
+ wbportfolio/import_export/handlers/asset_position.py,sha256=fj9ywxvfQfyQi7RZC5NmeKb4hb18atx0P8QHmnrc0Ks,8692
118
119
  wbportfolio/import_export/handlers/dividend.py,sha256=tftdVdAzNpKSSvouOtvJfzWL362HUPIC94F6Noha8CE,3998
119
120
  wbportfolio/import_export/handlers/fees.py,sha256=lZvxPBDHa3cmmQ4KJwBSPWfUXKdj1X8CDfNTpGQwJcI,2823
120
121
  wbportfolio/import_export/handlers/portfolio_cash_flow.py,sha256=WsDAJoBvZ_Lw4X88jYA7JbM3h7nxP-K1qT6z0AIEyy4,2732
@@ -500,7 +501,7 @@ wbportfolio/viewsets/transactions/mixins.py,sha256=i9ICaUXZfryIrbgS-bdCcoBJO-pTn
500
501
  wbportfolio/viewsets/transactions/trade_proposals.py,sha256=5mgAk60cINZHd2HfTu7StFOc882FGakNcIVZpNSwBCs,3528
501
502
  wbportfolio/viewsets/transactions/trades.py,sha256=_rZuPRDjf3MbwZ5xvdCgczCxcIbvI-RvyAf-50Y_Ga4,14744
502
503
  wbportfolio/viewsets/transactions/transactions.py,sha256=VgSBUs1g5etsXjt7zi4wQi82XwOGuHsd_zppnsbMZMs,4517
503
- wbportfolio-1.44.0.dist-info/METADATA,sha256=wmK0SB9tbdqt5CA01rIZKo0BpBSSgflpjyag3NAxjTQ,645
504
- wbportfolio-1.44.0.dist-info/WHEEL,sha256=tkmg4JIqwd9H8mL30xA7crRmoStyCtGp0VWshokd1Jc,105
505
- wbportfolio-1.44.0.dist-info/licenses/LICENSE,sha256=jvfVH0SY8_YMHlsJHKe_OajiscQDz4lpTlqT6x24sVw,172
506
- wbportfolio-1.44.0.dist-info/RECORD,,
504
+ wbportfolio-1.44.2.dist-info/METADATA,sha256=gCo3d7CxhVgXlaFxVZc4q440peMJml7yZrFhhgMNr4U,645
505
+ wbportfolio-1.44.2.dist-info/WHEEL,sha256=tkmg4JIqwd9H8mL30xA7crRmoStyCtGp0VWshokd1Jc,105
506
+ wbportfolio-1.44.2.dist-info/licenses/LICENSE,sha256=jvfVH0SY8_YMHlsJHKe_OajiscQDz4lpTlqT6x24sVw,172
507
+ wbportfolio-1.44.2.dist-info/RECORD,,