Files
quantumbotx/core/db/connection.py
T
Reynov Christian dde4438b86 feat: Implement Hybrid Strategy & Major Bug Fixes
Successfully run QuantumBotX Hybrid on XAUUSD after fixing critical bugs (KeyError, data fetching). Improved UI with scrollable modal and implemented graceful shutdown for the server. System is now more robust and user-friendly.
2025-08-01 01:16:39 +08:00

15 lines
496 B
Python

# core/db/connection.py
import sqlite3
import os
# Tentukan nama file database di satu tempat.
DATABASE_FILENAME = 'bots.db'
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
DATABASE_PATH = os.path.join(BASE_DIR, '..', '..', DATABASE_FILENAME)
def get_db_connection():
"""Membuat dan mengembalikan koneksi ke database SQLite."""
conn = sqlite3.connect(DATABASE_PATH)
# Mengatur agar hasil query bisa diakses seperti dictionary
conn.row_factory = sqlite3.Row
return conn