OfirMatzlawi commited on
Commit
5b60579
1 Parent(s): f8afcf8

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +5 -5
main.py CHANGED
@@ -44,7 +44,7 @@ def read_root():
44
  def data_download(ticker: str):
45
  # Define the list of tickers
46
  index_list = [
47
- Ticker, '^VIX', '^VVIX', '^VIX9D', '^VIX3M', '^VIX6M', '^FVX', '^TNX', '^TYX'
48
  ]
49
 
50
  data = yf.download(index_list, start="1994-01-01", end=None)['Adj Close']
@@ -66,7 +66,7 @@ def data_download(ticker: str):
66
 
67
  def data_manipolation(df):
68
  # MA calculation for all columns
69
- New_Names=[Ticker,'VIX','VIX_Index','VIX9D','VIX3M','VIX6M','T5Y','T10Y','T30Y']
70
  for col in New_Names:
71
  df[col + "_MA30"] = df[col].rolling(window=30).mean().round(2)
72
  df[col + "/_MA30"] = (df[col]/df[col + "_MA30"]).round(4)
@@ -88,7 +88,7 @@ def data_manipolation(df):
88
  suffixes = ['_p', '_c1', '_MA30', '/_MA30']
89
  basic_cols = ['T5Y', 'T10Y', 'T30Y', 'VIX']
90
  to_keep = basic_cols + [f"{col}{suffix}" for col in basic_cols for suffix in suffixes]
91
- ticker_columns = [Ticker + suffix for suffix in ['_c1']]
92
  to_keep.extend(ticker_columns)
93
 
94
  # Filter the DataFrame to keep only specified columns and drop rows with missing values
@@ -97,8 +97,8 @@ def data_manipolation(df):
97
  return df
98
 
99
  def data_split_train_test(df):
100
- X = df.loc[:,df.columns != Ticker + '_c1']
101
- y = df[ Ticker + '_c1']
102
  recent_data_size = int(0.3 * len(X)) # Adjust the percentage as needed
103
  print (recent_data_size)
104
 
 
44
  def data_download(ticker: str):
45
  # Define the list of tickers
46
  index_list = [
47
+ ticker, '^VIX', '^VVIX', '^VIX9D', '^VIX3M', '^VIX6M', '^FVX', '^TNX', '^TYX'
48
  ]
49
 
50
  data = yf.download(index_list, start="1994-01-01", end=None)['Adj Close']
 
66
 
67
  def data_manipolation(df):
68
  # MA calculation for all columns
69
+ New_Names=[ticker,'VIX','VIX_Index','VIX9D','VIX3M','VIX6M','T5Y','T10Y','T30Y']
70
  for col in New_Names:
71
  df[col + "_MA30"] = df[col].rolling(window=30).mean().round(2)
72
  df[col + "/_MA30"] = (df[col]/df[col + "_MA30"]).round(4)
 
88
  suffixes = ['_p', '_c1', '_MA30', '/_MA30']
89
  basic_cols = ['T5Y', 'T10Y', 'T30Y', 'VIX']
90
  to_keep = basic_cols + [f"{col}{suffix}" for col in basic_cols for suffix in suffixes]
91
+ ticker_columns = [ticker + suffix for suffix in ['_c1']]
92
  to_keep.extend(ticker_columns)
93
 
94
  # Filter the DataFrame to keep only specified columns and drop rows with missing values
 
97
  return df
98
 
99
  def data_split_train_test(df):
100
+ X = df.loc[:,df.columns != ticker + '_c1']
101
+ y = df[ ticker + '_c1']
102
  recent_data_size = int(0.3 * len(X)) # Adjust the percentage as needed
103
  print (recent_data_size)
104