mirror of
https://github.com/NicolasBohn/NexQuant.git
synced 2026-07-31 17:27:42 +00:00
feat: migrate to 1min EURUSD data (2020-2026)
- data_config.yaml: frequency 15min -> 1min, path -> eurusd_1min_data - patches/generate.py: updated qlib.init path and freq - patches/eva_utils.py: updated intraday label to 1min - all prompts/configs: replaced 15min references with 1min - fx_validator config, trader, graph: 1min intraday trading context
This commit is contained in:
@@ -10,3 +10,6 @@ __pycache__/
|
||||
*.pyc
|
||||
*.pyo
|
||||
prompt_cache.db
|
||||
convert_1min.py
|
||||
import_1min_qlib.py
|
||||
data_raw/
|
||||
|
||||
+2
-2
@@ -5,8 +5,8 @@
|
||||
# ============================================================
|
||||
|
||||
instrument: EURUSD
|
||||
frequency: 15min # 1min, 5min, 15min, 1h, 1d
|
||||
data_path: ~/.qlib/qlib_data/eurusd_data
|
||||
frequency: 1min # 1min, 5min, 15min, 1h, 1d
|
||||
data_path: ~/.qlib/qlib_data/eurusd_1min_data
|
||||
|
||||
# Verfügbare Spalten (keine $factor Spalte!)
|
||||
columns:
|
||||
|
||||
@@ -243,7 +243,7 @@ class FactorDatetimeDailyEvaluator(FactorEvaluator):
|
||||
False,
|
||||
)
|
||||
if min_diff <= pd.Timedelta(minutes=30):
|
||||
return "The generated dataframe is intraday (15min bars). This is correct for EURUSD.", True
|
||||
return "The generated dataframe is intraday (1min bars). This is correct for EURUSD.", True
|
||||
return "The generated dataframe is daily.", True
|
||||
|
||||
|
||||
|
||||
+3
-3
@@ -7,12 +7,12 @@ result = subprocess.run(
|
||||
["/home/nico/miniconda3/envs/rdagent4qlib/bin/python3", "-c", """
|
||||
import qlib
|
||||
from qlib.data import D
|
||||
qlib.init(provider_uri="~/.qlib/qlib_data/eurusd_data")
|
||||
qlib.init(provider_uri="~/.qlib/qlib_data/eurusd_1min_data")
|
||||
fields = ["$open", "$close", "$high", "$low", "$volume"]
|
||||
data = (D.features(["EURUSD"], fields, start_time="2022-03-14", end_time="2026-03-20", freq="15min")
|
||||
data = (D.features(["EURUSD"], fields, start_time="2022-03-14", end_time="2026-03-20", freq="1min")
|
||||
.swaplevel().sort_index())
|
||||
data.to_hdf("./daily_pv_all.h5", key="data")
|
||||
data_debug = (D.features(["EURUSD"], fields, start_time="2024-01-01", end_time="2026-03-20", freq="15min")
|
||||
data_debug = (D.features(["EURUSD"], fields, start_time="2024-01-01", end_time="2026-03-20", freq="1min")
|
||||
.swaplevel().sort_index())
|
||||
data_debug.to_hdf("./daily_pv_debug.h5", key="data")
|
||||
print(f"Done: {data.shape[0]} rows")
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
hypothesis_generation:
|
||||
system: |-
|
||||
You are an expert in FX and quantitative trading, specialized in EURUSD intraday strategies.
|
||||
Your task is to generate a well-reasoned hypothesis for new alpha factors based on EURUSD 15min OHLCV data.
|
||||
Your task is to generate a well-reasoned hypothesis for new alpha factors based on EURUSD 1min OHLCV data.
|
||||
|
||||
Key market knowledge:
|
||||
- EURUSD trades 24h with three main sessions: Asian (00:00-08:00 UTC), London (08:00-16:00 UTC), NY (13:00-21:00 UTC)
|
||||
|
||||
@@ -101,7 +101,7 @@ factor_hypothesis_specification: |-
|
||||
- Asian session shows mean reversion tendencies
|
||||
- Spread cost ~1.5 bps per trade — avoid high-turnover factors
|
||||
- No $factor column exists — use only $open, $close, $high, $low, $volume
|
||||
- Each "instrument" is EURUSD, each "day" is a 15min bar
|
||||
- Each "instrument" is EURUSD, each "day" is a 1min bar
|
||||
|
||||
**Factor Generation Rules:**
|
||||
1. **3-5 Factors per Generation** — cover different signal types per round
|
||||
@@ -183,7 +183,7 @@ factor_feedback_generation:
|
||||
Your feedback should specify whether the current result supports or refutes the hypothesis, compare it with previous SOTA results, and suggest FX-specific improvements.
|
||||
|
||||
**FX-specific evaluation criteria:**
|
||||
- IC > 0.02 is meaningful for 15min EURUSD data
|
||||
- IC > 0.02 is meaningful for 1min EURUSD data
|
||||
- Annualized return target: >9.62% (current SOTA to beat)
|
||||
- Spread cost ~1.5 bps per trade — penalize high-turnover factors
|
||||
- Factors using $factor column are INVALID — only $open $close $high $low $volume allowed
|
||||
@@ -198,7 +198,7 @@ factor_feedback_generation:
|
||||
2. Development Directions:
|
||||
a) New Direction: Propose a new FX-specific factor (session filter, volatility regime, volume spike).
|
||||
b) Optimization: Refine lookback windows (4/8/16/32 bars), add ADX filter, adjust for spread costs.
|
||||
3. Final Goal: Beat 9.62% ARR on EURUSD 15min with controlled drawdown (<20%).
|
||||
3. Final Goal: Beat 9.62% ARR on EURUSD 1min with controlled drawdown (<20%).
|
||||
|
||||
When judging results:
|
||||
1. Any small improvement in annualized return → set Replace Best Result as yes.
|
||||
|
||||
@@ -20,7 +20,7 @@ hypothesis_generation:
|
||||
- Statistical: Regime-switching (HMM), Kalman filter
|
||||
|
||||
Available features in the dataset:
|
||||
- OHLCV: open, high, low, close, volume (15min bars)
|
||||
- OHLCV: open, high, low, close, volume (1min bars)
|
||||
- Returns: ret_1, ret_4, ret_8, ret_16, ret_96
|
||||
- Technical: rsi_14, macd_hist, adx_14, atr_14, bb_pct, stoch_k, cci_14
|
||||
- Volatility: vol_real_4, vol_real_16, vol_ratio, zscore_ret_96
|
||||
@@ -36,7 +36,7 @@ hypothesis_generation:
|
||||
|
||||
Please ensure your response is in JSON format:
|
||||
{
|
||||
"hypothesis": "A clear and concise trading hypothesis for EURUSD 15min.",
|
||||
"hypothesis": "A clear and concise trading hypothesis for EURUSD 1min.",
|
||||
"reason": "Detailed explanation including session, model choice, and expected edge.",
|
||||
"model_type": "One of: TimeSeries / Tabular / XGBoost",
|
||||
"target_session": "london / ny / asian / all",
|
||||
|
||||
@@ -27,11 +27,16 @@ def get_fx_macro_data() -> str:
|
||||
else:
|
||||
vol_24h = "N/A"
|
||||
|
||||
eurusd_last_str = f"{eurusd_last:.5f}" if isinstance(eurusd_last, float) else str(eurusd_last)
|
||||
eurusd_change_str = f"{eurusd_change:.3f}%" if isinstance(eurusd_change, float) else str(eurusd_change)
|
||||
dxy_last_str = f"{dxy_last:.2f}" if isinstance(dxy_last, float) else str(dxy_last)
|
||||
vol_24h_str = f"{vol_24h:.4f}%" if isinstance(vol_24h, float) else str(vol_24h)
|
||||
|
||||
return f"""
|
||||
EURUSD Current: {eurusd_last:.5f if isinstance(eurusd_last, float) else eurusd_last}
|
||||
EURUSD 24h Change: {eurusd_change:.3f}% if isinstance(eurusd_change, float) else eurusd_change}
|
||||
DXY (Dollar Index): {dxy_last:.2f if isinstance(dxy_last, float) else dxy_last}
|
||||
Realized Volatility 24h: {vol_24h:.4f}% if isinstance(vol_24h, float) else vol_24h}
|
||||
EURUSD Current: {eurusd_last_str}
|
||||
EURUSD 24h Change: {eurusd_change_str}
|
||||
DXY (Dollar Index): {dxy_last_str}
|
||||
Realized Volatility 24h: {vol_24h_str}
|
||||
"""
|
||||
except Exception as e:
|
||||
return f"Macro data unavailable: {e}"
|
||||
|
||||
@@ -13,7 +13,7 @@ def create_fx_trader(llm):
|
||||
debate_history = debate_state.get("history", "")
|
||||
risk_report = state.get("risk_report", "")
|
||||
|
||||
prompt = f"""You are an FX Trading Decision Agent for EURUSD 15min intraday trading.
|
||||
prompt = f"""You are an FX Trading Decision Agent for EURUSD 1min intraday trading.
|
||||
|
||||
You have received reports from your team:
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
"""
|
||||
FX Validator Configuration
|
||||
Angepasst für EURUSD 15min intraday trading
|
||||
Angepasst für EURUSD 1min intraday trading
|
||||
"""
|
||||
import os
|
||||
|
||||
FX_CONFIG = {
|
||||
"instrument": "EURUSD=X",
|
||||
"frequency": "15min",
|
||||
"frequency": "1min",
|
||||
"llm_provider": "openai",
|
||||
"backend_url": os.getenv("OPENAI_API_BASE", "http://localhost:8081/v1"),
|
||||
"api_key": os.getenv("OPENAI_API_KEY", "local"),
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"""
|
||||
FX Validator Graph — Multi-Agent Validierung für Predix Faktoren
|
||||
Inspiriert von TradingAgents, angepasst für EURUSD 15min
|
||||
Inspiriert von TradingAgents, angepasst für EURUSD 1min
|
||||
"""
|
||||
from typing import TypedDict, Optional
|
||||
from langgraph.graph import StateGraph, END
|
||||
|
||||
Reference in New Issue
Block a user