Skip to content

krbob/portfolio

Repository files navigation

Portfolio

GitHub Actions Workflow Status

About

This project provides a backend service designed to fetch both fundamental and technical analysis indicators for use in spreadsheets. It is built using Kotlin and Python, leveraging Docker for containerization.

Installation

Prerequisites

  • Docker Compose

Steps

  1. Clone the repository:
    git clone https://github.com/krbob/portfolio.git
    cd portfolio
  2. Start the Docker containers from pre-built images:
    docker compose up -d
    Or build and start the Docker containers:
    docker compose -f docker-compose-build.yml up --build -d

Usage

Once the Docker containers are up and running, the services will be available on the following ports:

  • The main service runs on port 7777.
  • The backend service, which serves as the data source for analysis, runs on port 7776. Note that it is only accessible within the Docker Compose stack and is not exposed to the external network.

Example API Call

To fetch an indicator, you can use a tool like curl:

curl -X GET http://localhost:7777/analysis/aapl

Example output

{
  "symbol": "aapl",
  "name": "Apple Inc.",
  "date": "2024-12-04",
  "lastPrice": 242.41,
  "gain": {
    "daily": 0,
    "weekly": 0.03,
    "monthly": 0.09,
    "quarterly": 0.1,
    "yearly": 0.28
  },
  "rsi": {
    "daily": 72.12,
    "weekly": 67.12,
    "monthly": 70.31
  },
  "dividendYield": 0.004,
  "peRatio": 29.18,
  "pbRatio": 64.35,
  "eps": 6.09,
  "roe": 1.57,
  "marketCap": 3664221000000
}

Currency Conversion

You can also request a currency-converted version of the full analysis output. Supported converted fields:

  • lastPrice
  • gain (all periods)
  • rsi (all periods)
  • dividendYield
curl -X GET http://localhost:7777/analysis/aapl/conversion/eur=x

In this example, eur=x refers to the EUR/USD exchange rate symbol on Yahoo Finance. The API will apply the appropriate conversion to the above-listed fields before returning the result.

About

Easily get fundamental and technical analysis indicators for stock market data.

Topics

Resources

Stars

Watchers

Forks