feat: Add interval selection to technical scanner page
This commit is contained in:
parent
8b56c3c8e5
commit
6f5dadbe5c
@ -4,7 +4,7 @@ from screener.t_atr_ema_v2 import run_atr_ema_scanner_v2
|
|||||||
|
|
||||||
def run_technical_scanner(scanner_choice: str, start_date: str, end_date: str,
|
def run_technical_scanner(scanner_choice: str, start_date: str, end_date: str,
|
||||||
min_price: float, max_price: float, min_volume: int,
|
min_price: float, max_price: float, min_volume: int,
|
||||||
portfolio_size: float):
|
portfolio_size: float, interval: str = "1d"):
|
||||||
"""
|
"""
|
||||||
Run the selected technical scanner with provided parameters
|
Run the selected technical scanner with provided parameters
|
||||||
|
|
||||||
@ -16,11 +16,12 @@ def run_technical_scanner(scanner_choice: str, start_date: str, end_date: str,
|
|||||||
max_price (float): Maximum stock price
|
max_price (float): Maximum stock price
|
||||||
min_volume (int): Minimum volume
|
min_volume (int): Minimum volume
|
||||||
portfolio_size (float): Portfolio size for position sizing
|
portfolio_size (float): Portfolio size for position sizing
|
||||||
|
interval (str): Time interval for data (default: "1d")
|
||||||
"""
|
"""
|
||||||
scanner_map = {
|
scanner_map = {
|
||||||
"sunnybands": lambda: run_sunny_scanner(min_price, max_price, min_volume, portfolio_size),
|
"sunnybands": lambda: run_sunny_scanner(min_price, max_price, min_volume, portfolio_size, interval),
|
||||||
"atr-ema": lambda: run_atr_ema_scanner(min_price, max_price, min_volume, portfolio_size),
|
"atr-ema": lambda: run_atr_ema_scanner(min_price, max_price, min_volume, portfolio_size, interval),
|
||||||
"atr-ema_v2": lambda: run_atr_ema_scanner_v2(min_price, max_price, min_volume, portfolio_size)
|
"atr-ema_v2": lambda: run_atr_ema_scanner_v2(min_price, max_price, min_volume, portfolio_size, interval)
|
||||||
}
|
}
|
||||||
|
|
||||||
scanner_func = scanner_map.get(scanner_choice)
|
scanner_func = scanner_map.get(scanner_choice)
|
||||||
|
|||||||
@ -307,6 +307,23 @@ def technical_scanner_page():
|
|||||||
key="tech_scanner_type"
|
key="tech_scanner_type"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Add interval selection
|
||||||
|
interval = st.selectbox(
|
||||||
|
"Select Time Interval",
|
||||||
|
["Daily", "5 minute", "15 minute", "30 minute", "1 hour"],
|
||||||
|
key="interval_select"
|
||||||
|
)
|
||||||
|
|
||||||
|
# Convert interval to format expected by scanner
|
||||||
|
interval_map = {
|
||||||
|
"Daily": "1d",
|
||||||
|
"5 minute": "5m",
|
||||||
|
"15 minute": "15m",
|
||||||
|
"30 minute": "30m",
|
||||||
|
"1 hour": "1h"
|
||||||
|
}
|
||||||
|
selected_interval = interval_map[interval]
|
||||||
|
|
||||||
# Date range selection
|
# Date range selection
|
||||||
date_col1, date_col2 = st.columns(2)
|
date_col1, date_col2 = st.columns(2)
|
||||||
with date_col1:
|
with date_col1:
|
||||||
@ -333,7 +350,8 @@ def technical_scanner_page():
|
|||||||
min_price=min_price,
|
min_price=min_price,
|
||||||
max_price=max_price,
|
max_price=max_price,
|
||||||
min_volume=min_volume,
|
min_volume=min_volume,
|
||||||
portfolio_size=portfolio_size
|
portfolio_size=portfolio_size,
|
||||||
|
interval=selected_interval
|
||||||
)
|
)
|
||||||
if signals:
|
if signals:
|
||||||
st.success(f"Found {len(signals)} signals")
|
st.success(f"Found {len(signals)} signals")
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user