An application to value equities, fx, commodities, cash, bonds (corps / gov), and cryptocurrencies in your personal portfolio.
- Value assets based on current market prices
- Fetch market data based on free data sources (Yahoo finance, Google finance, dividends.sg, ilovessb.com) with local cache
- Output portfolio blotter data in a CSV file for easy access and manipulation
- Import / Export portfolio blotter data from CSV file for easy migration to other portfolio systems
- Store portfolio, reference, dividends and coupon data in leveldb for persistence
- Display detailed information for individual and aggregated assets
- OpenAPI compliant for easy integration with other systems
- Install Go version 1.23.4 or higher.
- Clone the repository to your local machine.
- Run
make
to build and install the application - Run the
portfolio-manager
binary to start the application. Pass in config flag-config custom-config.yaml
Start the application
make run
Build the application
make
Wipe the entire database
make clean-db
Tests
make test # unit tests
make test-integration # integration tests
portfolio-manager/
├── cmd/
│ └── portfolio/
│ └── main.go
├── docs/
│ └── swagger.json
├── internal/
│ ├── blotter/
│ ├── config/
│ ├── dal/
│ ├── dividends/
│ ├── mocks/
│ ├── portfolio/
│ └── server/
├── pkg/
│ ├── common/
│ ├── event/
│ ├── logging/
│ ├── mdata/
│ │ └── sources/
│ ├── rdata/
│ └── types/
├── web/
├── .gitignore
├── go.mod
└── README.md
All API calls are documented (OAS) under http://localhost:8080/swagger/index.html
curl -X POST http://localhost:8080/api/v1/blotter/trade \
-H "Content-Type: application/json" \
-d '{
"ticker": "AAPL",
"side": "buy",
"broker": "dbs",
"trader": "traderA",
"quantity": 10,
"price": 150.00,
"type": "buy",
"tradeDate": "2024-12-09T00:00:00Z"
}'
curl -X POST http://localhost:8080/api/v1/blotter/import \
-F "file=@templates/blotter_import.csv"
curl -X GET http://localhost:8080/api/v1/blotter/export
curl -X GET http://localhost:8080/api/v1/portfolio/positions
curl -X GET http://localhost:8080/api/v1/mdata/price/es3.si
curl -X GET http://localhost:8080/api/v1/mdata/price/eth-usd
curl -X GET http://localhost:8080/api/v1/mdata/price/usd-sgd
# equity - refer to ticker reference for identifier
curl -X GET http://localhost:8080/api/v1/mdata/dividend/es3.si
curl -X GET http://localhost:8080/api/v1/mdata/dividend/aapl
# ssb - format SBMMMYY
curl -X GET http://localhost:8080/api/v1/mdata/dividend/sbjul24
# mas bill
curl -X GET http://localhost:8080/api/v1/mdata/dividend/bs24124z
curl -X GET http://localhost:8080/api/v1/refdata
curl -X POST http://localhost:8080/api/v1/dividends -H "Content-Type: application/json" -d '{"ticker": "ES3.SI"}'
Sample configurations
verboseLogging: true
logFilePath: ./portfolio-manager.log
host: localhost
port: 8080
db: leveldb
dbPath: ./portfolio-manager.db
refDataSeedPath: "./seed/refdata.yaml"
divWitholdingTaxSG: 0
divWitholdingTaxUS: 0.3
divWitholdingTaxHK: 0
divWitholdingTaxIE: 0.15
- Support non SGD dividends (Implemented)
- Support MAS TBills (Implemented)
- Support Crypto market data (Implemented)
- Support FX market data (Implemented)
- Support exporting/importing of leveldb for backup
- Add UI and convert to a monorepo
- Refactor configuration to have sections
Contributions are always welcome! If you have any suggestions or find a bug, please open an issue or submit a pull request.
This project is licensed under the MIT License - see the license file for details.