- To run the service with Docker after cloning this repository, you have to first build the Docker image with this command:
docker build baraka-test --tag baraka-test-image
You can change baraka-test-image
with other names if you want.
- Then to run the service, use this command:
docker run -p 3000:3000 baraka-test-image
Change baraka-test-image
with the name you used in the first step.
- The service will then be available at:
http://localhost:3000
Get Portfolio by Stock Symbol
- Method: GET
- Endpoint:
/portfolio/stocks
-
Query Parameters:
- symbol โ stock symbol, e.g. TSLA, AMZN
Example:
/portfolio/stocks?symbol=TSLA
Get Portfolio by Bucket Name
- Method: GET
- Endpoint:
/portfolio/buckets
-
Query Parameters:
- name โ bucket name, e.g. bucketA, bucketB
Example:
/portfolio/buckets?name=bucketA
- The list of valid stock symbols are predetermined, please use one of these symbols below:
- PBR
- AAPL
- NVDA
- NIO
- AMD
- F
- TSLA
- AMZN
- AMC
- CCL
You can choose to modify this list by going to /configs/constants.js
and changing the value of VALID_PRODUCT_SYMBOLS
.
- The list of available buckets and their content are also predetermined, please use one of these buckets below:
- Bucket A, containing these stocks:
- PBR
- AAPL
- NVDA
- NIO
- AMD
- Bucket B, containing these stocks:
- F
- TSLA
- AMZN
- AMC
- CCL
You can choose to modify this list by going to /configs/buckets.js
and changing the content of the buckets
array.
- The list of trades happening with the various stocks are also predetermined. It's available at
trades.json
and you can modify the file content to change the calculation result given by the APIs.