Skip to content

Commit

Permalink
(feat) improve manage accounts
Browse files Browse the repository at this point in the history
  • Loading branch information
cardosofede committed Aug 29, 2024
1 parent 17a1dc1 commit 8dffd44
Showing 1 changed file with 0 additions and 11 deletions.
11 changes: 0 additions & 11 deletions routers/manage_accounts.py
Original file line number Diff line number Diff line change
@@ -1,33 +1,22 @@
from typing import Dict, List

from apscheduler.schedulers.asyncio import AsyncIOScheduler
from fastapi import APIRouter, HTTPException
from hummingbot.client.settings import AllConnectorSettings
from starlette import status

from services.accounts_service import AccountsService
from utils.file_system import FileSystemUtil

# Initialize the scheduler
scheduler = AsyncIOScheduler()
router = APIRouter(tags=["Manage Credentials"])
file_system = FileSystemUtil(base_path="bots/credentials")
accounts_service = AccountsService()


@router.on_event("startup")
async def startup_event():
# Add the job to the scheduler
scheduler.start()
accounts_service.start_update_account_state_loop()


@router.on_event("shutdown")
async def shutdown_event():
# Shutdown the scheduler on application exit
scheduler.shutdown()


@router.get("/accounts-state", response_model=Dict[str, Dict[str, List[Dict]]])
async def get_all_accounts_state():
return accounts_service.get_accounts_state()
Expand Down

0 comments on commit 8dffd44

Please sign in to comment.