Skip to content

Commit 705e0bc

Browse files
committed
Streamlined the project structure
1 parent 410112b commit 705e0bc

20 files changed

Lines changed: 339 additions & 1011 deletions

.dockerignore

Lines changed: 0 additions & 61 deletions
This file was deleted.

Dockerfile

Lines changed: 0 additions & 10 deletions
This file was deleted.

docker-compose.yml

Lines changed: 0 additions & 8 deletions
This file was deleted.

pyproject.toml

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -12,35 +12,16 @@ dependencies = [
1212
"asyncio>=3.4.3",
1313
"duckdb>=1.1.3",
1414
"httpx>=0.27.2",
15-
"pandas>=2.2.3",
1615
"plotly>=5.24.1",
1716
"polars>=1.12.0",
18-
"pydantic>=2.9.2",
19-
"python-dotenv>=1.0.1",
20-
"pyyaml>=6.0.2",
17+
"pydantic-settings>=2.8.1",
2118
"streamlit>=1.40.1",
2219
]
2320

24-
[tool.hatch.build.targets.wheel]
25-
packages = ["src/stock_valuation_app"]
26-
27-
[project.scripts]
28-
stock-valuation-app = "stock_valuation_app:main"
29-
30-
[build-system]
31-
requires = ["hatchling"]
32-
build-backend = "hatchling.build"
33-
3421
[dependency-groups]
3522
dev = [
3623
"ipykernel>=6.29.5",
3724
"mypy>=1.13.0",
3825
"pytest>=8.3.3",
3926
"ruff>=0.7.3",
40-
]
41-
42-
[tool.pytest.ini.options]
43-
pythonpath = "src/stock_valuation_app"
44-
45-
# [tool.setuptools]
46-
# package-dir = {"" = "src"}
27+
]
Lines changed: 13 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,20 @@
1-
import os
21
import asyncio
32
from dataclasses import dataclass, field
43
from typing import Any
5-
import httpx
6-
import stock_valuation_app.utils as utils
7-
from stock_valuation_app.models.stock_models import CombinedModel
8-
9-
10-
def get_endpoint(url: str) -> str:
11-
"""Get endpoints from the configuration."""
12-
api_config = utils.get_section_config("api")
13-
return api_config.get(f"{url}")
14-
15-
16-
def get_base_url() -> str:
17-
"""Get the base URL from the configuration."""
18-
return get_endpoint("base_url")
194

5+
import httpx
206

21-
def get_api_key() -> str:
22-
"""Get the API key from the .env file."""
23-
return os.getenv("FMP_API_KEY", "")
7+
import utils as utils
8+
from config import settings
9+
from models.stock_models import CombinedModel
2410

2511

2612
@dataclass
2713
class FMPClient:
2814
"""A client for interacting with the Financial Modeling Prep API."""
29-
base_url: str = field(default_factory=get_base_url)
30-
api_key: str = field(default_factory=get_api_key)
15+
16+
base_url: str = field(default_factory=settings.base_url)
17+
api_key: str = field(default_factory=settings.fmp_api_key)
3118
metric_types: list[str] = field(
3219
default_factory=lambda: [
3320
"profile",
@@ -67,11 +54,14 @@ async def fetch_data(self, ticker: str) -> dict[str, list[dict[str, Any]]]:
6754
"rating": "ratings",
6855
"key-metrics": "key_metrics",
6956
"key-metrics-ttm": "key_metrics_ttm",
70-
"financial-growth": "growth",} #
71-
new_metric_types = [replace_metric_types.get(item, item) for item in self.metric_types]
57+
"financial-growth": "growth",
58+
} #
59+
new_metric_types = [
60+
replace_metric_types.get(item, item) for item in self.metric_types
61+
]
7262

7363
# Create combined records dict for validation
7464
records = dict(zip(new_metric_types, results))
7565

7666
# Validate the combined records
77-
return CombinedModel(**records).model_dump()
67+
return CombinedModel(**records).model_dump()

0 commit comments

Comments
 (0)