From 47089c605ef9ee5c03e1a1bd09f48c67f2f55fc6 Mon Sep 17 00:00:00 2001 From: gowtham1729 Date: Tue, 12 Dec 2023 19:16:39 +0900 Subject: [PATCH] feat: update fetcher --- applications/data_fetcher/fetcher.py | 20 +------------------- applications/data_fetcher/utils/models.py | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 19 deletions(-) create mode 100644 applications/data_fetcher/utils/models.py diff --git a/applications/data_fetcher/fetcher.py b/applications/data_fetcher/fetcher.py index 44505d8..366ae78 100644 --- a/applications/data_fetcher/fetcher.py +++ b/applications/data_fetcher/fetcher.py @@ -1,11 +1,11 @@ import os -from dataclasses import dataclass from datetime import datetime from typing import Dict, List import psycopg import requests from utils.logging import get_logger +from utils.models import News, Ticker logger = get_logger(__name__) @@ -19,24 +19,6 @@ MAX_API_QUERIES = 100 -@dataclass -class Ticker: - ticker: str - - -@dataclass -class News: - category: str - symbol: str - src: str - src_url: str - img_src_url: str - headline: str - summary: str - publish_time: str - sentiment: str - - class Fetcher: def __init__(self): self.connection = psycopg.connect( diff --git a/applications/data_fetcher/utils/models.py b/applications/data_fetcher/utils/models.py new file mode 100644 index 0000000..3bec960 --- /dev/null +++ b/applications/data_fetcher/utils/models.py @@ -0,0 +1,19 @@ +from dataclasses import dataclass + + +@dataclass +class Ticker: + ticker: str + + +@dataclass +class News: + category: str + symbol: str + src: str + src_url: str + img_src_url: str + headline: str + summary: str + publish_time: str + sentiment: int