#38 Adding A Portfolio Category
Saturday, February 22, 2020
In order for our application to be able to provide the ability for us to rebalance the holds of our various accounts we need to be able to specify the target amount for each of the categories of our securities. In order to add this ability the first thing we are going to do is introduce the concept of a portfolio by creating portfolio categories.
Parts
- Part 45: Adjusting Shares
- Part 44: Plan Percentages
- Part 43: Home Securities
- Part 42: Updating Plans
- Part 41: Plan Details View
- Part 40: Portfolio Getters
- Part 39: Portfolio Plan
- Part 38: Portfolio Category
- Part 37: Account Securities
- Part 36: Account Transfer
- Part 35: View Account Security
- Part 34: Updating Deposit
- Part 33: View Account Deposit
- Part 32: Display Account Details
- Part 31: Account Getters
- Part 30: Deposits And Securities
- Part 29: Add Accounts Details
- Part 28: Refactoring Accounts
- Part 27: Add Security Models
- Part 26: Edit Security Details
- Part 25: View Security Details
- Part 24: Navigating To Details
- Part 23: Getters Validation
- Part 22: Query Parameters
- Part 21: Tab Entries
- Part 20: Tab Header
- Part 19: List View
- Part 18: Vuex Getters
- Part 17: End Domain Model
- Part 16: Start Domain Model
- Part 15: Pop Routes
- Part 14: Push Routes
- Part 13: Removing Accounts
- Part 12: Vuex (Decorators)
- Part 11: Vuex (Accounts)
- Part 10: The App Bar (Settings)
- Part 9: Remove Consumer Rxjs
- Part 8: The App Bar (Back)
- Part 7: Structuring Our App
- Part 6: Animation Between Views
- Part 5: Navigation Fade
- Part 4: Navigation Requests
- Part 3: Fade Animations (cont.)
- Part 2: Fade Animations
- Part 1: Splash Screen
Code Snippets
Planner.vue (1:09)
<template lang="pug">
div Planner
</template>
font-awesome.ts (1:27)
...
import {
...
faChartPie,
...
} from "@fortawesome/free-solid-svg-icons";
...
library.add(faChartPie);
...
types.ts (2:02)
...
export enum Routes {
...
Planner,
...
}
...
routing-service.ts (2:18)
...
const planner = new RouteEntry({
component: () => import(/* webpackChunkName: "planner" */ "../../views/Planner.vue"),
name: "planner",
parent: home,
path: "/planner",
route: Routes.Planner,
});
...
export class RoutingService {
...
private readonly _routes = [
...
planner,
...
];
...
}
TheMainNav.vue (3:39)
<script lang="ts">
...
export default class TheMainNav extends Vue {
...
private readonly planner = Routes.Planner;
...
}
</script>
Advertisement
TheMainNav.vue (4:10)
<template lang="pug">
nav.main-nav
...
MainNavButton(
v-bind:icon="'chart-pie'"
v-bind:label="'Planner'"
v-bind:route="planner")
</template>
MainNavButton.vue (4:47)
<style lang="sass" scoped>
...
.main-nav-button
...
flex: 1
...
...
</style>
portfolio-category-model.ts (5:52)
import { SecurityCategoryModel } from "@/store/security-category-model";
export interface IPortfolioCategoryModelConfig {
categoryId: number;
id: number;
percent: number;
portfolioId: number;
}
export class PortfolioCategoryModel {
private _category: SecurityCategoryModel | null = null;
private _categoryId: number;
private _id: number;
private _percent: number;
private _portfolioId: number;
public get category() {
return this._category;
}
public get categoryId() {
return this._categoryId;
}
public set categoryId(categoryId: number) {
this._categoryId = categoryId;
}
public get id() {
return this._id;
}
public set id(id: number) {
this._id = id;
}
public get percent() {
return this._percent;
}
public set percent(last: number) {
this._percent = last;
}
public get portfolioId() {
return this._portfolioId;
}
public set portfolioId(portfolioId: number) {
this._portfolioId = portfolioId;
}
constructor(config: IPortfolioCategoryModelConfig) {
this._categoryId = config.categoryId;
this._id = config.id;
this._percent = config.percent;
this._portfolioId = config.portfolioId;
}
public setCategory(category: SecurityCategoryModel) {
this._category = category;
}
}
Exciton Interactive LLC