Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
import yfinance as yf
|
| 3 |
+
|
| 4 |
+
st.set_page_config(page_title="Pocket Quant", page_icon="π")
|
| 5 |
+
st.title("π€ AI ν¬μ μλ¬Έκ° (Docker ver)")
|
| 6 |
+
|
| 7 |
+
ticker = st.text_input("μ’
λͺ© μ½λ (μ: TSLA, 005930.KS)", "TSLA")
|
| 8 |
+
|
| 9 |
+
if st.button("λΆμ μ€ν"):
|
| 10 |
+
try:
|
| 11 |
+
stock = yf.Ticker(ticker)
|
| 12 |
+
hist = stock.history(period="1mo")
|
| 13 |
+
|
| 14 |
+
if not hist.empty:
|
| 15 |
+
current = hist['Close'].iloc[-1]
|
| 16 |
+
st.metric("νμ¬ μ£Όκ°", f"{current:,.0f}")
|
| 17 |
+
st.line_chart(hist['Close'])
|
| 18 |
+
else:
|
| 19 |
+
st.error("λ°μ΄ν° μμ! ν°μ»€ νμΈ λ°λ.")
|
| 20 |
+
except Exception as e:
|
| 21 |
+
st.error(f"μλ¬: {e}")
|