Spaces:
Sleeping
Sleeping
Upload 42 files
Browse files- __pycache__/kotak_neo.cpython-311.pyc +0 -0
- kotak_neo.py +3 -4
- nifty_backend/runtime.py +8 -5
__pycache__/kotak_neo.cpython-311.pyc
CHANGED
|
Binary files a/__pycache__/kotak_neo.cpython-311.pyc and b/__pycache__/kotak_neo.cpython-311.pyc differ
|
|
|
kotak_neo.py
CHANGED
|
@@ -605,8 +605,7 @@ class KotakNeoManager:
|
|
| 605 |
|
| 606 |
if live_previous_close is not None:
|
| 607 |
is_same_as_static_ltp = (
|
| 608 |
-
not
|
| 609 |
-
and last_traded_price is not None
|
| 610 |
and abs(live_previous_close - last_traded_price) < 0.01
|
| 611 |
)
|
| 612 |
if not is_same_as_static_ltp:
|
|
@@ -634,8 +633,8 @@ class KotakNeoManager:
|
|
| 634 |
if session_started:
|
| 635 |
range_high = max([value for value in [session_high, last_traded_price] if value is not None], default=None)
|
| 636 |
range_low = min([value for value in [session_low, last_traded_price] if value is not None], default=None)
|
| 637 |
-
return_base =
|
| 638 |
-
return_basis = "
|
| 639 |
else:
|
| 640 |
range_high = session_high
|
| 641 |
range_low = session_low
|
|
|
|
| 605 |
|
| 606 |
if live_previous_close is not None:
|
| 607 |
is_same_as_static_ltp = (
|
| 608 |
+
last_traded_price is not None
|
|
|
|
| 609 |
and abs(live_previous_close - last_traded_price) < 0.01
|
| 610 |
)
|
| 611 |
if not is_same_as_static_ltp:
|
|
|
|
| 633 |
if session_started:
|
| 634 |
range_high = max([value for value in [session_high, last_traded_price] if value is not None], default=None)
|
| 635 |
range_low = min([value for value in [session_low, last_traded_price] if value is not None], default=None)
|
| 636 |
+
return_base = previous_close
|
| 637 |
+
return_basis = "previous_close"
|
| 638 |
else:
|
| 639 |
range_high = session_high
|
| 640 |
range_low = session_low
|
nifty_backend/runtime.py
CHANGED
|
@@ -701,6 +701,9 @@ def load_tomorrow_summary() -> dict[str, Any]:
|
|
| 701 |
def latest_tomorrow_prediction() -> dict[str, Any]:
|
| 702 |
sync_daily_forecaster_outputs()
|
| 703 |
latest_daily = latest_parquet_date(NIFTY_1D_PATH)
|
|
|
|
|
|
|
|
|
|
| 704 |
if TOMORROW_LATEST_PATH.exists():
|
| 705 |
row = pd.read_csv(TOMORROW_LATEST_PATH).iloc[-1].to_dict()
|
| 706 |
cleaned = {k: (None if pd.isna(v) else v) for k, v in row.items()}
|
|
@@ -708,14 +711,14 @@ def latest_tomorrow_prediction() -> dict[str, Any]:
|
|
| 708 |
input_day = date.fromisoformat(str(cleaned.get("input_date"))[:10])
|
| 709 |
except Exception:
|
| 710 |
input_day = None
|
| 711 |
-
if
|
| 712 |
try:
|
| 713 |
-
refreshed = refresh_tomorrow_prediction(session_date=
|
| 714 |
try:
|
| 715 |
refreshed_day = date.fromisoformat(str(refreshed.get("input_date"))[:10])
|
| 716 |
except Exception:
|
| 717 |
refreshed_day = None
|
| 718 |
-
if refreshed_day is not None and refreshed_day >=
|
| 719 |
return refreshed
|
| 720 |
except Exception:
|
| 721 |
pass
|
|
@@ -725,9 +728,9 @@ def latest_tomorrow_prediction() -> dict[str, Any]:
|
|
| 725 |
summary_input_day = date.fromisoformat(str(summary.get("latest_forecast_date"))[:10])
|
| 726 |
except Exception:
|
| 727 |
summary_input_day = None
|
| 728 |
-
if
|
| 729 |
try:
|
| 730 |
-
return refresh_tomorrow_prediction(session_date=
|
| 731 |
except Exception:
|
| 732 |
pass
|
| 733 |
return {
|
|
|
|
| 701 |
def latest_tomorrow_prediction() -> dict[str, Any]:
|
| 702 |
sync_daily_forecaster_outputs()
|
| 703 |
latest_daily = latest_parquet_date(NIFTY_1D_PATH)
|
| 704 |
+
expected_daily = expected_completed_daily_date()
|
| 705 |
+
valid_daily = min(latest_daily, expected_daily) if latest_daily and expected_daily else (expected_daily or latest_daily)
|
| 706 |
+
|
| 707 |
if TOMORROW_LATEST_PATH.exists():
|
| 708 |
row = pd.read_csv(TOMORROW_LATEST_PATH).iloc[-1].to_dict()
|
| 709 |
cleaned = {k: (None if pd.isna(v) else v) for k, v in row.items()}
|
|
|
|
| 711 |
input_day = date.fromisoformat(str(cleaned.get("input_date"))[:10])
|
| 712 |
except Exception:
|
| 713 |
input_day = None
|
| 714 |
+
if valid_daily is not None and (input_day is None or input_day < valid_daily):
|
| 715 |
try:
|
| 716 |
+
refreshed = refresh_tomorrow_prediction(session_date=valid_daily)
|
| 717 |
try:
|
| 718 |
refreshed_day = date.fromisoformat(str(refreshed.get("input_date"))[:10])
|
| 719 |
except Exception:
|
| 720 |
refreshed_day = None
|
| 721 |
+
if refreshed_day is not None and refreshed_day >= valid_daily:
|
| 722 |
return refreshed
|
| 723 |
except Exception:
|
| 724 |
pass
|
|
|
|
| 728 |
summary_input_day = date.fromisoformat(str(summary.get("latest_forecast_date"))[:10])
|
| 729 |
except Exception:
|
| 730 |
summary_input_day = None
|
| 731 |
+
if valid_daily is not None and (summary_input_day is None or summary_input_day < valid_daily):
|
| 732 |
try:
|
| 733 |
+
return refresh_tomorrow_prediction(session_date=valid_daily)
|
| 734 |
except Exception:
|
| 735 |
pass
|
| 736 |
return {
|