Spaces:
Runtime error
Runtime error
mdj1412
commited on
Commit
·
c1654fa
1
Parent(s):
55c7203
demo
Browse files- app.py +1 -1
- dataset_creation/nasdaq_data.py +3 -8
- static/js/index.js +1 -8
app.py
CHANGED
|
@@ -128,7 +128,7 @@ def chart():
|
|
| 128 |
ticker = request.args.get('ticker')
|
| 129 |
|
| 130 |
# Implement Module
|
| 131 |
-
chart_data = get_data(tickers=[ticker], numOfDay=
|
| 132 |
|
| 133 |
# 날짜 형식 바꾸기
|
| 134 |
chart_data.index = [k.strftime("%Y-%m-%d") for k in chart_data.index]
|
|
|
|
| 128 |
ticker = request.args.get('ticker')
|
| 129 |
|
| 130 |
# Implement Module
|
| 131 |
+
chart_data = get_data(tickers=[ticker], numOfDay=60)[0]
|
| 132 |
|
| 133 |
# 날짜 형식 바꾸기
|
| 134 |
chart_data.index = [k.strftime("%Y-%m-%d") for k in chart_data.index]
|
dataset_creation/nasdaq_data.py
CHANGED
|
@@ -27,7 +27,7 @@ def get_list(tickers=nasdaq100_symbols):
|
|
| 27 |
ticker = demo_dic.loc[i, 'ticker']
|
| 28 |
|
| 29 |
# ticker의 주식 정보 데이터를 가져온다.
|
| 30 |
-
data = get_data(tickers=[ticker], numOfDay=
|
| 31 |
|
| 32 |
try:
|
| 33 |
yesterday = data.iloc[-2, 3]
|
|
@@ -75,18 +75,13 @@ def get_data(tickers=nasdaq100_symbols, numOfDay=2):#numOfDay: 날짜 간격
|
|
| 75 |
print("[ {} Finance Data ]".format(ticker))
|
| 76 |
ticker_yf = yf.Tickers(ticker)
|
| 77 |
|
| 78 |
-
|
| 79 |
abc = ticker_yf.tickers[ticker].history(start=start_date, end=end_date, period='max')
|
| 80 |
-
|
| 81 |
-
# abc = ticker_yf.tickers[ticker].history(period='max', interval='1m')
|
| 82 |
-
# abc = ticker_yf.tickers[ticker].history(start=start_date, end=end_date, interval='1m')
|
| 83 |
-
# abc = ticker_yf.tickers[ticker].history(start=start_date, end=end_date)
|
| 84 |
|
| 85 |
-
# print(abc)
|
| 86 |
-
# from IPython import embed; embed()
|
| 87 |
output.append(abc)
|
| 88 |
|
| 89 |
# print("Output : ", output)
|
|
|
|
|
|
|
| 90 |
return output
|
| 91 |
|
| 92 |
|
|
|
|
| 27 |
ticker = demo_dic.loc[i, 'ticker']
|
| 28 |
|
| 29 |
# ticker의 주식 정보 데이터를 가져온다.
|
| 30 |
+
data = get_data(tickers=[ticker], numOfDay=2)[0]
|
| 31 |
|
| 32 |
try:
|
| 33 |
yesterday = data.iloc[-2, 3]
|
|
|
|
| 75 |
print("[ {} Finance Data ]".format(ticker))
|
| 76 |
ticker_yf = yf.Tickers(ticker)
|
| 77 |
|
|
|
|
| 78 |
abc = ticker_yf.tickers[ticker].history(start=start_date, end=end_date, period='max')
|
|
|
|
|
|
|
|
|
|
|
|
|
| 79 |
|
|
|
|
|
|
|
| 80 |
output.append(abc)
|
| 81 |
|
| 82 |
# print("Output : ", output)
|
| 83 |
+
if len(output[0]) < numOfDay:
|
| 84 |
+
output = get_data(tickers, numOfDay+numOfDay-len(output[0]))
|
| 85 |
return output
|
| 86 |
|
| 87 |
|
static/js/index.js
CHANGED
|
@@ -31,9 +31,6 @@
|
|
| 31 |
// $(document).ready(function() { });
|
| 32 |
$(function() {
|
| 33 |
console.log("Start debug !!");
|
| 34 |
-
|
| 35 |
-
// 세 번째 인자 : 파이썬에서 return 값 처리
|
| 36 |
-
sendAjax("/submit", {"input_text": "This is a news article about Apple."}, handleOutput);
|
| 37 |
|
| 38 |
stocksInit();
|
| 39 |
calendarInit();
|
|
@@ -43,10 +40,6 @@ $(function() {
|
|
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
-
|
| 47 |
-
function handleOutput(output) {
|
| 48 |
-
console.log(output["output"]);
|
| 49 |
-
}
|
| 50 |
function handleReturn(output) {
|
| 51 |
// console.log("handle return ");
|
| 52 |
|
|
@@ -61,7 +54,7 @@ function handleReturn(output) {
|
|
| 61 |
|
| 62 |
function stocksInit() {
|
| 63 |
// Javascript -> Flask (Python) -> Javascript
|
| 64 |
-
output = sendAjax_async("/stocks", "json", handleReturn);
|
| 65 |
|
| 66 |
console.log("stocksInit() Output : ", output);
|
| 67 |
console.log(typeof output);
|
|
|
|
| 31 |
// $(document).ready(function() { });
|
| 32 |
$(function() {
|
| 33 |
console.log("Start debug !!");
|
|
|
|
|
|
|
|
|
|
| 34 |
|
| 35 |
stocksInit();
|
| 36 |
calendarInit();
|
|
|
|
| 40 |
|
| 41 |
|
| 42 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
function handleReturn(output) {
|
| 44 |
// console.log("handle return ");
|
| 45 |
|
|
|
|
| 54 |
|
| 55 |
function stocksInit() {
|
| 56 |
// Javascript -> Flask (Python) -> Javascript
|
| 57 |
+
output = sendAjax_async("/stocks", {}, "json", handleReturn);
|
| 58 |
|
| 59 |
console.log("stocksInit() Output : ", output);
|
| 60 |
console.log(typeof output);
|