def setUp(self):
        self.support_group = GroupFactory(name=GROUP_SUPPORT_STAFF)
        self.personal_account_type = AccountType.objects.create(
            id=ACCOUNT_TYPE_PERSONAL)
        self.r401k_account_type = AccountType.objects.create(
            id=ACCOUNT_TYPE_ROTH401K)
        self.bonds_type = InvestmentType.Standard.BONDS.get()
        self.stocks_type = InvestmentType.Standard.STOCKS.get()
        self.bonds_asset_class = AssetClassFactory.create(
            investment_type=self.bonds_type)
        self.stocks_asset_class = AssetClassFactory.create(
            investment_type=self.stocks_type)
        self.portfolio_set = PortfolioSetFactory.create()
        self.portfolio_set.asset_classes.add(self.bonds_asset_class,
                                             self.stocks_asset_class)

        self.risk_score_metric = {
            "type": GoalMetric.METRIC_TYPE_RISK_SCORE,
            "comparison": GoalMetric.METRIC_COMPARISON_EXACTLY,
            "configured_val": 0.4,
            "rebalance_type": GoalMetric.REBALANCE_TYPE_RELATIVE,
            "rebalance_thr": 0.1
        }
        self.bonds_index = MarketIndexFactory.create()
        self.stocks_index = MarketIndexFactory.create()
        self.bonds_ticker = TickerFactory.create(
            asset_class=self.bonds_asset_class, benchmark=self.bonds_index)
        self.stocks_ticker = TickerFactory.create(
            asset_class=self.stocks_asset_class, benchmark=self.stocks_index)
Exemple #2
0
    def setUp(self):
        self.support_group = GroupFactory(name=GROUP_SUPPORT_STAFF)
        self.plan = RetirementPlanFactory.create()
        self.plan2 = RetirementPlanFactory.create(client=self.plan.client)
        self.plan3 = RetirementPlanFactory.create()
        # self.advice_url = reverse('api:v1:client-retirement-advice', args=[self.plan.client.id, self.plan.id])
        self.plan_url = '/api/v1/clients/{}/retirement-plans/{}'.format(
            self.plan.client.id, self.plan.id)
        self.advice_url = '/api/v1/clients/{}/retirement-plans/{}/advice-feed'.format(
            self.plan.client.id, self.plan.id)
        self.advice_url2 = '/api/v1/clients/{}/retirement-plans/{}/advice-feed'.format(
            self.plan2.client.id, self.plan2.id)
        self.client_url = '/api/v1/clients/{}'.format(self.plan.client.id)
        self.invite = EmailInviteFactory.create(
            user=self.plan.client.user, status=EmailInvite.STATUS_ACCEPTED)

        self.bonds_type = InvestmentType.Standard.BONDS.get()
        self.stocks_type = InvestmentType.Standard.STOCKS.get()
        self.bonds_asset_class = AssetClassFactory.create(
            investment_type=self.bonds_type)
        self.stocks_asset_class = AssetClassFactory.create(
            investment_type=self.stocks_type)
        self.portfolio_set = PortfolioSetFactory.create()
        self.portfolio_set.asset_classes.add(self.bonds_asset_class,
                                             self.stocks_asset_class)
Exemple #3
0
 def setUp(self):
     self.message_count = 10
     self.from_user = UserFactory.create()
     self.to_user = UserFactory.create()
     self.to_group = GroupFactory.create(name="to2_g")
     self.to_group.user_set.add(self.to_user)
     for i in range(self.message_count):
         notify.send(self.from_user, recipient=self.to_user, verb='commented', action_object=self.from_user)
     # Send notification to group
     notify.send(self.from_user, recipient=self.to_group, verb='commented', action_object=self.from_user)
     self.message_count += 1
