Spaces:
Runtime error
Runtime error
Commit
•
ff56974
1
Parent(s):
be3771b
Update main.py
Browse files
main.py
CHANGED
@@ -44,7 +44,7 @@ def read_root():
|
|
44 |
|
45 |
|
46 |
def data_download(ticker: str):
|
47 |
-
ticker = ticker
|
48 |
# Define the list of tickers
|
49 |
index_list = [
|
50 |
ticker, '^VIX', '^VVIX', '^VIX9D', '^VIX3M', '^VIX6M', '^FVX', '^TNX', '^TYX'
|
@@ -68,7 +68,7 @@ def data_download(ticker: str):
|
|
68 |
|
69 |
|
70 |
def data_manipolation(df,ticker: str):
|
71 |
-
ticker = ticker
|
72 |
# MA calculation for all columns
|
73 |
New_Names=[ticker,'VIX','VIX_Index','VIX9D','VIX3M','VIX6M','T5Y','T10Y','T30Y']
|
74 |
for col in New_Names:
|
@@ -101,7 +101,7 @@ def data_manipolation(df,ticker: str):
|
|
101 |
return df
|
102 |
|
103 |
def data_split_train_test(df,ticker: str):
|
104 |
-
ticker = ticker
|
105 |
X = df.loc[:,df.columns != ticker + '_c1']
|
106 |
y = df[ ticker + '_c1']
|
107 |
recent_data_size = int(0.3 * len(X)) # Adjust the percentage as needed
|
@@ -144,6 +144,7 @@ def read_item(ticker: str):
|
|
144 |
df=df.round(2)
|
145 |
Xtrain, ytrain, Xtest, ytest = data_split_train_test(df,ticker)
|
146 |
forecast_value = xgb_training_forecast(Xtrain, ytrain, Xtest, ytest).round(2)
|
|
|
147 |
result = forecast_value.to_json(orient="records")
|
148 |
return result
|
149 |
|
|
|
44 |
|
45 |
|
46 |
def data_download(ticker: str):
|
47 |
+
ticker = ticker.upper()
|
48 |
# Define the list of tickers
|
49 |
index_list = [
|
50 |
ticker, '^VIX', '^VVIX', '^VIX9D', '^VIX3M', '^VIX6M', '^FVX', '^TNX', '^TYX'
|
|
|
68 |
|
69 |
|
70 |
def data_manipolation(df,ticker: str):
|
71 |
+
ticker = ticker.upper()
|
72 |
# MA calculation for all columns
|
73 |
New_Names=[ticker,'VIX','VIX_Index','VIX9D','VIX3M','VIX6M','T5Y','T10Y','T30Y']
|
74 |
for col in New_Names:
|
|
|
101 |
return df
|
102 |
|
103 |
def data_split_train_test(df,ticker: str):
|
104 |
+
ticker = ticker.upper()
|
105 |
X = df.loc[:,df.columns != ticker + '_c1']
|
106 |
y = df[ ticker + '_c1']
|
107 |
recent_data_size = int(0.3 * len(X)) # Adjust the percentage as needed
|
|
|
144 |
df=df.round(2)
|
145 |
Xtrain, ytrain, Xtest, ytest = data_split_train_test(df,ticker)
|
146 |
forecast_value = xgb_training_forecast(Xtrain, ytrain, Xtest, ytest).round(2)
|
147 |
+
forecast_value = str(forecast_value)
|
148 |
result = forecast_value.to_json(orient="records")
|
149 |
return result
|
150 |
|