Following the inspiration of the darwinex youtube playlist Institutional-Grade Risk Management Techniques for Traders this api will allow you to manage the risk of your trading system based on incremental value at risk based on variance-covariance method (it take into account the volatility and the correlation between assets).
Once you have define a portfolio with a time-frame horizon, you will be able to add new trades opportunity that will be accepted or rejected regarding the increase risk level.
The project is built using Typescript and use nestjs framework.
demo_api_var.mp4
To calculate the value at risk you need to get the last n candles of all the assets that are currently in the portfolio.
Below supported dataProvider.
Data Source | Status |
---|---|
Binance Futures | ✅ |
Binance Spot | ✅ |
1/ Create a folder for the project
2/ Download the init script that will create the database
wget https://raw.githubusercontent.com/gaugau3000/portfolio-inc-var-api/master/scripts/init-user-db.sh
2/ Download docker-compose file
wget https://raw.githubusercontent.com/gaugau3000/portfolio-inc-var-api/master/docker-compose.yml
3/ Run the docker compose file
docker-compose -up
4/ Open your favorite browser and go to, it will expose api using the swagger documentation
http://localhost:3000/api
5/ Now time to play !
# development
$ npm run start
# watch mode
$ npm run start:dev
# production mode
$ npm run start:prod
# unit tests
$ npm run test
# e2e tests
$ npm run test:e2e
# test coverage
$ npm run test:cov
Please find swagger doc here
Please go to project page
This tool is MIT licensed.