Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/siddheshk02/portfolio-management


https://github.com/siddheshk02/portfolio-management

Last synced: about 1 month ago
JSON representation

Awesome Lists containing this project

README

        

# Portfolio Management Service

## Description
A simplified portfolio management service to manage user portfolios, track asset values, and provide basic analytics.

## Setup and Run
1. Clone the repository:
```sh
git clone https://github.com/yourusername/portfolio-management.git
cd portfolio-management
```

3. Add and Update `.env` with your database credentials.
```
User:
Password:
```

5. Run the application:
```sh
go run cmd/main.go
```

## API Endpoints

### User Management
- `POST /register`: Register a new user.
- `POST /login`: Login a user.

### Portfolio Management
- `POST /portfolios`: Create a new portfolio.
- `GET /portfolios/{id}`: Get a portfolio by ID.
- `PUT /portfolios/{id}`: Update a portfolio by ID.
- `DELETE /portfolios/{id}`: Delete a portfolio by ID.

- `GET /portfolios/{id}/totalvalue`: Get Total Value of your Portfolio Assets
- `GET /portfolios/{id}/averagereturn`: Get Average Return on your Portfolio Assets

### Asset Management
- `POST /portfolios/{id}/assets`: Add an asset to a portfolio.
- `GET /portfolios/{id}/assets/{asset_id}`: Get an asset by ID.
- `PUT /portfolios/{id}/assets/{asset_id}`: Update an asset by ID.
- `DELETE /portfolios/{id}/assets/{asset_id}`: Delete an asset by ID.

## Example

- `POST /register` or `POST /login` : ```{ "username": "Example", "password": 12345678 }```

- `POST /portfolios` : ```{ "userid": 2, "name": "MyPortfolio" }```

- `POST /portfolios/{id}/assets` : ```{ "portfolioid": 2, "name": "Mutual-Fund", "value": 1600 }```