Exemple #4
0
    def setUp(self):
        super(FirmAnalyticsMixinTests, self).setUp()
        self.support_group = GroupFactory(name=GROUP_SUPPORT_STAFF)
        self.bonds_type = InvestmentType.Standard.BONDS.get()
        self.stocks_type = InvestmentType.Standard.STOCKS.get()

        self.view = self.DummyView()
        self.today = today = timezone.now().date()
        # Populate the AccountType -> RiskProfileGroup mapping
        for atid, _ in constants.ACCOUNT_TYPES:
            AccountTypeRiskProfileGroupFactory.create(account_type=atid)
        # first client
        self.betasmartz_client = ClientFactory.create()
        self.client_account = ClientAccountFactory.create(
            primary_owner=self.betasmartz_client,
            account_type=constants.ACCOUNT_TYPE_PERSONAL)
        self.firm = self.betasmartz_client.advisor.firm

        self.external_asset1 = ExternalAssetFactory.create(
            owner=self.betasmartz_client)
        self.external_asset2 = ExternalAssetFactory.create(
            owner=self.betasmartz_client)
        self.goal = GoalFactory.create(account=self.client_account)
        self.goal2 = GoalFactory.create(account=self.client_account)
        self.transaction = TransactionFactory.create(
            to_goal=self.goal,
            from_goal=self.goal2,
            amount=self.goal.cash_balance,
            status=Transaction.STATUS_EXECUTED,
            reason=Transaction.REASON_TRANSFER,
            executed=self.today)

        # second client
        self.betasmartz_client2 = ClientFactory.create(
            advisor=self.betasmartz_client.advisor)
        self.client_account2 = ClientAccountFactory.create(
            primary_owner=self.betasmartz_client2,
            account_type=constants.ACCOUNT_TYPE_PERSONAL)
        self.external_asset1 = ExternalAssetFactory.create(
            owner=self.betasmartz_client2)
        self.external_asset2 = ExternalAssetFactory.create(
            owner=self.betasmartz_client2)

        self.goal3 = GoalFactory.create(account=self.client_account2)
        self.goal4 = GoalFactory.create(account=self.client_account2)
        self.transaction2 = TransactionFactory.create(
            to_goal=self.goal3,
            from_goal=self.goal4,
            amount=self.goal3.cash_balance,
            status=Transaction.STATUS_EXECUTED,
            reason=Transaction.REASON_TRANSFER,
            executed=self.today)
    def setUp(self):
        self.support_group = GroupFactory(name=GROUP_SUPPORT_STAFF)
        self.account = ClientAccountFactory.create()

        self.advisor = self.account.primary_owner.advisor
        self.firm = self.advisor.firm
        self.advisor2 = AdvisorFactory.create(firm=self.firm)
        self.betasmartz_client2 = ClientFactory.create(advisor=self.advisor2)
        self.account2 = ClientAccountFactory.create(
            primary_owner=self.betasmartz_client2)
        self.account_group = AccountGroupFactory.create(advisor=self.advisor)
        self.account_group2 = AccountGroupFactory.create(advisor=self.advisor2)
        self.account.account_group = self.account_group
        self.account.save()
        self.account2.account_group = self.account_group2
        self.account2.save()
        self.rep = AuthorisedRepresentativeFactory.create(firm=self.firm)
Exemple #6
0
    def setUp(self):
        self.support_group = GroupFactory(name=GROUP_SUPPORT_STAFF)
        # client with some personal assets, cash balance and goals
        self.region = RegionFactory.create()
        self.betasmartz_client_address = AddressFactory(region=self.region)
        self.risk_group = RiskProfileGroupFactory.create(name='Personal Risk Profile Group')
        self.personal_account_type = AccountTypeRiskProfileGroupFactory.create(account_type=0,
                                                                               risk_profile_group=self.risk_group)
        self.user = UserFactory.create()
        self.betasmartz_client = ClientFactory.create(user=self.user)

        self.betasmartz_client_account = ClientAccountFactory(primary_owner=self.betasmartz_client, account_type=ACCOUNT_TYPE_PERSONAL)
        self.external_asset1 = ExternalAssetFactory.create(owner=self.betasmartz_client)
        self.external_asset2 = ExternalAssetFactory.create(owner=self.betasmartz_client)

        self.goal1 = GoalFactory.create(account=self.betasmartz_client_account)
        self.goal2 = GoalFactory.create(account=self.betasmartz_client_account)

        self.betasmartz_client2 = ClientFactory.create()
 def setUp(self):
     self.support_group = GroupFactory(name=GROUP_SUPPORT_STAFF)
     # Populate the AccountType -> RiskProfileGroup mapping
     for atid, _ in constants.ACCOUNT_TYPES:
         AccountTypeRiskProfileGroupFactory.create(account_type=atid)