refactor: Simplify trading plans table structure with MergeTree engine and default values
This commit is contained in:
parent
7ccb5a8065
commit
19f06601d9
@ -77,6 +77,13 @@ class TradingPlan:
|
||||
def create_trading_plan_table():
|
||||
"""Create the trading plans table if it doesn't exist"""
|
||||
with create_client() as client:
|
||||
# First, try to drop the table if it exists
|
||||
try:
|
||||
client.execute("DROP TABLE IF EXISTS trading_plans")
|
||||
except Exception as e:
|
||||
print(f"Error dropping table: {e}")
|
||||
|
||||
# Create new table with simpler structure
|
||||
query = """
|
||||
CREATE TABLE IF NOT EXISTS trading_plans
|
||||
(
|
||||
@ -104,21 +111,22 @@ def create_trading_plan_table():
|
||||
max_portfolio_risk Float64,
|
||||
adjustments_for_drawdown String,
|
||||
risk_controls String,
|
||||
win_rate Nullable(Float64),
|
||||
average_return_per_trade Nullable(Float64),
|
||||
profit_factor Nullable(Float64),
|
||||
historical_backtest_results Nullable(String),
|
||||
real_trade_performance Nullable(String),
|
||||
improvements_needed Nullable(String),
|
||||
win_rate Float64 DEFAULT 0,
|
||||
average_return_per_trade Float64 DEFAULT 0,
|
||||
profit_factor Float64 DEFAULT 0,
|
||||
historical_backtest_results String,
|
||||
real_trade_performance String,
|
||||
improvements_needed String,
|
||||
strategy_version UInt32,
|
||||
plan_author String,
|
||||
trade_review_notes Nullable(String),
|
||||
future_testing_ideas Nullable(String),
|
||||
sector_focus Nullable(String),
|
||||
fundamental_criteria Nullable(String),
|
||||
options_strategy_details Nullable(String)
|
||||
trade_review_notes String,
|
||||
future_testing_ideas String,
|
||||
sector_focus String,
|
||||
fundamental_criteria String,
|
||||
options_strategy_details String
|
||||
)
|
||||
ENGINE = Log
|
||||
ENGINE = MergeTree
|
||||
PRIMARY KEY (id)
|
||||
"""
|
||||
client.execute(query)
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user