wbportfolio 2.2.1__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/__init__.py +1 -0
- wbportfolio/admin/__init__.py +12 -0
- wbportfolio/admin/asset.py +47 -0
- wbportfolio/admin/custodians.py +9 -0
- wbportfolio/admin/portfolio.py +127 -0
- wbportfolio/admin/portfolio_relationships.py +22 -0
- wbportfolio/admin/product_groups.py +42 -0
- wbportfolio/admin/products.py +80 -0
- wbportfolio/admin/reconciliations.py +14 -0
- wbportfolio/admin/registers.py +17 -0
- wbportfolio/admin/roles.py +19 -0
- wbportfolio/admin/synchronization/__init__.py +2 -0
- wbportfolio/admin/synchronization/admin.py +114 -0
- wbportfolio/admin/synchronization/portfolio_synchronization.py +18 -0
- wbportfolio/admin/synchronization/price_computation.py +21 -0
- wbportfolio/admin/transactions/__init__.py +5 -0
- wbportfolio/admin/transactions/claim.py +16 -0
- wbportfolio/admin/transactions/dividends.py +14 -0
- wbportfolio/admin/transactions/fees.py +35 -0
- wbportfolio/admin/transactions/trades.py +49 -0
- wbportfolio/admin/transactions/transactions.py +37 -0
- wbportfolio/analysis/__init__.py +0 -0
- wbportfolio/analysis/claims.py +235 -0
- wbportfolio/apps.py +5 -0
- wbportfolio/contrib/__init__.py +0 -0
- wbportfolio/contrib/company_portfolio/__init__.py +0 -0
- wbportfolio/contrib/company_portfolio/admin.py +28 -0
- wbportfolio/contrib/company_portfolio/apps.py +29 -0
- wbportfolio/contrib/company_portfolio/configs/__init__.py +3 -0
- wbportfolio/contrib/company_portfolio/configs/display.py +182 -0
- wbportfolio/contrib/company_portfolio/configs/endpoints.py +34 -0
- wbportfolio/contrib/company_portfolio/configs/previews.py +37 -0
- wbportfolio/contrib/company_portfolio/constants.py +1 -0
- wbportfolio/contrib/company_portfolio/dynamic_preferences_registry.py +87 -0
- wbportfolio/contrib/company_portfolio/factories.py +32 -0
- wbportfolio/contrib/company_portfolio/filters.py +127 -0
- wbportfolio/contrib/company_portfolio/management.py +19 -0
- wbportfolio/contrib/company_portfolio/migrations/0001_initial.py +214 -0
- wbportfolio/contrib/company_portfolio/migrations/__init__.py +0 -0
- wbportfolio/contrib/company_portfolio/models.py +334 -0
- wbportfolio/contrib/company_portfolio/scripts.py +76 -0
- wbportfolio/contrib/company_portfolio/serializers.py +303 -0
- wbportfolio/contrib/company_portfolio/tasks.py +19 -0
- wbportfolio/contrib/company_portfolio/tests/__init__.py +0 -0
- wbportfolio/contrib/company_portfolio/tests/conftest.py +161 -0
- wbportfolio/contrib/company_portfolio/tests/test_models.py +161 -0
- wbportfolio/contrib/company_portfolio/urls.py +29 -0
- wbportfolio/contrib/company_portfolio/viewsets.py +195 -0
- wbportfolio/defaults/__init__.py +0 -0
- wbportfolio/defaults/fees/__init__.py +0 -0
- wbportfolio/defaults/fees/default.py +92 -0
- wbportfolio/defaults/portfolio/__init__.py +0 -0
- wbportfolio/defaults/portfolio/default_rebalancing.py +45 -0
- wbportfolio/dynamic_preferences_registry.py +58 -0
- wbportfolio/factories/__init__.py +35 -0
- wbportfolio/factories/adjustments.py +17 -0
- wbportfolio/factories/assets.py +75 -0
- wbportfolio/factories/claim.py +39 -0
- wbportfolio/factories/custodians.py +11 -0
- wbportfolio/factories/dividends.py +14 -0
- wbportfolio/factories/fees.py +15 -0
- wbportfolio/factories/indexes.py +17 -0
- wbportfolio/factories/portfolio_cash_flow.py +20 -0
- wbportfolio/factories/portfolio_cash_targets.py +15 -0
- wbportfolio/factories/portfolio_swing_pricings.py +15 -0
- wbportfolio/factories/portfolios.py +59 -0
- wbportfolio/factories/product_groups.py +28 -0
- wbportfolio/factories/products.py +56 -0
- wbportfolio/factories/pytest_utils.py +121 -0
- wbportfolio/factories/reconciliations.py +23 -0
- wbportfolio/factories/roles.py +20 -0
- wbportfolio/factories/synchronization.py +40 -0
- wbportfolio/factories/trades.py +35 -0
- wbportfolio/factories/transactions.py +21 -0
- wbportfolio/fdm/__init__.py +0 -0
- wbportfolio/fdm/tasks.py +12 -0
- wbportfolio/filters/__init__.py +32 -0
- wbportfolio/filters/assets.py +485 -0
- wbportfolio/filters/assets_and_net_new_money_progression.py +42 -0
- wbportfolio/filters/custodians.py +10 -0
- wbportfolio/filters/esg.py +22 -0
- wbportfolio/filters/performances.py +171 -0
- wbportfolio/filters/portfolios.py +24 -0
- wbportfolio/filters/positions.py +178 -0
- wbportfolio/filters/products.py +157 -0
- wbportfolio/filters/roles.py +26 -0
- wbportfolio/filters/signals.py +92 -0
- wbportfolio/filters/transactions/__init__.py +20 -0
- wbportfolio/filters/transactions/claim.py +394 -0
- wbportfolio/filters/transactions/fees.py +66 -0
- wbportfolio/filters/transactions/trades.py +224 -0
- wbportfolio/filters/transactions/transactions.py +98 -0
- wbportfolio/import_export/__init__.py +0 -0
- wbportfolio/import_export/backends/__init__.py +2 -0
- wbportfolio/import_export/backends/ubs/__init__.py +3 -0
- wbportfolio/import_export/backends/ubs/asset_position.py +45 -0
- wbportfolio/import_export/backends/ubs/fees.py +63 -0
- wbportfolio/import_export/backends/ubs/instrument_price.py +44 -0
- wbportfolio/import_export/backends/ubs/mixin.py +15 -0
- wbportfolio/import_export/backends/utils.py +58 -0
- wbportfolio/import_export/backends/wbfdm/__init__.py +2 -0
- wbportfolio/import_export/backends/wbfdm/adjustment.py +50 -0
- wbportfolio/import_export/backends/wbfdm/dividend.py +16 -0
- wbportfolio/import_export/backends/wbfdm/mixin.py +15 -0
- wbportfolio/import_export/handlers/__init__.py +0 -0
- wbportfolio/import_export/handlers/adjustment.py +39 -0
- wbportfolio/import_export/handlers/asset_position.py +167 -0
- wbportfolio/import_export/handlers/dividend.py +80 -0
- wbportfolio/import_export/handlers/fees.py +58 -0
- wbportfolio/import_export/handlers/portfolio_cash_flow.py +57 -0
- wbportfolio/import_export/handlers/register.py +43 -0
- wbportfolio/import_export/handlers/trade.py +191 -0
- wbportfolio/import_export/parsers/__init__.py +0 -0
- wbportfolio/import_export/parsers/default_mapping.py +30 -0
- wbportfolio/import_export/parsers/jpmorgan/__init__.py +0 -0
- wbportfolio/import_export/parsers/jpmorgan/customer_trade.py +63 -0
- wbportfolio/import_export/parsers/jpmorgan/fees.py +64 -0
- wbportfolio/import_export/parsers/jpmorgan/strategy.py +116 -0
- wbportfolio/import_export/parsers/jpmorgan/valuation.py +41 -0
- wbportfolio/import_export/parsers/leonteq/__init__.py +0 -0
- wbportfolio/import_export/parsers/leonteq/customer_trade.py +47 -0
- wbportfolio/import_export/parsers/leonteq/equity.py +81 -0
- wbportfolio/import_export/parsers/leonteq/fees.py +70 -0
- wbportfolio/import_export/parsers/leonteq/trade.py +94 -0
- wbportfolio/import_export/parsers/leonteq/valuation.py +39 -0
- wbportfolio/import_export/parsers/natixis/__init__.py +0 -0
- wbportfolio/import_export/parsers/natixis/customer_trade.py +62 -0
- wbportfolio/import_export/parsers/natixis/d1_customer_trade.py +66 -0
- wbportfolio/import_export/parsers/natixis/d1_equity.py +80 -0
- wbportfolio/import_export/parsers/natixis/d1_fees.py +58 -0
- wbportfolio/import_export/parsers/natixis/d1_trade.py +70 -0
- wbportfolio/import_export/parsers/natixis/d1_valuation.py +41 -0
- wbportfolio/import_export/parsers/natixis/dividend.py +53 -0
- wbportfolio/import_export/parsers/natixis/equity.py +60 -0
- wbportfolio/import_export/parsers/natixis/fees.py +53 -0
- wbportfolio/import_export/parsers/natixis/trade.py +63 -0
- wbportfolio/import_export/parsers/natixis/utils.py +76 -0
- wbportfolio/import_export/parsers/natixis/valuation.py +46 -0
- wbportfolio/import_export/parsers/refinitiv/__init__.py +0 -0
- wbportfolio/import_export/parsers/refinitiv/adjustment.py +24 -0
- wbportfolio/import_export/parsers/sg_lux/__init__.py +0 -0
- wbportfolio/import_export/parsers/sg_lux/custodian_positions.py +70 -0
- wbportfolio/import_export/parsers/sg_lux/customer_trade.py +75 -0
- wbportfolio/import_export/parsers/sg_lux/customer_trade_pending_slk.py +140 -0
- wbportfolio/import_export/parsers/sg_lux/customer_trade_slk.py +80 -0
- wbportfolio/import_export/parsers/sg_lux/customer_trade_without_pw.py +57 -0
- wbportfolio/import_export/parsers/sg_lux/equity.py +137 -0
- wbportfolio/import_export/parsers/sg_lux/fees.py +56 -0
- wbportfolio/import_export/parsers/sg_lux/perf_fees.py +51 -0
- wbportfolio/import_export/parsers/sg_lux/portfolio_cash_flow.py +29 -0
- wbportfolio/import_export/parsers/sg_lux/portfolio_future_cash_flow.py +36 -0
- wbportfolio/import_export/parsers/sg_lux/registers.py +210 -0
- wbportfolio/import_export/parsers/sg_lux/sylk.py +248 -0
- wbportfolio/import_export/parsers/sg_lux/utils.py +36 -0
- wbportfolio/import_export/parsers/sg_lux/valuation.py +53 -0
- wbportfolio/import_export/parsers/societe_generale/__init__.py +0 -0
- wbportfolio/import_export/parsers/societe_generale/customer_trade.py +54 -0
- wbportfolio/import_export/parsers/societe_generale/strategy.py +94 -0
- wbportfolio/import_export/parsers/societe_generale/valuation.py +37 -0
- wbportfolio/import_export/parsers/tellco/__init__.py +0 -0
- wbportfolio/import_export/parsers/tellco/customer_trade.py +64 -0
- wbportfolio/import_export/parsers/tellco/equity.py +86 -0
- wbportfolio/import_export/parsers/tellco/valuation.py +52 -0
- wbportfolio/import_export/parsers/ubs/__init__.py +0 -0
- wbportfolio/import_export/parsers/ubs/api/__init__.py +0 -0
- wbportfolio/import_export/parsers/ubs/api/asset_position.py +106 -0
- wbportfolio/import_export/parsers/ubs/api/fees.py +31 -0
- wbportfolio/import_export/parsers/ubs/api/instrument_price.py +20 -0
- wbportfolio/import_export/parsers/ubs/api/utils.py +0 -0
- wbportfolio/import_export/parsers/ubs/customer_trade.py +60 -0
- wbportfolio/import_export/parsers/ubs/equity.py +97 -0
- wbportfolio/import_export/parsers/ubs/historical_customer_trade.py +67 -0
- wbportfolio/import_export/parsers/ubs/valuation.py +52 -0
- wbportfolio/import_export/parsers/vontobel/__init__.py +0 -0
- wbportfolio/import_export/parsers/vontobel/asset_position.py +97 -0
- wbportfolio/import_export/parsers/vontobel/customer_trade.py +54 -0
- wbportfolio/import_export/parsers/vontobel/historical_customer_trade.py +40 -0
- wbportfolio/import_export/parsers/vontobel/instrument.py +34 -0
- wbportfolio/import_export/parsers/vontobel/management_fees.py +86 -0
- wbportfolio/import_export/parsers/vontobel/performance_fees.py +35 -0
- wbportfolio/import_export/parsers/vontobel/trade.py +38 -0
- wbportfolio/import_export/parsers/vontobel/utils.py +17 -0
- wbportfolio/import_export/parsers/vontobel/valuation.py +29 -0
- wbportfolio/import_export/resources/__init__.py +0 -0
- wbportfolio/import_export/resources/assets.py +68 -0
- wbportfolio/import_export/resources/trades.py +41 -0
- wbportfolio/import_export/utils.py +42 -0
- wbportfolio/metric/__init__.py +0 -0
- wbportfolio/metric/backends/__init__.py +2 -0
- wbportfolio/metric/backends/base.py +86 -0
- wbportfolio/metric/backends/constants.py +222 -0
- wbportfolio/metric/backends/portfolio_base.py +255 -0
- wbportfolio/metric/backends/portfolio_esg.py +66 -0
- wbportfolio/metric/tests/__init__.py +0 -0
- wbportfolio/metric/tests/conftest.py +4 -0
- wbportfolio/metric/tests/test_portfolio_base.py +135 -0
- wbportfolio/metric/tests/test_portfolio_esg.py +69 -0
- wbportfolio/migrations/0001_initial_squashed.py +13848 -0
- wbportfolio/migrations/0002_product_default_sub_account_squashed_0039_alter_assetallocation_company_and_more.py +3836 -0
- wbportfolio/migrations/0040_instrument_financial_instrument.py +26 -0
- wbportfolio/migrations/0041_remove_listresearch_research_ptr_and_more.py +129 -0
- wbportfolio/migrations/0042_instrumentlist_instrumentlistthroughmodel_and_more.py +71 -0
- wbportfolio/migrations/0043_alter_instrumentlistthroughmodel_options_and_more.py +238 -0
- wbportfolio/migrations/0044_alter_instrumentlist_identifier.py +35 -0
- wbportfolio/migrations/0045_alter_instrument_financial_instrument.py +26 -0
- wbportfolio/migrations/0046_add_product_default_account.py +166 -0
- wbportfolio/migrations/0047_remove_product_default_sub_account.py +14 -0
- wbportfolio/migrations/0048_alter_trade_status.py +29 -0
- wbportfolio/migrations/0049_trade_claimed_shares.py +25 -0
- wbportfolio/migrations/0050_fees_fee_date_fees_wbportfolio_transac_1f7a29_idx.py +44 -0
- wbportfolio/migrations/0051_delete_macroreview.py +11 -0
- wbportfolio/migrations/0052_remove_cash_instrument_ptr_and_more.py +888 -0
- wbportfolio/migrations/0053_remove_product_group.py +132 -0
- wbportfolio/migrations/0054_portfolioinstrumentpreferredclassificationthroughmodel_and_more.py +270 -0
- wbportfolio/migrations/0055_remove_product__custom_management_rebates_and_more.py +139 -0
- wbportfolio/migrations/0056_remove_companyportfoliodata_assets_under_management_currency_and_more.py +56 -0
- wbportfolio/migrations/0057_alter_portfolio_preferred_instrument_classifications_and_more.py +36 -0
- wbportfolio/migrations/0058_pmsinstrument.py +23 -0
- wbportfolio/migrations/0059_fees_unique_fees.py +51 -0
- wbportfolio/migrations/0060_alter_portfolioportfoliothroughmodel_type.py +21 -0
- wbportfolio/migrations/0061_portfolio_bank_accounts_product_bank_account_and_more.py +175 -0
- wbportfolio/migrations/0062_alter_dailyportfoliocashflow_options.py +20 -0
- wbportfolio/migrations/0063_accountreconciliation_accountreconciliationline_and_more.py +133 -0
- wbportfolio/migrations/0064_alter_portfolio_managers_portfolio_is_tracked_and_more.py +40 -0
- wbportfolio/migrations/0065_alter_portfolio_managers_claim_as_shares_and_more.py +73 -0
- wbportfolio/migrations/0066_assetposition_initial_shares_at_custodian_and_more.py +108 -0
- wbportfolio/migrations/0067_assetposition_unique_asset_position.py +77 -0
- wbportfolio/migrations/0068_trade_internal_trade_trade_marked_as_internal_and_more.py +59 -0
- wbportfolio/migrations/0069_remove_portfolio_is_invested_and_more.py +56 -0
- wbportfolio/migrations/0070_remove_assetposition_unique_asset_position_and_more.py +82 -0
- wbportfolio/migrations/0071_alter_trade_options_alter_trade_order.py +22 -0
- wbportfolio/migrations/__init__.py +0 -0
- wbportfolio/models/__init__.py +26 -0
- wbportfolio/models/adjustments.py +246 -0
- wbportfolio/models/asset.py +869 -0
- wbportfolio/models/custodians.py +101 -0
- wbportfolio/models/indexes.py +33 -0
- wbportfolio/models/mixins/__init__.py +0 -0
- wbportfolio/models/mixins/instruments.py +127 -0
- wbportfolio/models/mixins/liquidity_stress_test.py +1307 -0
- wbportfolio/models/portfolio.py +1039 -0
- wbportfolio/models/portfolio_cash_flow.py +167 -0
- wbportfolio/models/portfolio_cash_targets.py +46 -0
- wbportfolio/models/portfolio_relationship.py +135 -0
- wbportfolio/models/portfolio_swing_pricings.py +51 -0
- wbportfolio/models/product_groups.py +230 -0
- wbportfolio/models/products.py +569 -0
- wbportfolio/models/reconciliations/__init__.py +2 -0
- wbportfolio/models/reconciliations/account_reconciliation_lines.py +192 -0
- wbportfolio/models/reconciliations/account_reconciliations.py +102 -0
- wbportfolio/models/reconciliations/reconciliations.py +25 -0
- wbportfolio/models/registers.py +132 -0
- wbportfolio/models/roles.py +208 -0
- wbportfolio/models/synchronization/__init__.py +3 -0
- wbportfolio/models/synchronization/portfolio_synchronization.py +292 -0
- wbportfolio/models/synchronization/price_computation.py +200 -0
- wbportfolio/models/synchronization/synchronization.py +188 -0
- wbportfolio/models/transactions/__init__.py +7 -0
- wbportfolio/models/transactions/claim.py +634 -0
- wbportfolio/models/transactions/dividends.py +31 -0
- wbportfolio/models/transactions/expiry.py +7 -0
- wbportfolio/models/transactions/fees.py +153 -0
- wbportfolio/models/transactions/trade_proposals.py +502 -0
- wbportfolio/models/transactions/trades.py +704 -0
- wbportfolio/models/transactions/transactions.py +211 -0
- wbportfolio/models/utils.py +12 -0
- wbportfolio/permissions.py +13 -0
- wbportfolio/pms/__init__.py +0 -0
- wbportfolio/pms/statistics/__init__.py +0 -0
- wbportfolio/pms/trading/__init__.py +1 -0
- wbportfolio/pms/trading/handler.py +164 -0
- wbportfolio/pms/typing.py +194 -0
- wbportfolio/preferences.py +6 -0
- wbportfolio/reports/__init__.py +0 -0
- wbportfolio/reports/monthly_position_report.py +74 -0
- wbportfolio/risk_management/__init__.py +0 -0
- wbportfolio/risk_management/backends/__init__.py +11 -0
- wbportfolio/risk_management/backends/accounts.py +166 -0
- wbportfolio/risk_management/backends/controversy_portfolio.py +63 -0
- wbportfolio/risk_management/backends/exposure_portfolio.py +203 -0
- wbportfolio/risk_management/backends/instrument_list_portfolio.py +89 -0
- wbportfolio/risk_management/backends/liquidity_risk.py +86 -0
- wbportfolio/risk_management/backends/liquidity_stress_instrument.py +86 -0
- wbportfolio/risk_management/backends/mixins.py +220 -0
- wbportfolio/risk_management/backends/product_integrity.py +111 -0
- wbportfolio/risk_management/backends/stop_loss_instrument.py +24 -0
- wbportfolio/risk_management/backends/stop_loss_portfolio.py +36 -0
- wbportfolio/risk_management/backends/ucits_portfolio.py +63 -0
- wbportfolio/risk_management/tests/__init__.py +0 -0
- wbportfolio/risk_management/tests/conftest.py +15 -0
- wbportfolio/risk_management/tests/test_accounts.py +98 -0
- wbportfolio/risk_management/tests/test_controversy_portfolio.py +33 -0
- wbportfolio/risk_management/tests/test_exposure_portfolio.py +94 -0
- wbportfolio/risk_management/tests/test_instrument_list_portfolio.py +60 -0
- wbportfolio/risk_management/tests/test_liquidity_risk.py +47 -0
- wbportfolio/risk_management/tests/test_product_integrity.py +55 -0
- wbportfolio/risk_management/tests/test_stop_loss_instrument.py +110 -0
- wbportfolio/risk_management/tests/test_stop_loss_portfolio.py +119 -0
- wbportfolio/risk_management/tests/test_ucits_portfolio.py +39 -0
- wbportfolio/serializers/__init__.py +42 -0
- wbportfolio/serializers/adjustments.py +24 -0
- wbportfolio/serializers/assets.py +166 -0
- wbportfolio/serializers/custodians.py +26 -0
- wbportfolio/serializers/portfolio_cash_flow.py +48 -0
- wbportfolio/serializers/portfolio_cash_targets.py +20 -0
- wbportfolio/serializers/portfolio_relationship.py +53 -0
- wbportfolio/serializers/portfolio_swing_pricing.py +20 -0
- wbportfolio/serializers/portfolios.py +143 -0
- wbportfolio/serializers/positions.py +76 -0
- wbportfolio/serializers/product_group.py +88 -0
- wbportfolio/serializers/products.py +331 -0
- wbportfolio/serializers/reconciliations.py +171 -0
- wbportfolio/serializers/registers.py +72 -0
- wbportfolio/serializers/roles.py +60 -0
- wbportfolio/serializers/signals.py +157 -0
- wbportfolio/serializers/synchronization.py +18 -0
- wbportfolio/serializers/transactions/__init__.py +24 -0
- wbportfolio/serializers/transactions/claim.py +310 -0
- wbportfolio/serializers/transactions/dividends.py +18 -0
- wbportfolio/serializers/transactions/expiry.py +18 -0
- wbportfolio/serializers/transactions/fees.py +32 -0
- wbportfolio/serializers/transactions/trades.py +315 -0
- wbportfolio/serializers/transactions/transactions.py +84 -0
- wbportfolio/tasks.py +125 -0
- wbportfolio/tests/__init__.py +0 -0
- wbportfolio/tests/conftest.py +164 -0
- wbportfolio/tests/models/__init__.py +0 -0
- wbportfolio/tests/models/test_account_reconciliation.py +191 -0
- wbportfolio/tests/models/test_assets.py +193 -0
- wbportfolio/tests/models/test_custodians.py +12 -0
- wbportfolio/tests/models/test_customer_trades.py +113 -0
- wbportfolio/tests/models/test_dividends.py +7 -0
- wbportfolio/tests/models/test_imports.py +192 -0
- wbportfolio/tests/models/test_instrument_mixins.py +48 -0
- wbportfolio/tests/models/test_merge.py +133 -0
- wbportfolio/tests/models/test_portfolio_cash_flow.py +112 -0
- wbportfolio/tests/models/test_portfolio_cash_targets.py +27 -0
- wbportfolio/tests/models/test_portfolio_swing_pricings.py +42 -0
- wbportfolio/tests/models/test_portfolios.py +676 -0
- wbportfolio/tests/models/test_product_groups.py +80 -0
- wbportfolio/tests/models/test_products.py +187 -0
- wbportfolio/tests/models/test_roles.py +82 -0
- wbportfolio/tests/models/test_splits.py +233 -0
- wbportfolio/tests/models/test_synchronization.py +617 -0
- wbportfolio/tests/models/transactions/__init__.py +0 -0
- wbportfolio/tests/models/transactions/test_claim.py +129 -0
- wbportfolio/tests/models/transactions/test_fees.py +65 -0
- wbportfolio/tests/models/transactions/test_trades.py +204 -0
- wbportfolio/tests/models/utils.py +13 -0
- wbportfolio/tests/serializers/__init__.py +0 -0
- wbportfolio/tests/serializers/test_claims.py +21 -0
- wbportfolio/tests/signals.py +151 -0
- wbportfolio/tests/tests.py +31 -0
- wbportfolio/tests/viewsets/__init__.py +0 -0
- wbportfolio/tests/viewsets/test_assets.py +67 -0
- wbportfolio/tests/viewsets/test_performances.py +72 -0
- wbportfolio/tests/viewsets/test_products.py +92 -0
- wbportfolio/tests/viewsets/transactions/__init__.py +0 -0
- wbportfolio/tests/viewsets/transactions/test_claims.py +146 -0
- wbportfolio/urls.py +247 -0
- wbportfolio/utils.py +30 -0
- wbportfolio/viewsets/__init__.py +57 -0
- wbportfolio/viewsets/adjustments.py +46 -0
- wbportfolio/viewsets/assets.py +562 -0
- wbportfolio/viewsets/assets_and_net_new_money_progression.py +117 -0
- wbportfolio/viewsets/charts/__init__.py +1 -0
- wbportfolio/viewsets/charts/assets.py +247 -0
- wbportfolio/viewsets/configs/__init__.py +6 -0
- wbportfolio/viewsets/configs/buttons/__init__.py +23 -0
- wbportfolio/viewsets/configs/buttons/adjustments.py +13 -0
- wbportfolio/viewsets/configs/buttons/assets.py +145 -0
- wbportfolio/viewsets/configs/buttons/claims.py +83 -0
- wbportfolio/viewsets/configs/buttons/custodians.py +76 -0
- wbportfolio/viewsets/configs/buttons/fees.py +14 -0
- wbportfolio/viewsets/configs/buttons/mixins.py +88 -0
- wbportfolio/viewsets/configs/buttons/portfolios.py +115 -0
- wbportfolio/viewsets/configs/buttons/products.py +41 -0
- wbportfolio/viewsets/configs/buttons/reconciliations.py +65 -0
- wbportfolio/viewsets/configs/buttons/registers.py +11 -0
- wbportfolio/viewsets/configs/buttons/signals.py +68 -0
- wbportfolio/viewsets/configs/buttons/trade_proposals.py +25 -0
- wbportfolio/viewsets/configs/buttons/trades.py +144 -0
- wbportfolio/viewsets/configs/display/__init__.py +61 -0
- wbportfolio/viewsets/configs/display/adjustments.py +81 -0
- wbportfolio/viewsets/configs/display/assets.py +265 -0
- wbportfolio/viewsets/configs/display/claim.py +299 -0
- wbportfolio/viewsets/configs/display/custodians.py +24 -0
- wbportfolio/viewsets/configs/display/esg.py +88 -0
- wbportfolio/viewsets/configs/display/fees.py +133 -0
- wbportfolio/viewsets/configs/display/portfolio_cash_flow.py +103 -0
- wbportfolio/viewsets/configs/display/portfolio_relationship.py +38 -0
- wbportfolio/viewsets/configs/display/portfolios.py +125 -0
- wbportfolio/viewsets/configs/display/positions.py +75 -0
- wbportfolio/viewsets/configs/display/product_groups.py +54 -0
- wbportfolio/viewsets/configs/display/product_performance.py +241 -0
- wbportfolio/viewsets/configs/display/products.py +249 -0
- wbportfolio/viewsets/configs/display/reconciliations.py +151 -0
- wbportfolio/viewsets/configs/display/registers.py +71 -0
- wbportfolio/viewsets/configs/display/roles.py +49 -0
- wbportfolio/viewsets/configs/display/trade_proposals.py +97 -0
- wbportfolio/viewsets/configs/display/trades.py +359 -0
- wbportfolio/viewsets/configs/display/transactions.py +55 -0
- wbportfolio/viewsets/configs/endpoints/__init__.py +75 -0
- wbportfolio/viewsets/configs/endpoints/adjustments.py +17 -0
- wbportfolio/viewsets/configs/endpoints/assets.py +115 -0
- wbportfolio/viewsets/configs/endpoints/claim.py +106 -0
- wbportfolio/viewsets/configs/endpoints/custodians.py +6 -0
- wbportfolio/viewsets/configs/endpoints/esg.py +14 -0
- wbportfolio/viewsets/configs/endpoints/fees.py +26 -0
- wbportfolio/viewsets/configs/endpoints/portfolio_relationship.py +23 -0
- wbportfolio/viewsets/configs/endpoints/portfolios.py +43 -0
- wbportfolio/viewsets/configs/endpoints/positions.py +18 -0
- wbportfolio/viewsets/configs/endpoints/product_groups.py +11 -0
- wbportfolio/viewsets/configs/endpoints/product_performance.py +29 -0
- wbportfolio/viewsets/configs/endpoints/products.py +37 -0
- wbportfolio/viewsets/configs/endpoints/reconciliations.py +31 -0
- wbportfolio/viewsets/configs/endpoints/roles.py +9 -0
- wbportfolio/viewsets/configs/endpoints/trade_proposals.py +17 -0
- wbportfolio/viewsets/configs/endpoints/trades.py +82 -0
- wbportfolio/viewsets/configs/endpoints/transactions.py +17 -0
- wbportfolio/viewsets/configs/menu/__init__.py +30 -0
- wbportfolio/viewsets/configs/menu/adjustments.py +8 -0
- wbportfolio/viewsets/configs/menu/assets.py +8 -0
- wbportfolio/viewsets/configs/menu/claim.py +41 -0
- wbportfolio/viewsets/configs/menu/custodians.py +11 -0
- wbportfolio/viewsets/configs/menu/fees.py +13 -0
- wbportfolio/viewsets/configs/menu/instrument_prices.py +10 -0
- wbportfolio/viewsets/configs/menu/portfolio_cash_flow.py +8 -0
- wbportfolio/viewsets/configs/menu/portfolios.py +15 -0
- wbportfolio/viewsets/configs/menu/positions.py +14 -0
- wbportfolio/viewsets/configs/menu/product_groups.py +10 -0
- wbportfolio/viewsets/configs/menu/product_performance.py +25 -0
- wbportfolio/viewsets/configs/menu/products.py +15 -0
- wbportfolio/viewsets/configs/menu/reconciliations.py +7 -0
- wbportfolio/viewsets/configs/menu/registers.py +10 -0
- wbportfolio/viewsets/configs/menu/roles.py +16 -0
- wbportfolio/viewsets/configs/menu/trades.py +18 -0
- wbportfolio/viewsets/configs/menu/transactions.py +8 -0
- wbportfolio/viewsets/configs/previews/__init__.py +1 -0
- wbportfolio/viewsets/configs/previews/portfolios.py +21 -0
- wbportfolio/viewsets/configs/titles/__init__.py +65 -0
- wbportfolio/viewsets/configs/titles/adjustments.py +19 -0
- wbportfolio/viewsets/configs/titles/assets.py +57 -0
- wbportfolio/viewsets/configs/titles/assets_and_net_new_money_progression.py +6 -0
- wbportfolio/viewsets/configs/titles/claim.py +81 -0
- wbportfolio/viewsets/configs/titles/custodians.py +12 -0
- wbportfolio/viewsets/configs/titles/esg.py +10 -0
- wbportfolio/viewsets/configs/titles/fees.py +25 -0
- wbportfolio/viewsets/configs/titles/instrument_prices.py +20 -0
- wbportfolio/viewsets/configs/titles/portfolios.py +32 -0
- wbportfolio/viewsets/configs/titles/positions.py +11 -0
- wbportfolio/viewsets/configs/titles/product_groups.py +12 -0
- wbportfolio/viewsets/configs/titles/product_performance.py +16 -0
- wbportfolio/viewsets/configs/titles/products.py +6 -0
- wbportfolio/viewsets/configs/titles/registers.py +12 -0
- wbportfolio/viewsets/configs/titles/roles.py +23 -0
- wbportfolio/viewsets/configs/titles/trades.py +51 -0
- wbportfolio/viewsets/configs/titles/transactions.py +8 -0
- wbportfolio/viewsets/custodians.py +66 -0
- wbportfolio/viewsets/esg.py +165 -0
- wbportfolio/viewsets/mixins.py +48 -0
- wbportfolio/viewsets/portfolio_cash_flow.py +31 -0
- wbportfolio/viewsets/portfolio_cash_targets.py +8 -0
- wbportfolio/viewsets/portfolio_relationship.py +46 -0
- wbportfolio/viewsets/portfolio_swing_pricing.py +8 -0
- wbportfolio/viewsets/portfolios.py +154 -0
- wbportfolio/viewsets/positions.py +292 -0
- wbportfolio/viewsets/product_groups.py +84 -0
- wbportfolio/viewsets/product_performance.py +646 -0
- wbportfolio/viewsets/products.py +529 -0
- wbportfolio/viewsets/reconciliations.py +160 -0
- wbportfolio/viewsets/registers.py +75 -0
- wbportfolio/viewsets/roles.py +44 -0
- wbportfolio/viewsets/signals.py +42 -0
- wbportfolio/viewsets/synchronization.py +25 -0
- wbportfolio/viewsets/transactions/__init__.py +40 -0
- wbportfolio/viewsets/transactions/claim.py +933 -0
- wbportfolio/viewsets/transactions/fees.py +190 -0
- wbportfolio/viewsets/transactions/mixins.py +19 -0
- wbportfolio/viewsets/transactions/trade_proposals.py +93 -0
- wbportfolio/viewsets/transactions/trades.py +395 -0
- wbportfolio/viewsets/transactions/transactions.py +123 -0
- wbportfolio-2.2.1.dist-info/METADATA +21 -0
- wbportfolio-2.2.1.dist-info/RECORD +486 -0
- wbportfolio-2.2.1.dist-info/WHEEL +5 -0
- wbportfolio-2.2.1.dist-info/licenses/LICENSE +4 -0
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
# Generated by Django 4.2.8 on 2023-12-18 13:46
|
|
2
|
+
|
|
3
|
+
import django.db.models.deletion
|
|
4
|
+
from django.db import migrations, models
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def migrate_productgroup_to_parent(apps, schema_editor):
|
|
8
|
+
ProductGroup = apps.get_model("wbportfolio", "ProductGroup")
|
|
9
|
+
Product = apps.get_model("wbportfolio", "Product")
|
|
10
|
+
Instrument = apps.get_model("wbfdm", "Instrument")
|
|
11
|
+
for product_group in ProductGroup.objects.all():
|
|
12
|
+
for product in Product.objects.filter(group=product_group):
|
|
13
|
+
instrument = Instrument.objects.get(id=product.instrument_ptr_id)
|
|
14
|
+
instrument.parent_id = product_group.instrument_ptr_id
|
|
15
|
+
instrument.save()
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class Migration(migrations.Migration):
|
|
19
|
+
dependencies = [
|
|
20
|
+
("wbfdm", "0012_instrumentprice_created_instrumentprice_modified"),
|
|
21
|
+
("wbportfolio", "0052_remove_cash_instrument_ptr_and_more"),
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
operations = [
|
|
25
|
+
migrations.RunPython(migrate_productgroup_to_parent),
|
|
26
|
+
migrations.RemoveField(
|
|
27
|
+
model_name="product",
|
|
28
|
+
name="group",
|
|
29
|
+
),
|
|
30
|
+
migrations.AlterField(
|
|
31
|
+
model_name="adjustment",
|
|
32
|
+
name="instrument",
|
|
33
|
+
field=models.ForeignKey(
|
|
34
|
+
limit_choices_to=models.Q(("children__isnull", True)),
|
|
35
|
+
on_delete=django.db.models.deletion.CASCADE,
|
|
36
|
+
related_name="pms_adjustments",
|
|
37
|
+
to="wbfdm.instrument",
|
|
38
|
+
),
|
|
39
|
+
),
|
|
40
|
+
migrations.AlterField(
|
|
41
|
+
model_name="assetposition",
|
|
42
|
+
name="underlying_instrument",
|
|
43
|
+
field=models.ForeignKey(
|
|
44
|
+
help_text="The instrument that is this asset.",
|
|
45
|
+
limit_choices_to=models.Q(("children__isnull", True)),
|
|
46
|
+
on_delete=django.db.models.deletion.PROTECT,
|
|
47
|
+
related_name="assets",
|
|
48
|
+
to="wbfdm.instrument",
|
|
49
|
+
verbose_name="Underlying Instrument",
|
|
50
|
+
),
|
|
51
|
+
),
|
|
52
|
+
migrations.AlterField(
|
|
53
|
+
model_name="portfoliorole",
|
|
54
|
+
name="instrument",
|
|
55
|
+
field=models.ForeignKey(
|
|
56
|
+
blank=True,
|
|
57
|
+
limit_choices_to=models.Q(("children__isnull", True)),
|
|
58
|
+
null=True,
|
|
59
|
+
on_delete=django.db.models.deletion.CASCADE,
|
|
60
|
+
related_name="portfolio_roles",
|
|
61
|
+
to="wbfdm.instrument",
|
|
62
|
+
verbose_name="Instrument",
|
|
63
|
+
),
|
|
64
|
+
),
|
|
65
|
+
migrations.AlterField(
|
|
66
|
+
model_name="transaction",
|
|
67
|
+
name="underlying_instrument",
|
|
68
|
+
field=models.ForeignKey(
|
|
69
|
+
help_text="The instrument that is this transaction.",
|
|
70
|
+
limit_choices_to=models.Q(("children__isnull", True)),
|
|
71
|
+
on_delete=django.db.models.deletion.PROTECT,
|
|
72
|
+
related_name="transactions",
|
|
73
|
+
to="wbfdm.instrument",
|
|
74
|
+
verbose_name="Underlying Instrument",
|
|
75
|
+
),
|
|
76
|
+
),
|
|
77
|
+
migrations.AlterField(
|
|
78
|
+
model_name="portfolio",
|
|
79
|
+
name="prefered_instrument_classifications",
|
|
80
|
+
field=models.ManyToManyField(
|
|
81
|
+
blank=True,
|
|
82
|
+
limit_choices_to=models.Q(("instrument_type__is_classifiable", True)),
|
|
83
|
+
related_name="prefered_portfolio_classifications",
|
|
84
|
+
through="wbportfolio.PortfolioInstrumentPreferedClassificationThroughModel",
|
|
85
|
+
to="wbfdm.instrument",
|
|
86
|
+
verbose_name="The Prefered classification per instrument",
|
|
87
|
+
),
|
|
88
|
+
),
|
|
89
|
+
migrations.AlterField(
|
|
90
|
+
model_name="portfolioinstrumentpreferedclassificationthroughmodel",
|
|
91
|
+
name="instrument",
|
|
92
|
+
field=models.ForeignKey(
|
|
93
|
+
limit_choices_to=models.Q(("instrument_type__is_classifiable", True)),
|
|
94
|
+
on_delete=django.db.models.deletion.CASCADE,
|
|
95
|
+
related_name="prefered_classification_portfolio",
|
|
96
|
+
to="wbfdm.instrument",
|
|
97
|
+
),
|
|
98
|
+
),
|
|
99
|
+
migrations.AlterField(
|
|
100
|
+
model_name="instrumentportfoliothroughmodel",
|
|
101
|
+
name="instrument",
|
|
102
|
+
field=models.ForeignKey(
|
|
103
|
+
limit_choices_to=models.Q(
|
|
104
|
+
("instrument_type__key", "product"),
|
|
105
|
+
("instrument_type__key", "index"),
|
|
106
|
+
("instrument_type__key", "product_group"),
|
|
107
|
+
_connector="OR",
|
|
108
|
+
),
|
|
109
|
+
on_delete=django.db.models.deletion.CASCADE,
|
|
110
|
+
related_name="through_portfolios",
|
|
111
|
+
to="wbfdm.instrument",
|
|
112
|
+
),
|
|
113
|
+
),
|
|
114
|
+
migrations.AlterField(
|
|
115
|
+
model_name="portfolio",
|
|
116
|
+
name="instruments",
|
|
117
|
+
field=models.ManyToManyField(
|
|
118
|
+
blank=True,
|
|
119
|
+
help_text="Instruments linked to this instrument",
|
|
120
|
+
limit_choices_to=models.Q(
|
|
121
|
+
("instrument_type__key", "product"),
|
|
122
|
+
("instrument_type__key", "index"),
|
|
123
|
+
("instrument_type__key", "product_group"),
|
|
124
|
+
_connector="OR",
|
|
125
|
+
),
|
|
126
|
+
related_name="portfolios",
|
|
127
|
+
through="wbportfolio.InstrumentPortfolioThroughModel",
|
|
128
|
+
to="wbfdm.instrument",
|
|
129
|
+
verbose_name="Instruments",
|
|
130
|
+
),
|
|
131
|
+
),
|
|
132
|
+
]
|
wbportfolio/migrations/0054_portfolioinstrumentpreferredclassificationthroughmodel_and_more.py
ADDED
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
# Generated by Django 4.2.9 on 2024-02-07 15:58
|
|
2
|
+
from contextlib import suppress
|
|
3
|
+
|
|
4
|
+
import django.db.models.deletion
|
|
5
|
+
from django.db import migrations, models
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def assign_hedged_currency(apps, schema_editor):
|
|
9
|
+
Product = apps.get_model("wbportfolio", "Product")
|
|
10
|
+
InstrumentPortfolioThroughModel = apps.get_model("wbportfolio", "InstrumentPortfolioThroughModel")
|
|
11
|
+
|
|
12
|
+
for product in Product.objects.filter(index_hedged_currency__isnull=False).distinct():
|
|
13
|
+
for rel in InstrumentPortfolioThroughModel.objects.filter(instrument_id=product.instrument_ptr_id):
|
|
14
|
+
portfolio = rel.portfolio
|
|
15
|
+
portfolio.hedged_currency = product.index_hedged_currency
|
|
16
|
+
portfolio.save()
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def modify_portfolio(apps, schema_editor):
|
|
20
|
+
Portfolio = apps.get_model("wbportfolio", "Portfolio")
|
|
21
|
+
PortfolioPortfolioThroughModel = apps.get_model("wbportfolio", "PortfolioPortfolioThroughModel")
|
|
22
|
+
InstrumentPortfolioThroughModel = apps.get_model("wbportfolio", "InstrumentPortfolioThroughModel")
|
|
23
|
+
TradeProposal = apps.get_model("wbportfolio", "TradeProposal")
|
|
24
|
+
Transaction = apps.get_model("wbportfolio", "Transaction")
|
|
25
|
+
Instrument = apps.get_model("wbfdm", "Instrument")
|
|
26
|
+
Portfolio.objects.filter(portfolio_type="MODEL").update(is_manageable=True)
|
|
27
|
+
PortfolioPortfolioThroughModel.objects.filter(is_primary=True).update(type="PRIMARY")
|
|
28
|
+
PortfolioPortfolioThroughModel.objects.filter(is_theme=True).delete()
|
|
29
|
+
for instrument in Instrument.objects.filter(portfolios__isnull=False).distinct():
|
|
30
|
+
with suppress(InstrumentPortfolioThroughModel.DoesNotExist):
|
|
31
|
+
assert_portfolio = InstrumentPortfolioThroughModel.objects.get(
|
|
32
|
+
instrument=instrument, asset_portfolio=True
|
|
33
|
+
).portfolio
|
|
34
|
+
primary_portfolio_rel = InstrumentPortfolioThroughModel.objects.get(
|
|
35
|
+
instrument=instrument, primary_portfolio=True
|
|
36
|
+
)
|
|
37
|
+
if assert_portfolio != primary_portfolio_rel.portfolio:
|
|
38
|
+
try:
|
|
39
|
+
primary_relationship = PortfolioPortfolioThroughModel.objects.get(
|
|
40
|
+
portfolio=assert_portfolio, type="PRIMARY"
|
|
41
|
+
)
|
|
42
|
+
except PortfolioPortfolioThroughModel.DoesNotExist:
|
|
43
|
+
primary_relationship = PortfolioPortfolioThroughModel.objects.create(
|
|
44
|
+
portfolio=assert_portfolio,
|
|
45
|
+
dependency_portfolio=primary_portfolio_rel.portfolio,
|
|
46
|
+
type="PRIMARY",
|
|
47
|
+
)
|
|
48
|
+
if primary_portfolio_rel.portfolio != primary_relationship.dependency_portfolio:
|
|
49
|
+
if not primary_portfolio_rel.portfolio.assets.exists():
|
|
50
|
+
pass
|
|
51
|
+
else:
|
|
52
|
+
last_date = primary_portfolio_rel.portfolio.assets.latest("date").date
|
|
53
|
+
if (
|
|
54
|
+
primary_portfolio_rel.portfolio.assets.exclude(underlying_instrument__is_cash=True).filter(
|
|
55
|
+
date=last_date
|
|
56
|
+
)
|
|
57
|
+
).count() == 1:
|
|
58
|
+
primary_relationship.dependency_portfolio = primary_portfolio_rel.portfolio
|
|
59
|
+
primary_relationship.save()
|
|
60
|
+
else:
|
|
61
|
+
raise ValueError("cannot be here")
|
|
62
|
+
Transaction.objects.filter(portfolio=primary_portfolio_rel.portfolio).update(
|
|
63
|
+
portfolio=assert_portfolio
|
|
64
|
+
)
|
|
65
|
+
primary_portfolio_rel.delete()
|
|
66
|
+
if InstrumentPortfolioThroughModel.objects.filter(instrument=instrument).count() > 1:
|
|
67
|
+
InstrumentPortfolioThroughModel.objects.filter(
|
|
68
|
+
instrument=instrument, primary_portfolio=False, asset_portfolio=False
|
|
69
|
+
).delete()
|
|
70
|
+
for p in Portfolio.objects.filter(assets__isnull=True, transactions__isnull=True):
|
|
71
|
+
TradeProposal.objects.filter(model_portfolio=p).update(model_portfolio=models.F("portfolio"))
|
|
72
|
+
p.delete()
|
|
73
|
+
|
|
74
|
+
for rel in InstrumentPortfolioThroughModel.objects.filter(model_portfolio=True):
|
|
75
|
+
with suppress(InstrumentPortfolioThroughModel.DoesNotExist):
|
|
76
|
+
asset_portfolio = InstrumentPortfolioThroughModel.objects.get(
|
|
77
|
+
instrument=rel.instrument, asset_portfolio=True
|
|
78
|
+
).portfolio
|
|
79
|
+
if assert_portfolio != rel.portfolio:
|
|
80
|
+
PortfolioPortfolioThroughModel.objects.update_or_create(
|
|
81
|
+
portfolio=asset_portfolio, dependency_portfolio=rel.portfolio, defaults={"type": "MODEL"}
|
|
82
|
+
)
|
|
83
|
+
# Cleanup
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
class Migration(migrations.Migration):
|
|
87
|
+
dependencies = [
|
|
88
|
+
("wbfdm", "0012_instrumentprice_created_instrumentprice_modified"),
|
|
89
|
+
("currency", "0001_initial"),
|
|
90
|
+
("wbportfolio", "0053_remove_product_group"),
|
|
91
|
+
]
|
|
92
|
+
|
|
93
|
+
operations = [
|
|
94
|
+
migrations.RenameModel(
|
|
95
|
+
old_name="PortfolioInstrumentPreferedClassificationThroughModel",
|
|
96
|
+
new_name="PortfolioInstrumentPreferredClassificationThroughModel",
|
|
97
|
+
),
|
|
98
|
+
migrations.RenameField(
|
|
99
|
+
model_name="portfolio",
|
|
100
|
+
old_name="prefered_instrument_classifications",
|
|
101
|
+
new_name="preferred_instrument_classifications",
|
|
102
|
+
),
|
|
103
|
+
migrations.AddField(
|
|
104
|
+
model_name="portfolio",
|
|
105
|
+
name="hedged_currency",
|
|
106
|
+
field=models.ForeignKey(
|
|
107
|
+
blank=True,
|
|
108
|
+
help_text="The hedged currency of the portfolio.",
|
|
109
|
+
null=True,
|
|
110
|
+
on_delete=django.db.models.deletion.PROTECT,
|
|
111
|
+
related_name="hedged_portfolios",
|
|
112
|
+
to="currency.currency",
|
|
113
|
+
verbose_name="Hedged Currency",
|
|
114
|
+
),
|
|
115
|
+
),
|
|
116
|
+
migrations.AddField(
|
|
117
|
+
model_name="portfolio",
|
|
118
|
+
name="is_manageable",
|
|
119
|
+
field=models.BooleanField(default=False),
|
|
120
|
+
),
|
|
121
|
+
migrations.AddField(
|
|
122
|
+
model_name="portfolioportfoliothroughmodel",
|
|
123
|
+
name="type",
|
|
124
|
+
field=models.CharField(
|
|
125
|
+
choices=[("PRIMARY", "Primary"), ("MODEL", "Model"), ("BENCHMARK", "Benchmark")],
|
|
126
|
+
default="PRIMARY",
|
|
127
|
+
verbose_name="Type",
|
|
128
|
+
),
|
|
129
|
+
),
|
|
130
|
+
migrations.RunSQL(
|
|
131
|
+
sql="SET CONSTRAINTS ALL IMMEDIATE;",
|
|
132
|
+
),
|
|
133
|
+
migrations.RunPython(assign_hedged_currency),
|
|
134
|
+
migrations.RunPython(modify_portfolio),
|
|
135
|
+
migrations.RunSQL(
|
|
136
|
+
sql="SET CONSTRAINTS ALL DEFERRED;",
|
|
137
|
+
),
|
|
138
|
+
migrations.RemoveField(
|
|
139
|
+
model_name="instrumentportfoliothroughmodel",
|
|
140
|
+
name="base_instrument",
|
|
141
|
+
),
|
|
142
|
+
migrations.RemoveField(
|
|
143
|
+
model_name="instrumentportfoliothroughmodel",
|
|
144
|
+
name="model_portfolio",
|
|
145
|
+
),
|
|
146
|
+
migrations.RemoveField(
|
|
147
|
+
model_name="portfolio",
|
|
148
|
+
name="portfolio_type",
|
|
149
|
+
),
|
|
150
|
+
migrations.RemoveField(
|
|
151
|
+
model_name="portfolioportfoliothroughmodel",
|
|
152
|
+
name="is_primary",
|
|
153
|
+
),
|
|
154
|
+
migrations.RemoveField(
|
|
155
|
+
model_name="portfolioportfoliothroughmodel",
|
|
156
|
+
name="is_theme",
|
|
157
|
+
),
|
|
158
|
+
migrations.RemoveField(
|
|
159
|
+
model_name="product",
|
|
160
|
+
name="index_hedged_currency",
|
|
161
|
+
),
|
|
162
|
+
migrations.RemoveField(
|
|
163
|
+
model_name="instrumentportfoliothroughmodel",
|
|
164
|
+
name="asset_portfolio",
|
|
165
|
+
),
|
|
166
|
+
migrations.RemoveField(
|
|
167
|
+
model_name="instrumentportfoliothroughmodel",
|
|
168
|
+
name="primary_portfolio",
|
|
169
|
+
),
|
|
170
|
+
migrations.AlterField(
|
|
171
|
+
model_name="instrumentportfoliothroughmodel",
|
|
172
|
+
name="instrument",
|
|
173
|
+
field=models.ForeignKey(
|
|
174
|
+
on_delete=django.db.models.deletion.CASCADE, related_name="through_portfolios", to="wbfdm.instrument"
|
|
175
|
+
),
|
|
176
|
+
),
|
|
177
|
+
migrations.AlterField(
|
|
178
|
+
model_name="portfolio",
|
|
179
|
+
name="instruments",
|
|
180
|
+
field=models.ManyToManyField(
|
|
181
|
+
blank=True,
|
|
182
|
+
help_text="Instruments linked to this instrument",
|
|
183
|
+
related_name="portfolios",
|
|
184
|
+
through="wbportfolio.InstrumentPortfolioThroughModel",
|
|
185
|
+
to="wbfdm.instrument",
|
|
186
|
+
verbose_name="Instruments",
|
|
187
|
+
),
|
|
188
|
+
),
|
|
189
|
+
migrations.AlterField(
|
|
190
|
+
model_name="portfolio",
|
|
191
|
+
name="preferred_instrument_classifications",
|
|
192
|
+
field=models.ManyToManyField(
|
|
193
|
+
blank=True,
|
|
194
|
+
limit_choices_to=models.Q(("instrument_type__is_classifiable", True)),
|
|
195
|
+
related_name="preferred_portfolio_classifications",
|
|
196
|
+
through="wbportfolio.PortfolioInstrumentPreferredClassificationThroughModel",
|
|
197
|
+
to="wbfdm.instrument",
|
|
198
|
+
verbose_name="The Preferred classification per instrument",
|
|
199
|
+
),
|
|
200
|
+
),
|
|
201
|
+
migrations.AlterField(
|
|
202
|
+
model_name="portfolioinstrumentpreferredclassificationthroughmodel",
|
|
203
|
+
name="classification",
|
|
204
|
+
field=models.ForeignKey(
|
|
205
|
+
blank=True,
|
|
206
|
+
null=True,
|
|
207
|
+
on_delete=django.db.models.deletion.CASCADE,
|
|
208
|
+
related_name="preferred_classification_throughs",
|
|
209
|
+
to="wbfdm.classification",
|
|
210
|
+
),
|
|
211
|
+
),
|
|
212
|
+
migrations.AlterField(
|
|
213
|
+
model_name="portfolioinstrumentpreferredclassificationthroughmodel",
|
|
214
|
+
name="classification_group",
|
|
215
|
+
field=models.ForeignKey(
|
|
216
|
+
blank=True,
|
|
217
|
+
null=True,
|
|
218
|
+
on_delete=django.db.models.deletion.CASCADE,
|
|
219
|
+
related_name="preferred_classification_group_throughs",
|
|
220
|
+
to="wbfdm.classificationgroup",
|
|
221
|
+
),
|
|
222
|
+
),
|
|
223
|
+
migrations.AlterField(
|
|
224
|
+
model_name="portfolioinstrumentpreferredclassificationthroughmodel",
|
|
225
|
+
name="instrument",
|
|
226
|
+
field=models.ForeignKey(
|
|
227
|
+
limit_choices_to=models.Q(("instrument_type__is_classifiable", True)),
|
|
228
|
+
on_delete=django.db.models.deletion.CASCADE,
|
|
229
|
+
related_name="preferred_classification_portfolio",
|
|
230
|
+
to="wbfdm.instrument",
|
|
231
|
+
),
|
|
232
|
+
),
|
|
233
|
+
migrations.AlterField(
|
|
234
|
+
model_name="portfolioinstrumentpreferredclassificationthroughmodel",
|
|
235
|
+
name="portfolio",
|
|
236
|
+
field=models.ForeignKey(
|
|
237
|
+
on_delete=django.db.models.deletion.CASCADE,
|
|
238
|
+
related_name="preferred_classification_instruments",
|
|
239
|
+
to="wbportfolio.portfolio",
|
|
240
|
+
),
|
|
241
|
+
),
|
|
242
|
+
migrations.AddConstraint(
|
|
243
|
+
model_name="portfolioportfoliothroughmodel",
|
|
244
|
+
constraint=models.UniqueConstraint(
|
|
245
|
+
condition=models.Q(("type", "ACTUAL")), fields=("portfolio", "type"), name="unique_actual"
|
|
246
|
+
),
|
|
247
|
+
),
|
|
248
|
+
migrations.AddConstraint(
|
|
249
|
+
model_name="portfolioportfoliothroughmodel",
|
|
250
|
+
constraint=models.UniqueConstraint(
|
|
251
|
+
condition=models.Q(("type", "MODEL")), fields=("portfolio", "type"), name="unique_model"
|
|
252
|
+
),
|
|
253
|
+
),
|
|
254
|
+
migrations.AddConstraint(
|
|
255
|
+
model_name="portfolioportfoliothroughmodel",
|
|
256
|
+
constraint=models.UniqueConstraint(
|
|
257
|
+
condition=models.Q(("type", "BENCHMARK")), fields=("portfolio", "type"), name="unique_benchmark"
|
|
258
|
+
),
|
|
259
|
+
),
|
|
260
|
+
migrations.AddConstraint(
|
|
261
|
+
model_name="instrumentportfoliothroughmodel",
|
|
262
|
+
constraint=models.UniqueConstraint(fields=("instrument",), name="unique_instrument"),
|
|
263
|
+
),
|
|
264
|
+
migrations.AddConstraint(
|
|
265
|
+
model_name="instrumentportfoliothroughmodel",
|
|
266
|
+
constraint=models.UniqueConstraint(
|
|
267
|
+
fields=("instrument", "portfolio"), name="unique_portfolio_relationship"
|
|
268
|
+
),
|
|
269
|
+
),
|
|
270
|
+
]
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
# Generated by Django 4.2.9 on 2024-02-12 11:34
|
|
2
|
+
|
|
3
|
+
from datetime import date
|
|
4
|
+
from decimal import Decimal
|
|
5
|
+
|
|
6
|
+
import django.contrib.postgres.constraints
|
|
7
|
+
import django.contrib.postgres.fields.ranges
|
|
8
|
+
import django.db.models.deletion
|
|
9
|
+
from django.db import migrations, models
|
|
10
|
+
from psycopg.types.range import DateRange
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def create_fees(apps, schema_editor):
|
|
14
|
+
Product = apps.get_model("wbportfolio", "Product")
|
|
15
|
+
FeeProductPercentage = apps.get_model("wbportfolio", "FeeProductPercentage")
|
|
16
|
+
for product in Product.objects.all():
|
|
17
|
+
FeeProductPercentage.objects.get_or_create(
|
|
18
|
+
product=product,
|
|
19
|
+
type="BANK",
|
|
20
|
+
timespan=DateRange(date.min, date.max),
|
|
21
|
+
defaults={"percent": product.bank_fees},
|
|
22
|
+
)
|
|
23
|
+
FeeProductPercentage.objects.get_or_create(
|
|
24
|
+
product=product,
|
|
25
|
+
type="MANAGEMENT",
|
|
26
|
+
timespan=DateRange(date.min, date.max),
|
|
27
|
+
defaults={"percent": product.management_fees},
|
|
28
|
+
)
|
|
29
|
+
FeeProductPercentage.objects.get_or_create(
|
|
30
|
+
product=product,
|
|
31
|
+
type="PERFORMANCE",
|
|
32
|
+
timespan=DateRange(date.min, date.max),
|
|
33
|
+
defaults={"percent": product.performance_fees, "vat_deduction": product.performance_fees_vat},
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
class Migration(migrations.Migration):
|
|
38
|
+
dependencies = [
|
|
39
|
+
("wbportfolio", "0054_portfolioinstrumentpreferredclassificationthroughmodel_and_more"),
|
|
40
|
+
]
|
|
41
|
+
|
|
42
|
+
operations = [
|
|
43
|
+
migrations.CreateModel(
|
|
44
|
+
name="FeeProductPercentage",
|
|
45
|
+
fields=[
|
|
46
|
+
("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
|
|
47
|
+
(
|
|
48
|
+
"type",
|
|
49
|
+
models.CharField(
|
|
50
|
+
choices=[("MANAGEMENT", "Management"), ("PERFORMANCE", "Performance"), ("BANK", "Bank")],
|
|
51
|
+
default="MANAGEMENT",
|
|
52
|
+
max_length=16,
|
|
53
|
+
),
|
|
54
|
+
),
|
|
55
|
+
(
|
|
56
|
+
"vat_deduction",
|
|
57
|
+
models.DecimalField(
|
|
58
|
+
decimal_places=6,
|
|
59
|
+
default=Decimal("0"),
|
|
60
|
+
help_text="The VAT deducted from this fees percentage",
|
|
61
|
+
max_digits=6,
|
|
62
|
+
verbose_name="VAT Deduction",
|
|
63
|
+
),
|
|
64
|
+
),
|
|
65
|
+
("percent", models.DecimalField(decimal_places=6, max_digits=6)),
|
|
66
|
+
("timespan", django.contrib.postgres.fields.ranges.DateRangeField()),
|
|
67
|
+
(
|
|
68
|
+
"product",
|
|
69
|
+
models.ForeignKey(
|
|
70
|
+
on_delete=django.db.models.deletion.CASCADE,
|
|
71
|
+
related_name="fees_percentages",
|
|
72
|
+
to="wbportfolio.product",
|
|
73
|
+
),
|
|
74
|
+
),
|
|
75
|
+
],
|
|
76
|
+
options={
|
|
77
|
+
"verbose_name": "Fees Percentage",
|
|
78
|
+
"verbose_name_plural": "Fees Percentage",
|
|
79
|
+
},
|
|
80
|
+
),
|
|
81
|
+
migrations.RunPython(create_fees),
|
|
82
|
+
migrations.RemoveField(
|
|
83
|
+
model_name="product",
|
|
84
|
+
name="_custom_management_rebates",
|
|
85
|
+
),
|
|
86
|
+
migrations.RemoveField(
|
|
87
|
+
model_name="product",
|
|
88
|
+
name="_custom_management_rebates_indirect",
|
|
89
|
+
),
|
|
90
|
+
migrations.RemoveField(
|
|
91
|
+
model_name="product",
|
|
92
|
+
name="_custom_minimum_investment",
|
|
93
|
+
),
|
|
94
|
+
migrations.RemoveField(
|
|
95
|
+
model_name="product",
|
|
96
|
+
name="_custom_performance_rebates",
|
|
97
|
+
),
|
|
98
|
+
migrations.RemoveField(
|
|
99
|
+
model_name="product",
|
|
100
|
+
name="_custom_performance_rebates_indirect",
|
|
101
|
+
),
|
|
102
|
+
migrations.RemoveField(
|
|
103
|
+
model_name="product",
|
|
104
|
+
name="bank_fees",
|
|
105
|
+
),
|
|
106
|
+
migrations.RemoveField(
|
|
107
|
+
model_name="product",
|
|
108
|
+
name="management_fees",
|
|
109
|
+
),
|
|
110
|
+
migrations.RemoveField(
|
|
111
|
+
model_name="product",
|
|
112
|
+
name="performance_fees",
|
|
113
|
+
),
|
|
114
|
+
migrations.RemoveField(
|
|
115
|
+
model_name="product",
|
|
116
|
+
name="performance_fees_vat",
|
|
117
|
+
),
|
|
118
|
+
migrations.AddConstraint(
|
|
119
|
+
model_name="feeproductpercentage",
|
|
120
|
+
constraint=django.contrib.postgres.constraints.ExclusionConstraint(
|
|
121
|
+
expressions=[("timespan", "&&"), ("product", "="), ("type", "=")],
|
|
122
|
+
name="exclude_overlapping_product_fees_type",
|
|
123
|
+
),
|
|
124
|
+
),
|
|
125
|
+
migrations.RemoveConstraint(
|
|
126
|
+
model_name="portfolioportfoliothroughmodel",
|
|
127
|
+
name="unique_actual",
|
|
128
|
+
),
|
|
129
|
+
migrations.RemoveConstraint(
|
|
130
|
+
model_name="portfolioportfoliothroughmodel",
|
|
131
|
+
name="unique_benchmark",
|
|
132
|
+
),
|
|
133
|
+
migrations.AddConstraint(
|
|
134
|
+
model_name="portfolioportfoliothroughmodel",
|
|
135
|
+
constraint=models.UniqueConstraint(
|
|
136
|
+
condition=models.Q(("type", "PRIMARY")), fields=("portfolio", "type"), name="unique_primary"
|
|
137
|
+
),
|
|
138
|
+
),
|
|
139
|
+
]
|
wbportfolio/migrations/0056_remove_companyportfoliodata_assets_under_management_currency_and_more.py
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# Generated by Django 4.2.9 on 2024-02-16 08:33
|
|
2
|
+
|
|
3
|
+
from django.db import migrations
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class Migration(migrations.Migration):
|
|
7
|
+
dependencies = [
|
|
8
|
+
("wbportfolio", "0055_remove_product__custom_management_rebates_and_more"),
|
|
9
|
+
]
|
|
10
|
+
|
|
11
|
+
operations = [
|
|
12
|
+
migrations.SeparateDatabaseAndState(
|
|
13
|
+
state_operations=[
|
|
14
|
+
migrations.RemoveField(
|
|
15
|
+
model_name="companyportfoliodata",
|
|
16
|
+
name="assets_under_management_currency",
|
|
17
|
+
),
|
|
18
|
+
migrations.RemoveField(
|
|
19
|
+
model_name="companyportfoliodata",
|
|
20
|
+
name="company",
|
|
21
|
+
),
|
|
22
|
+
migrations.RemoveField(
|
|
23
|
+
model_name="companyportfoliodata",
|
|
24
|
+
name="potential_currency",
|
|
25
|
+
),
|
|
26
|
+
migrations.RemoveField(
|
|
27
|
+
model_name="geographicfocus",
|
|
28
|
+
name="company",
|
|
29
|
+
),
|
|
30
|
+
migrations.RemoveField(
|
|
31
|
+
model_name="geographicfocus",
|
|
32
|
+
name="country",
|
|
33
|
+
),
|
|
34
|
+
migrations.DeleteModel(
|
|
35
|
+
name="AssetAllocation",
|
|
36
|
+
),
|
|
37
|
+
migrations.DeleteModel(
|
|
38
|
+
name="AssetAllocationType",
|
|
39
|
+
),
|
|
40
|
+
migrations.DeleteModel(
|
|
41
|
+
name="CompanyPortfolioData",
|
|
42
|
+
),
|
|
43
|
+
migrations.DeleteModel(
|
|
44
|
+
name="GeographicFocus",
|
|
45
|
+
),
|
|
46
|
+
],
|
|
47
|
+
database_operations=[
|
|
48
|
+
migrations.AlterModelTable(name="AssetAllocation", table="company_portfolio_assetallocation"),
|
|
49
|
+
migrations.AlterModelTable(name="AssetAllocationType", table="company_portfolio_assetallocationtype"),
|
|
50
|
+
migrations.AlterModelTable(
|
|
51
|
+
name="CompanyPortfolioData", table="company_portfolio_companyportfoliodata"
|
|
52
|
+
),
|
|
53
|
+
migrations.AlterModelTable(name="GeographicFocus", table="company_portfolio_geographicfocus"),
|
|
54
|
+
],
|
|
55
|
+
)
|
|
56
|
+
]
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Generated by Django 4.2.11 on 2024-03-14 15:54
|
|
2
|
+
|
|
3
|
+
import django.db.models.deletion
|
|
4
|
+
from django.db import migrations, models
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class Migration(migrations.Migration):
|
|
8
|
+
dependencies = [
|
|
9
|
+
("wbfdm", "0013_instrument_is_investable_universe_and_more"),
|
|
10
|
+
("wbportfolio", "0056_remove_companyportfoliodata_assets_under_management_currency_and_more"),
|
|
11
|
+
]
|
|
12
|
+
|
|
13
|
+
operations = [
|
|
14
|
+
migrations.AlterField(
|
|
15
|
+
model_name="portfolio",
|
|
16
|
+
name="preferred_instrument_classifications",
|
|
17
|
+
field=models.ManyToManyField(
|
|
18
|
+
blank=True,
|
|
19
|
+
limit_choices_to=models.Q(("instrument_type__is_classifiable", True), ("level", 0)),
|
|
20
|
+
related_name="preferred_portfolio_classifications",
|
|
21
|
+
through="wbportfolio.PortfolioInstrumentPreferredClassificationThroughModel",
|
|
22
|
+
to="wbfdm.instrument",
|
|
23
|
+
verbose_name="The Preferred classification per instrument",
|
|
24
|
+
),
|
|
25
|
+
),
|
|
26
|
+
migrations.AlterField(
|
|
27
|
+
model_name="portfolioinstrumentpreferredclassificationthroughmodel",
|
|
28
|
+
name="instrument",
|
|
29
|
+
field=models.ForeignKey(
|
|
30
|
+
limit_choices_to=models.Q(("instrument_type__is_classifiable", True), ("level", 0)),
|
|
31
|
+
on_delete=django.db.models.deletion.CASCADE,
|
|
32
|
+
related_name="preferred_classification_portfolio",
|
|
33
|
+
to="wbfdm.instrument",
|
|
34
|
+
),
|
|
35
|
+
),
|
|
36
|
+
]
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Generated by Django 4.2.11 on 2024-04-05 12:06
|
|
2
|
+
|
|
3
|
+
from django.db import migrations
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class Migration(migrations.Migration):
|
|
7
|
+
dependencies = [
|
|
8
|
+
("wbfdm", "0017_instrument_instrument_security_index"),
|
|
9
|
+
("wbportfolio", "0057_alter_portfolio_preferred_instrument_classifications_and_more"),
|
|
10
|
+
]
|
|
11
|
+
|
|
12
|
+
operations = [
|
|
13
|
+
migrations.CreateModel(
|
|
14
|
+
name="PMSInstrument",
|
|
15
|
+
fields=[],
|
|
16
|
+
options={
|
|
17
|
+
"proxy": True,
|
|
18
|
+
"indexes": [],
|
|
19
|
+
"constraints": [],
|
|
20
|
+
},
|
|
21
|
+
bases=("wbfdm.instrument",),
|
|
22
|
+
),
|
|
23
|
+
]
|