자동매매 관련로직 수정

This commit is contained in:
2026-02-26 14:40:12 +09:00
parent 77e7464884
commit 8c8de61d67
6 changed files with 43 additions and 13 deletions

View File

@@ -10,13 +10,20 @@ async def init_database():
with open('docker/init-db.sql', 'r') as f:
sql = f.read()
# Connect to database
# Connect to database using settings or environment variable
# (fall back to defaults in .env.example which point at the local docker container)
from app.core.config import Settings
settings = Settings()
# parse DATABASE_URL to asyncpg components
from sqlalchemy.engine.url import make_url
url = make_url(settings.DATABASE_URL)
conn = await asyncpg.connect(
host='shium.net',
port=55432,
user='stock',
password='Tjduddn!!12',
database='stock'
host=url.host or 'localhost',
port=url.port or 5432,
user=url.username or 'autostock',
password=url.password or 'autostock_password',
database=url.database or 'autostock_db'
)
try: