Skip to content

Commit

Permalink
fix: sql bug - ensure scan does not pick up outdated forecasts
Browse files Browse the repository at this point in the history
Signed-off-by: ivelin <[email protected]>
  • Loading branch information
ivelin committed Jul 20, 2024
1 parent e9239a0 commit e41bc17
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 9 deletions.
6 changes: 3 additions & 3 deletions example.env
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ data_3rd_party="data-3rd-party"
# forecast data storage
forecast_data_file="forecast_data.parquet"

# path to duckdb file
db_file="canswim_local.duckdb"

# Keep changes local or sync with remote HF Hub repo
hfhub_sync=False

# path to duckdb file
db_file="canswim_local.duckdb"
4 changes: 3 additions & 1 deletion forecast.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,6 @@ set -exv
#./canswim.sh forecast --forecast_start_date "2024-06-17"
#./canswim.sh forecast --forecast_start_date "2024-06-24"
#./canswim.sh forecast --forecast_start_date "2024-07-01"
./canswim.sh forecast --forecast_start_date "2024-07-08"
#./canswim.sh forecast --forecast_start_date "2024-07-08"
#./canswim.sh forecast --forecast_start_date "2024-07-15"
./canswim.sh forecast --forecast_start_date "2024-07-22"
4 changes: 2 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = canswim
version = 0.0.10
version = 0.0.12
author = Ivelin Ivanov
author_email = [email protected]
description = "Developer toolkit for IBD CANSLIM practitioners"
Expand All @@ -22,7 +22,7 @@ package_dir=
packages = find:
python_requires = >=3.10
install_requires =
darts
darts~=0.27
yfinance
fmpsdk
optuna==3.4.0
Expand Down
7 changes: 6 additions & 1 deletion src/canswim/dashboard/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,12 @@ def initdb(self):
CREATE UNIQUE INDEX stock_tickers_sym_idx ON stock_tickers (symbol)
"""
)
logger.info("Creating forecast table")
logger.info(
"""
Creating forecast tables optimized for search. May take a few minutes.\n
Use --help to see dashboard launch options.
"""
)
db_con.sql(
f"""--sql
CREATE OR REPLACE TABLE forecast
Expand Down
2 changes: 1 addition & 1 deletion src/canswim/dashboard/advanced.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def __init__(self, canswim_model: CanswimModel = None, db_path=None):
HAVING forecast_close_high > prior_close_price AND
f.start_date = lf.date AND
reward_risk> 3 AND reward_percent >= 20
and forecast_start_date = max(lf.date)
AND forecast_start_date = (select max(date) from latest_forecast)
"""
)

Expand Down
2 changes: 1 addition & 1 deletion src/canswim/dashboard/scans.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def scan_forecasts(self, lowq, reward, rr):
HAVING forecast_close_high > prior_close_price AND
f.start_date = lf.date AND
reward_risk> $rr AND reward_percent >= $reward
and forecast_start_date = max(lf.date)
AND forecast_start_date = (select max(date) from latest_forecast)
""",
params={
"rr": rr,
Expand Down

0 comments on commit e41bc17

Please sign in to comment.