Spaces:
Sleeping
Sleeping
Upload 14 files
Browse files- EXTRACTATIONMODEL.py +20 -14
- __pycache__/EXTRACTATIONMODEL.cpython-311.pyc +0 -0
- requirements.txt +3 -2
EXTRACTATIONMODEL.py
CHANGED
|
@@ -11,13 +11,12 @@ from urllib.parse import quote
|
|
| 11 |
from urllib.request import Request, urlopen
|
| 12 |
from zoneinfo import ZoneInfo
|
| 13 |
|
| 14 |
-
import numpy as np
|
| 15 |
-
import pandas as pd
|
| 16 |
-
|
| 17 |
-
from sklearn.
|
| 18 |
-
from sklearn.
|
| 19 |
-
from sklearn.
|
| 20 |
-
from sklearn.preprocessing import StandardScaler
|
| 21 |
|
| 22 |
EPS = 1e-9
|
| 23 |
|
|
@@ -109,13 +108,20 @@ def download_ohlc_chart(symbol: str, start_date: str) -> pd.DataFrame:
|
|
| 109 |
return pd.DataFrame()
|
| 110 |
|
| 111 |
|
| 112 |
-
def download_ohlc(symbol: str, start_date: str) -> pd.DataFrame:
|
| 113 |
-
chart = download_ohlc_chart(symbol, start_date)
|
| 114 |
-
if not chart.empty:
|
| 115 |
-
return chart
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 119 |
for attempt in range(1, DOWNLOAD_RETRIES + 1):
|
| 120 |
try:
|
| 121 |
buf = io.StringIO()
|
|
|
|
| 11 |
from urllib.request import Request, urlopen
|
| 12 |
from zoneinfo import ZoneInfo
|
| 13 |
|
| 14 |
+
import numpy as np
|
| 15 |
+
import pandas as pd
|
| 16 |
+
from sklearn.ensemble import HistGradientBoostingRegressor
|
| 17 |
+
from sklearn.linear_model import LogisticRegression, Ridge
|
| 18 |
+
from sklearn.pipeline import Pipeline
|
| 19 |
+
from sklearn.preprocessing import StandardScaler
|
|
|
|
| 20 |
|
| 21 |
EPS = 1e-9
|
| 22 |
|
|
|
|
| 108 |
return pd.DataFrame()
|
| 109 |
|
| 110 |
|
| 111 |
+
def download_ohlc(symbol: str, start_date: str) -> pd.DataFrame:
|
| 112 |
+
chart = download_ohlc_chart(symbol, start_date)
|
| 113 |
+
if not chart.empty:
|
| 114 |
+
return chart
|
| 115 |
+
|
| 116 |
+
try:
|
| 117 |
+
import yfinance as yf
|
| 118 |
+
except Exception as exc:
|
| 119 |
+
raise RuntimeError(
|
| 120 |
+
"Yahoo chart API returned no data and yfinance fallback is unavailable."
|
| 121 |
+
) from exc
|
| 122 |
+
|
| 123 |
+
last_err: Exception | None = None
|
| 124 |
+
raw = pd.DataFrame()
|
| 125 |
for attempt in range(1, DOWNLOAD_RETRIES + 1):
|
| 126 |
try:
|
| 127 |
buf = io.StringIO()
|
__pycache__/EXTRACTATIONMODEL.cpython-311.pyc
CHANGED
|
Binary files a/__pycache__/EXTRACTATIONMODEL.cpython-311.pyc and b/__pycache__/EXTRACTATIONMODEL.cpython-311.pyc differ
|
|
|
requirements.txt
CHANGED
|
@@ -8,5 +8,6 @@ sentence-transformers
|
|
| 8 |
aiohttp
|
| 9 |
scipy
|
| 10 |
pytest
|
| 11 |
-
yfinance
|
| 12 |
-
|
|
|
|
|
|
| 8 |
aiohttp
|
| 9 |
scipy
|
| 10 |
pytest
|
| 11 |
+
yfinance
|
| 12 |
+
websockets>=13.0
|
| 13 |
+
scikit-learn
|