fix: Update ClickHouse table creation syntax for trading plans

This commit is contained in:
Bobby (aider) 2025-02-11 17:45:52 -08:00
parent 34c006e360
commit f9c8d43a86

View File

@ -79,7 +79,7 @@ def create_trading_plan_table():
with create_client() as client: with create_client() as client:
query = """ query = """
CREATE TABLE IF NOT EXISTS trading_plans ( CREATE TABLE IF NOT EXISTS trading_plans (
id Int32, id UInt32,
plan_name String, plan_name String,
status String, status String,
created_at DateTime, created_at DateTime,
@ -99,8 +99,8 @@ def create_trading_plan_table():
entry_confirmation String, entry_confirmation String,
position_sizing Float64, position_sizing Float64,
maximum_drawdown Float64, maximum_drawdown Float64,
max_trades_per_day Int32, max_trades_per_day UInt32,
max_trades_per_week Int32, max_trades_per_week UInt32,
total_risk_per_trade Float64, total_risk_per_trade Float64,
max_portfolio_risk Float64, max_portfolio_risk Float64,
@ -114,7 +114,7 @@ def create_trading_plan_table():
real_trade_performance Nullable(String), real_trade_performance Nullable(String),
improvements_needed Nullable(String), improvements_needed Nullable(String),
strategy_version Int32, strategy_version UInt32,
plan_author String, plan_author String,
trade_review_notes Nullable(String), trade_review_notes Nullable(String),
future_testing_ideas Nullable(String), future_testing_ideas Nullable(String),
@ -124,6 +124,7 @@ def create_trading_plan_table():
options_strategy_details Nullable(String) options_strategy_details Nullable(String)
) )
ENGINE = MergeTree() ENGINE = MergeTree()
PRIMARY KEY (id)
ORDER BY (id, created_at) ORDER BY (id, created_at)
""" """
client.execute(query) client.execute(query)