Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -27,7 +27,7 @@ default_tickers = ['BTC-USD', 'ETH-USD', 'BNB-USD', 'JPM', 'BAC', 'WFC', 'C']
|
|
| 27 |
# Function to load adjusted close price data for a given ticker
|
| 28 |
def load_ticker_ts_df(ticker, start, end):
|
| 29 |
data = yf.download(ticker, start=start, end=end)
|
| 30 |
-
return data['
|
| 31 |
|
| 32 |
# Function to calculate cross-correlation at different lags
|
| 33 |
def cross_correlation(series1, series2, lag):
|
|
@@ -272,14 +272,11 @@ if page == 'Pairs Trading Analysis':
|
|
| 272 |
**ADF Test:**
|
| 273 |
- The Augmented Dickey-Fuller (ADF) test checks whether a time series has a unit root, i.e., whether it is non-stationary.
|
| 274 |
- If the p-value is less than 0.05, we reject the null hypothesis that the series has a unit root, indicating that the series is stationary.
|
| 275 |
-
|
| 276 |
**Johansen Cointegration Test:**
|
| 277 |
- The Johansen test is used to determine the number of cointegrating relationships among multiple time series.
|
| 278 |
- If the test statistic is greater than the critical value, we reject the null hypothesis that there is no cointegration.
|
| 279 |
-
|
| 280 |
**VECM (Vector Error Correction Model):**
|
| 281 |
- A VECM is a special form of a VAR (Vector Autoregression) model used for cointegrated series. It corrects for disequilibrium in the short run while keeping the long-term relationship intact.
|
| 282 |
-
|
| 283 |
**Z-Score Trading Strategy:**
|
| 284 |
- Z-scores measure how many standard deviations an element is from the mean. In pairs trading, z-scores are used to identify overbought or oversold conditions, triggering buy or sell signals.
|
| 285 |
""")
|
|
|
|
| 27 |
# Function to load adjusted close price data for a given ticker
|
| 28 |
def load_ticker_ts_df(ticker, start, end):
|
| 29 |
data = yf.download(ticker, start=start, end=end)
|
| 30 |
+
return data['Close']
|
| 31 |
|
| 32 |
# Function to calculate cross-correlation at different lags
|
| 33 |
def cross_correlation(series1, series2, lag):
|
|
|
|
| 272 |
**ADF Test:**
|
| 273 |
- The Augmented Dickey-Fuller (ADF) test checks whether a time series has a unit root, i.e., whether it is non-stationary.
|
| 274 |
- If the p-value is less than 0.05, we reject the null hypothesis that the series has a unit root, indicating that the series is stationary.
|
|
|
|
| 275 |
**Johansen Cointegration Test:**
|
| 276 |
- The Johansen test is used to determine the number of cointegrating relationships among multiple time series.
|
| 277 |
- If the test statistic is greater than the critical value, we reject the null hypothesis that there is no cointegration.
|
|
|
|
| 278 |
**VECM (Vector Error Correction Model):**
|
| 279 |
- A VECM is a special form of a VAR (Vector Autoregression) model used for cointegrated series. It corrects for disequilibrium in the short run while keeping the long-term relationship intact.
|
|
|
|
| 280 |
**Z-Score Trading Strategy:**
|
| 281 |
- Z-scores measure how many standard deviations an element is from the mean. In pairs trading, z-scores are used to identify overbought or oversold conditions, triggering buy or sell signals.
|
| 282 |
""")
|