wbportfolio 1.44.1__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.
- wbportfolio/filters/transactions/claim.py +18 -1
- wbportfolio/filters/transactions/mixins.py +12 -0
- wbportfolio/filters/transactions/trades.py +17 -29
- {wbportfolio-1.44.1.dist-info → wbportfolio-1.44.2.dist-info}/METADATA +1 -1
- {wbportfolio-1.44.1.dist-info → wbportfolio-1.44.2.dist-info}/RECORD +7 -6
- {wbportfolio-1.44.1.dist-info → wbportfolio-1.44.2.dist-info}/WHEEL +0 -0
- {wbportfolio-1.44.1.dist-info → wbportfolio-1.44.2.dist-info}/licenses/LICENSE +0 -0
|
@@ -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 = {
|
|
@@ -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=
|
|
94
|
+
wbportfolio/filters/transactions/claim.py,sha256=wLQUokT5x0cUXqJF8j21zNCd2eAA9qE4e2ZGzUuHO18,16331
|
|
95
95
|
wbportfolio/filters/transactions/fees.py,sha256=9iqJuF31pf8C18OyNseSIgBZPDyWxgpBWu6S7nEJaoo,2133
|
|
96
|
-
wbportfolio/filters/transactions/
|
|
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
|
|
@@ -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.
|
|
504
|
-
wbportfolio-1.44.
|
|
505
|
-
wbportfolio-1.44.
|
|
506
|
-
wbportfolio-1.44.
|
|
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,,
|
|
File without changes
|
|
File without changes
|