MCPcopy Index your code
hub / github.com/ahmethakanbesel/finance-api

github.com/ahmethakanbesel/finance-api @v0.4.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.4.0 ↗ · + Follow
265 symbols 878 edges 40 files 36 documented · 14% updated 36d agov0.4.0 · 2026-06-11★ 38
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Finance API

Disclaimer: This project is for educational purposes only and is not intended for production financial use. Currency conversions use IEEE 754 floating-point arithmetic, which can introduce rounding errors. For real monetary calculations, use fixed-point or arbitrary-precision decimal libraries. Do not rely on this software for trading, accounting, or any financial decision-making.

A financial data aggregator API that scrapes and caches historical price data from multiple sources.

Supported Data Sources

Usage

Running the server

Download from releases

./finance-api

Run from source

go run ./cmd/finance-api

Make

make run

Docker

docker compose up -d

Configuration

Environment variables with defaults:

Variable Default Description
PORT 8080 HTTP server port
DB_PATH finance.db SQLite database path
WORKERS 5 Scraper concurrency

API Routes

Health

GET /health

List sources

GET /api/v1/sources

Get prices

GET /api/v1/prices/{symbol}

{symbol} is the fund code or ticker symbol (e.g. YAC, AAPL, THYAO.IS, ALTINS1).

Query parameters:

Parameter Required Default Description
source yes Data source: tefas, yahoo, or isyatirim
startDate yes Start date, format YYYY-MM-DD
endDate no today End date, format YYYY-MM-DD
currency no TRY TRY or USD
format no json Response format: json or csv

Examples:

GET /api/v1/prices/YAC?source=tefas&startDate=2024-01-01&endDate=2024-01-31&currency=TRY
GET /api/v1/prices/AAPL?source=yahoo&startDate=2024-01-01&endDate=2024-01-31&currency=USD
GET /api/v1/prices/THYAO.IS?source=yahoo&startDate=2024-01-01&currency=TRY&format=csv
GET /api/v1/prices/ALTINS1?source=isyatirim&startDate=2025-01-01&endDate=2025-01-31&currency=TRY
GET /api/v1/prices/GC=F?source=yahoo&startDate=2025-01-01&endDate=2025-01-31&currency=USD
GET /api/v1/prices/USDTRY=X?source=yahoo&startDate=2025-01-01&endDate=2025-01-31&currency=TRY

Jobs

GET /api/v1/jobs
GET /api/v1/jobs/{id}

Each scrape operation creates a tracked job. Use these endpoints to inspect job status and history.

JSON Response Format

All JSON responses are wrapped in:

{
  "message": "ok",
  "data": {
    "prices": [
      {
        "symbol": "YAC",
        "date": "2026-01-20T00:00:00Z",
        "closePrice": 0.367598,
        "currency": "USD",
        "nativePrice": 13.027306,
        "nativeCurrency": "TRY",
        "rate": 35.4379,
        "source": "tefas"
      },
      {
        "symbol": "YAC",
        "date": "2026-01-21T00:00:00Z",
        "closePrice": 0.366648,
        "currency": "USD",
        "nativePrice": 12.993608,
        "nativeCurrency": "TRY",
        "rate": 35.4379,
        "source": "tefas"
      }
    ]
  }
}

Use with Pandas

import pandas as pd

API_URL = "http://127.0.0.1:8080"

def get_data(source, symbol, start_date, end_date, currency="TRY"):
    url = f"{API_URL}/api/v1/prices/{symbol}?source={source}&startDate={start_date}&endDate={end_date}&currency={currency}&format=csv"
    df = pd.read_csv(url, parse_dates=["Date"])
    df.set_index("Date", inplace=True)
    return df

Development

Prerequisites

Commands

make build     # Build the binary
make run       # Build and run
make test      # Run tests with race detector
make lint      # Run golangci-lint
make check     # Run lint + format check
make fmt       # Format code

Extension points exported contracts — how you extend this code

Processor (Interface)
Processor handles execution of a claimed job. [2 implementers]
internal/job/worker.go
Scraper (Interface)
(no doc) [4 implementers]
internal/scraper/scraper.go
Repository (Interface)
(no doc)
internal/price/repository.go
Repository (Interface)
(no doc)
internal/rate/repository.go
Repository (Interface)
(no doc)
internal/job/repository.go
Option (FuncType)
Option configures a Scraper.
internal/scraper/yahoo/yahoo.go
Option (FuncType)
(no doc)
internal/rate/service.go
Option (FuncType)
(no doc)
internal/scraper/tefas/tefas.go

Core symbols most depended-on inside this repo

Get
called by 42
internal/job/repository.go
Error
called by 19
internal/apperror/apperror.go
Scrape
called by 14
internal/scraper/scraper.go
writeError
called by 13
internal/server/response.go
Register
called by 12
internal/scraper/scraper.go
New
called by 9
internal/scraper/isyatirim/isyatirim.go
GetPrices
called by 8
internal/price/service.go
New
called by 7
internal/apperror/apperror.go

Shape

Function 111
Method 100
Struct 40
Interface 5
TypeAlias 5
FuncType 4

Languages

Go100%

Modules by API surface

internal/price/service_test.go26 symbols
internal/scraper/yahoo/yahoo.go16 symbols
internal/job/service_test.go15 symbols
internal/scraper/tefas/tefas.go13 symbols
test/e2e_test.go11 symbols
internal/rate/service.go11 symbols
internal/scraper/scraper.go10 symbols
internal/price/service.go10 symbols
internal/scraper/isyatirim/isyatirim.go9 symbols
internal/repository/job/sqlite.go9 symbols
internal/scraper/yahoo/yahoo_test.go8 symbols
internal/job/worker.go8 symbols

For agents

$ claude mcp add finance-api \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page