Coder Social home page Coder Social logo

portfolio-app's Introduction

portfolio-app

This is an account management app that simulates requesting withdrawals from a modelled portfolio account. The back-end is built in Go and follows a Hexagonal Architecture. The front-end is built in Vue.js. The purpose of the app is to generate order sheets for an account that is setup in a modelled portfolio. The front-end UI permits a withdrawal amount to be specified, validates it and displays an order sheet with sale instructions.

Installation

There are a few dependencies:

  • Go to compile and run the app
  • Docker (with docker-compose) to run the database
  • Node (with NPM)
  • make to more easily run the app and tests etc

Instructions

There are three components to run the app, it is recommended to run these in three separate tabs/windows in a terminal:

  1. The back-end (Go binary)
  2. The database (Docker with docker-compose)
  3. The front-end (NPM run command)

To run the back-end:

make run

To run the database:

cd ./resources/docker
docker-compose up

To run the front-end for the first time:

cd ./front
npm ci

To run the front-end after installing node modules:

cd ./front
npm run serve

With everything up and running, navigate to the URL output from npm run serve (normally http://localhost:8081).

Tests

Mocks are not included in VCS, they need to be generated in order to run tests.

Generate mocks:

make mock

With mocks generated can now run tests:

make test

API

The following API resources are available:

Method Endpoint Description
GET /api/customers/{customer} Get a customer by ID
GET /api/customers/{customer}/accounts List accounts for a customer
GET /api/customers/{customer}/accounts/{account} Get an account by ID
POST /api/customers/{customer}/accounts/{account}/withdrawal-requests Create a withdrawal request
GET /api/portfolios/{portfolio} Get a portfolio by ID

A Postman collection of the resources is available in resources/postman.

App brief

  1. Users must be able to see current value of their modelled portfolio account.
  2. Users must be able to specify a withdrawal amount.
  3. Users must not be able to withdraw more than the current value of the portfolio.
  4. Users must receive an order sheet with sell instructions upon a successful withdrawal request.

Definitions and language used in the app

  • Context: manage a portfolio account
  • Language: modelled portfolio, asset, isin, portfolio, account, withdrawal, buy, invest, sell, raise, units, instruction, holding, fund, order sheet, investor, customer, value, balance
  • Entities: Customer, Account, WithdrawalRequest, OrderSheet, Instruction, Portfolio, Asset
  • Service: CustomerService, AccountService, PortfolioService, OrderSheetService
  • Events: withdrawal request created, withdrawal request accepted, withdrawal request rejected, instruction created, order created,
  • Repository: CustomerRepository, PortfolioRepository, AssetRepository, AccountRepository, OrderSheetRepository

Assumptions

The following assumptions exist:

  • There can be many modelled portfolios
  • A modelled portfolio can have many assets to make up 100% of the portfolio
  • There can be many customers
  • A customer can have many accounts
  • An account is of type modelled portfolio
  • An account has a balance
  • An account can have many withdrawal requests
  • A valid withdrawal request will generate an order sheet
  • An account can have many order sheets
  • An order sheet can have many instructions
  • Instructions can of type "BUY", "INVEST", "SELL", "RAISE"

Out of scope

  • Authentication and authorization, the context is always customer 1
  • Full CRUD API endpoints, only endpoints necessary for the brief are implemented
  • Other types of instruction, only "SELL" is included

portfolio-app's People

Contributors

da-n avatar

Watchers

 avatar  avatar

portfolio-app's Issues

Add all three services to docker-compose

Instead of requiring three tabs and separate commands, move all these out into docker-compose. One issue here will be around setting user/group ID during development.

Make DB repo an interface

The DB repo is tied to specific type of database (MySQL), this should be abstracted so that any "driver" can be used e.g. Postgres.

Add Vuex store

Add a store for the front-end application, it should be implemented to follow the data model used on the back-end.

Convert money values from int to decimal

These should not represent same issues as floats in terms of comparison etc. Note, in the financial would fractions of a cent are also utilised, so this should also be accounted for.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.