Skip to content

Commit

Permalink
Format existing files
Browse files Browse the repository at this point in the history
  • Loading branch information
soyccan committed Dec 29, 2023
1 parent 4385279 commit abb71e8
Show file tree
Hide file tree
Showing 13 changed files with 22 additions and 22 deletions.
1 change: 0 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,3 @@ jobs:

- name: Stop services
run: docker-compose -f docker-compose.test.yml down

1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -160,4 +160,3 @@ cython_debug/
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

1 change: 0 additions & 1 deletion config.example/.env
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,3 @@ MONGO_DATABASE="tradewise"
# Telegram Bot API Token
TELEGRAM_BOT_TOKEN="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
TELEGRAM_BOT_AUTH_USER_ID="XXXXXXXXX"

1 change: 0 additions & 1 deletion docker-compose.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,3 @@ networks:

volumes:
db-test:

1 change: 0 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,3 @@ networks:

volumes:
db-data:

10 changes: 6 additions & 4 deletions services/database-api/src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,15 @@
# Copyright (c) 2023 by wildfootw <wildfootw@wildfoo.tw>
#

import json
import os

from fastapi import FastAPI, HTTPException, status
from pydantic import BaseModel
from pymongo import MongoClient

from utils.encoder import JSONEncoder
from pydantic import BaseModel
import json
import os


# Pydantic model for balance sheet request validation
class BalanceSheetRequest(BaseModel):
Expand Down Expand Up @@ -79,4 +82,3 @@ async def delete_balance_sheet(ticker_symbol: str, year: int, season: int):
if result.deleted_count:
return {"message": "Balance sheet deleted"}
raise HTTPException(status_code=404, detail="Balance sheet not found")

5 changes: 3 additions & 2 deletions services/database-api/src/utils/encoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,15 @@
# Copyright (c) 2023 by wildfootw <wildfootw@wildfoo.tw>
#

import json

from bson import ObjectId
from fastapi.encoders import jsonable_encoder
import json


# Custom JSON Encoder for handling ObjectId
class JSONEncoder(json.JSONEncoder):
def default(self, obj):
if isinstance(obj, ObjectId):
return str(obj) # Convert ObjectId to string for JSON serialization
return super(JSONEncoder, self).default(obj)

3 changes: 2 additions & 1 deletion services/fugle-market-data/src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@
# Copyright (c) 2023 by wildfootw <wildfootw@wildfoo.tw>
#

import os

from fastapi import FastAPI
from fugle_marketdata import RestClient
import os

fugle_marketdata_api_key = os.getenv('FUGLE_MARKET_DATA_API_KEY')

Expand Down
1 change: 0 additions & 1 deletion services/insight-engine/src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,3 @@


if __name__ == "__main__":

5 changes: 3 additions & 2 deletions services/telegram-bot/src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@
#

import logging
import os

import requests
from telegram import Update
from telegram.ext import ApplicationBuilder, CommandHandler, ContextTypes
import requests
import os

telegram_bot_token = os.getenv('TELEGRAM_BOT_TOKEN')
telegram_bot_auth_user_id = os.getenv('TELEGRAM_BOT_AUTH_USER_ID')
Expand Down
1 change: 1 addition & 0 deletions tests/test_database_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

import requests


def test_balance_sheet():
# Endpoint URL
url = 'http://database-api/balance_sheet/'
Expand Down
9 changes: 5 additions & 4 deletions utils/twse_crawler_finance_aiohttp.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,13 @@
# Copyright (c) 2023 by wildfootw <wildfootw@wildfoo.tw>
#

import aiohttp
import pandas
from io import StringIO
import os
import asyncio
import logging
import os
from io import StringIO

import aiohttp
import pandas

# Set up logging
log_level = os.environ.get("LOG_LEVEL", "DEBUG").upper()
Expand Down
5 changes: 2 additions & 3 deletions utils/twse_crawler_finance_requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
# Copyright (c) 2023 by wildfootw <wildfootw@wildfoo.tw>
#

import requests
import pandas
from io import StringIO

import pandas
import requests

# URLs for different types of financial reports
balance_sheet_url = "https://mops.twse.com.tw/mops/web/ajax_t164sb03" # URL for Balance Sheet
Expand Down Expand Up @@ -77,4 +77,3 @@ def crawl_financial_report(url, ticker_symbol, year, season):
html_dataframe = crawl_financial_report(balance_sheet_url, ticker_symbol, reporting_year, reporting_season)
data_dict = extract_balance_sheet(html_dataframe, reporting_year, reporting_season)
print(data_dict)

0 comments on commit abb71e8

Please sign in to comment.