Skip to content

Commit b0b52c5

Browse files
committed
Cleaned up files
1 parent 8af16de commit b0b52c5

12 files changed

Lines changed: 61 additions & 230 deletions

File tree

src/stock_valuation_app/api/__init__.py

Whitespace-only changes.

src/stock_valuation_app/api/routes.py

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

src/stock_valuation_app/data/fmp_client.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import httpx
44
from typing import Any, Optional
55
from pydantic import BaseModel
6-
from stock_valuation_app.utils import utils
76

87

98
@dataclass
@@ -25,9 +24,4 @@ async def fetch_data(self, endpoint: str, symbol: str, period: Optional[str] = "
2524
response = await client.get(url)
2625
response.raise_for_status()
2726
data = response.json()
28-
return data
29-
30-
api_client = FMPClient()
31-
rating_endpoint = utils.get_endpoint("rating")
32-
data = api_client.fetch_data(rating_endpoint, "AAPL")
33-
print(data)
27+
return data

src/stock_valuation_app/main.py

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
import os
2+
import yaml
3+
from dotenv import load_dotenv
4+
from stock_valuation_app.data.fmp_client import FMPClient
5+
6+
7+
# Load environment variables from .env file
8+
load_dotenv()
9+
10+
11+
def load_config():
12+
"""Load configuration from a YAML file."""
13+
with open("config.yml", "r", encoding="utf-8") as file:
14+
config = yaml.safe_load(file)
15+
return config
16+
17+
18+
def get_section_config(section: str):
19+
"""Get configuration for a specific section."""
20+
match section:
21+
case "api":
22+
return load_config().get("api")
23+
case "valuation":
24+
return load_config().get("valuation")
25+
case "dashboard":
26+
return load_config().get("dashboard")
27+
case "database":
28+
return load_config().get("database")
29+
case "logging":
30+
return load_config().get("logging")
31+
case _:
32+
raise ValueError(f"Invalid section: {section}")
33+
34+
35+
def get_endpoint(url: str) -> str:
36+
"""Get endpoints from the configuration."""
37+
api_config = get_section_config("api")
38+
return api_config.get(f"{url}")
39+
40+
41+
def get_base_url() -> str:
42+
"""Get the base URL from the configuration."""
43+
return get_endpoint("base_url")
44+
45+
46+
def get_api_key() -> str:
47+
"""Get the API key from the .env file."""
48+
return os.getenv("FMP_API_KEY", "")
49+
50+
51+
def main() -> None:
52+
"""Main function to fetch data from the Financial Modeling Prep API."""
53+
api_client = FMPClient()
54+
rating_endpoint = get_endpoint("rating")
55+
data = api_client.fetch_data(rating_endpoint, "AAPL")
56+
print(data)
57+
58+
59+
if __name__ == "__main__":
60+
main()

src/stock_valuation_app/models/__init__.py

Whitespace-only changes.

src/stock_valuation_app/models/stock.py

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

src/stock_valuation_app/services/__init__.py

Whitespace-only changes.

src/stock_valuation_app/services/valuation.py

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

src/stock_valuation_app/ui/__init__.py

Whitespace-only changes.

src/stock_valuation_app/ui/dashboard.py

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

0 commit comments

Comments
 (0)