refactor: Simplify trading_plans table creation with MergeTree engine
This commit is contained in:
parent
7b6d890d7e
commit
26c8d83451
@ -78,13 +78,13 @@ def create_trading_plan_table():
|
||||
"""Create the trading plans table if it doesn't exist"""
|
||||
with create_client() as client:
|
||||
query = """
|
||||
CREATE TABLE IF NOT EXISTS trading_plans (
|
||||
CREATE TABLE IF NOT EXISTS trading_plans
|
||||
(
|
||||
id UInt32,
|
||||
plan_name String,
|
||||
status String,
|
||||
created_at DateTime64(3),
|
||||
updated_at DateTime64(3),
|
||||
|
||||
timeframe String,
|
||||
market_focus String,
|
||||
entry_criteria String,
|
||||
@ -95,36 +95,31 @@ def create_trading_plan_table():
|
||||
trade_frequency String,
|
||||
market_conditions String,
|
||||
indicators_used String,
|
||||
|
||||
entry_confirmation String,
|
||||
position_sizing Float64,
|
||||
maximum_drawdown Float64,
|
||||
max_trades_per_day UInt32,
|
||||
max_trades_per_week UInt32,
|
||||
|
||||
total_risk_per_trade Float64,
|
||||
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),
|
||||
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)
|
||||
)
|
||||
ENGINE = ReplacingMergeTree(updated_at)
|
||||
ORDER BY (id)
|
||||
ENGINE = MergeTree
|
||||
ORDER BY id
|
||||
"""
|
||||
client.execute(query)
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user