Initial commit

This commit is contained in:
freedakgmail
2026-07-17 18:49:07 +08:00
commit 9c7d7abdd4
100 changed files with 41337 additions and 0 deletions
+36
View File
@@ -0,0 +1,36 @@
"""
应用配置
"""
import os
class Config:
# Flask 配置
SECRET_KEY = os.environ.get('SECRET_KEY', 'stock-app-secret-key-2026')
# 数据库配置
DB_HOST = os.environ.get('DB_HOST', 'localhost')
DB_PORT = int(os.environ.get('DB_PORT', 5432))
DB_NAME = os.environ.get('DB_NAME', 'stock_app')
DB_USER = os.environ.get('DB_USER', 'postgres')
DB_PASSWORD = os.environ.get('DB_PASSWORD', '')
# 文件路径
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
STOCK_DATA_CACHE_DIR = os.path.join(BASE_DIR, 'stock_data_cache')
STOCK_NAME_CACHE_FILE = os.path.join(BASE_DIR, 'stock_names.json')
TRADES_FILE = os.path.join(BASE_DIR, 'trades.json')
WATCHLIST_FILE = os.path.join(BASE_DIR, 'watchlist.json')
ALERTS_CACHE_FILE = os.path.join(BASE_DIR, 'alerts_cache.json')
# 阿里云K线API
ALICLOUD_APPCODE = os.environ.get('ALICLOUD_APPCODE', '50528b6544ac4234a8ccb5c9f2c01607')
ALICLOUD_KLINE_URL = 'https://jmqqgphqcx.market.alicloudapi.com/finance/a-shares-kline'
# 服务端口
PORT = int(os.environ.get('PORT', 3333))
# 确保缓存目录存在
@classmethod
def init_app(cls):
if not os.path.exists(cls.STOCK_DATA_CACHE_DIR):
os.makedirs(cls.STOCK_DATA_CACHE_DIR)