Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import yfinance as yf
|
3 |
+
from TradingPatternScanner import TradingPatternScanner
|
4 |
+
|
5 |
+
def main():
|
6 |
+
st.title("Trading Pattern Detection App")
|
7 |
+
|
8 |
+
# Sidebar for user input
|
9 |
+
stock_symbol = st.sidebar.text_input("Enter Stock Symbol", value='AAPL')
|
10 |
+
period = st.sidebar.selectbox("Select Period", ['1d', '1mo', '3mo', '6mo', '1y'])
|
11 |
+
|
12 |
+
# Download latest available data using yfinance
|
13 |
+
data = yf.download(stock_symbol, period=period)
|
14 |
+
|
15 |
+
# Use TradingPatternScanner library
|
16 |
+
scanner = TradingPatternScanner()
|
17 |
+
|
18 |
+
# Detect patterns using the library
|
19 |
+
result = scanner.detect_patterns(data)
|
20 |
+
|
21 |
+
# Display the result
|
22 |
+
st.write("## Result:")
|
23 |
+
st.write(result)
|
24 |
+
|
25 |
+
if __name__ == "__main__":
|
26 |
+
main()
|