Grodt is a Vapor based personal finance REST API. It uses the Alphavantage API to get quotes and currency exchange rates.
Prerequsite:
Steps:
- Clone the repository.
- Add your Alphavantage API key to a file named
.alphavantagekeyin the root of the repository. This path is added to.gitignore. - Start the database locally by running
docker compose up -d. - Open the cloned repository in Xcode.
- Build and run.
- Please check the REST API section for details for interacting with Grodt.
You need to authenticate to the REST API to access the endpoints using a bearer token.
POST /login
Header: Authorization: Basic <credentials>, where <credentials> is the Base64 encoding of ID and password joined by a single colon :.
Please check the .env.development file for the default credentials.
{
"value": "<TOKEN>"
}You need to add the Authorization: Bearer <token>, where <token> is the string value you need to obtain with the /login endpoint above.
All endpoints are accessiable via the /api base path.
To get a list of the portfolios.
- Request:
GET/portfolios - Response: Array of PortfolioInfo.
Returns the contents of a portfolio.
- Request:
GET/portfolios/<PORTFOLIO-ID> - Response: A Portfolio object.
- Request:
POST/portfolios - Body:
{
"name": "String",
"currency": "String" // The currency code
}- Response: A Portfolio object.
- Request:
DELETE/portfolios/<PORTFOLIO-ID>
To get the details of a transaciton.
- Request:
GET/transactions/<TRANSACTION-ID> - Response: A Transaction object.
- Request:
POST/transactions - Body:
{
"portfolio": "String", // The portfolio ID
"platform": "String",
"account": "String", // OPTIONAL
"purchaseDate": "Date",
"ticker": "String",
"currency": "String",
"fees": "Decimal",
"numberOfShares": "Decimal",
"pricePerShare": "Decimal"
}- Response: The newly created Transaction object.
- Request:
DELETE/transactions/<TRANSACTION-ID>
{
"name": "String",
"id": "String",
"currency": "Currency",
"performance": "Performance",
"transactions": ["Transaction"]
}{
"id": "String",
"platform": "String",
"account": "String?", // OPTIONAL
"purchaseDate": "Date",
"ticker": "String",
"currency": "Currency",
"fees": "Decimal",
"numberOfShares": "Decimal",
"pricePerShareAtPurchase": "Decimal"
}{
"name": "String",
"id": "String",
"performance": "Performance",
"currency": "Currency",
"transactions": "[String]", // Array of transaction IDs
}Currency agnostic values. Response always contains a corresponding Currency.
{
"profit": "Decimal",
"moneyOut": "Decimal",
"moneyIn": "Decimal",
"totalReturn": "Decimal"
}{
"code": "String",
"symbol": "String"
}