Spaces:
Runtime error
Runtime error
mdj1412
commited on
Commit
Β·
e9359a3
1
Parent(s):
2a479da
delete unnecessary files
Browse files- static/css/chartStyle.css +0 -132
- static/css/news.css +0 -216
- static/js/chartIndex.js +0 -169
- static/js/index.js +12 -16
- static/js/news.js +0 -182
- templates/chart.html +0 -116
static/css/chartStyle.css
DELETED
@@ -1,132 +0,0 @@
|
|
1 |
-
/* id : "#" */
|
2 |
-
.myChart-container {
|
3 |
-
/* μμ±μ μμ λλΉλ₯Ό μ§μ */
|
4 |
-
width: 60vw;
|
5 |
-
|
6 |
-
/* μμ±μ μμμ λμ΄λ₯Ό μ§μ */
|
7 |
-
height: 30vh;
|
8 |
-
|
9 |
-
/*
|
10 |
-
[ margin νκ·Έ ]
|
11 |
-
margin-top (μλ¨ μ¬λ°±)
|
12 |
-
margin-right (μ€λ₯Έμͺ½ μ¬λ°±)
|
13 |
-
margin-bottom (μλ μ¬λ°±)
|
14 |
-
margin-left (μΌμͺ½ μ¬λ°±)
|
15 |
-
|
16 |
-
μ§μ κ°μ px, cm, %λ‘ μ§μ ν μ μλ€.
|
17 |
-
μμκ°λ μ§μ κ°λ₯(ex. -10px)
|
18 |
-
|
19 |
-
* 4λ©΄ νκΊΌλ²μ margin μ§μ νκΈ°
|
20 |
-
ex) margin: 5px 7px 3px 0px;
|
21 |
-
(μ, μ€λ₯Έμͺ½, μλ, μΌμͺ½)
|
22 |
-
* 4λ©΄μ΄ λͺ¨λ κ°μ λ margin μ§μ νκΈ°
|
23 |
-
ex) margin: 5px;
|
24 |
-
* μ, μ€λ₯Έμͺ½&μΌμͺ½, μλ margin μ§μ νκΈ°
|
25 |
-
ex) margin: 5px 10px 0px;
|
26 |
-
* μ&μλ, μ€λ₯Έμͺ½&μΌμͺ½ margin μ§μ νκΈ°
|
27 |
-
ex) margin: 5px 10px;
|
28 |
-
* margin μλ μ§μ νκΈ°
|
29 |
-
ex) margin: auto 0;
|
30 |
-
(μμλ κ°μ΄ μλ, μ’μ°κ° 0px)
|
31 |
-
ex) margin-left: auto;
|
32 |
-
|
33 |
-
*/
|
34 |
-
margin: 40px auto;
|
35 |
-
padding-bottom: 13%;
|
36 |
-
}
|
37 |
-
|
38 |
-
|
39 |
-
.table {
|
40 |
-
/*
|
41 |
-
[ align-items νκ·Έ ]
|
42 |
-
flex-box μμμ μμ§ λ°©ν₯ μ λ ¬ λ°©μμ μ€μ
|
43 |
-
ex. flex-start, flex-end, center
|
44 |
-
*/
|
45 |
-
align-items: center;
|
46 |
-
|
47 |
-
/*
|
48 |
-
[ justify-content νκ·Έ ]
|
49 |
-
flex-box μμμ μν λ°©ν₯ μ λ ¬ λ°©μμ μ€μ
|
50 |
-
ex. flex-start, flex-end, center
|
51 |
-
*/
|
52 |
-
justify-content: center;
|
53 |
-
|
54 |
-
|
55 |
-
/*
|
56 |
-
[ margin νκ·Έ ]
|
57 |
-
margin-top (μλ¨ μ¬λ°±)
|
58 |
-
margin-right (μ€λ₯Έμͺ½ μ¬λ°±)
|
59 |
-
margin-bottom (μλ μ¬λ°±)
|
60 |
-
margin-left (μΌμͺ½ μ¬λ°±)
|
61 |
-
|
62 |
-
μ§μ κ°μ px, cm, %λ‘ μ§μ ν μ μλ€.
|
63 |
-
μμκ°λ μ§μ κ°λ₯(ex. -10px)
|
64 |
-
|
65 |
-
* 4λ©΄ νκΊΌλ²μ margin μ§μ νκΈ°
|
66 |
-
ex) margin: 5px 7px 3px 0px;
|
67 |
-
(μ, μ€λ₯Έμͺ½, μλ, μΌμͺ½)
|
68 |
-
* 4λ©΄μ΄ λͺ¨λ κ°μ λ margin μ§μ νκΈ°
|
69 |
-
ex) margin: 5px;
|
70 |
-
* μ, μ€λ₯Έμͺ½&μΌμͺ½, μλ margin μ§μ νκΈ°
|
71 |
-
ex) margin: 5px 10px 0px;
|
72 |
-
* μ&μλ, μ€λ₯Έμͺ½&μΌμͺ½ margin μ§μ νκΈ°
|
73 |
-
ex) margin: 5px 10px;
|
74 |
-
* margin μλ μ§μ νκΈ°
|
75 |
-
ex) margin: auto 0;
|
76 |
-
(μμλ κ°μ΄ μλ, μ’μ°κ° 0px)
|
77 |
-
ex) margin-left: auto;
|
78 |
-
|
79 |
-
*/
|
80 |
-
margin: 20px auto;
|
81 |
-
|
82 |
-
|
83 |
-
/*
|
84 |
-
[ text-align νκ·Έ ]
|
85 |
-
ν
μ€νΈμ μ λ ¬ λ°©ν₯μ μ€μ
|
86 |
-
|
87 |
-
left: μΌμͺ½ μ λ ¬
|
88 |
-
right: μ€λ₯Έμͺ½ μ λ ¬
|
89 |
-
center: μ€μ μ λ ¬
|
90 |
-
justify: μμͺ½ μ λ ¬ (μλ μ€λ°κΏμ μ€λ₯Έμͺ½ κ²½κ³μ λΆλΆ μ 리)
|
91 |
-
*/
|
92 |
-
text-align: center;
|
93 |
-
|
94 |
-
|
95 |
-
padding-top: 50px;
|
96 |
-
}
|
97 |
-
|
98 |
-
|
99 |
-
.table .title-width {
|
100 |
-
width: 10px;
|
101 |
-
text-align: center;
|
102 |
-
}
|
103 |
-
|
104 |
-
|
105 |
-
.table .table-title {
|
106 |
-
font-size: 50px;
|
107 |
-
}
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
/* h1, h2 νκ·Έ λΆλΆ */
|
121 |
-
.gohome, .goticker {
|
122 |
-
text-decoration: none;
|
123 |
-
}
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
.table .news-table .news.diff.up {
|
128 |
-
color: #ed2a61;
|
129 |
-
}
|
130 |
-
.table .news-table .news.diff.down {
|
131 |
-
color: #3c6ffa;
|
132 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static/css/news.css
DELETED
@@ -1,216 +0,0 @@
|
|
1 |
-
/* ner κ΄λ ¨ */
|
2 |
-
|
3 |
-
.ner-box {
|
4 |
-
width: calc(92%); /* μμ±μ μμ λλΉλ₯Ό μ§μ */
|
5 |
-
height: 500px; /* μμ±μ μμμ λμ΄λ₯Ό μ§μ */
|
6 |
-
|
7 |
-
|
8 |
-
/*
|
9 |
-
[ align-items νκ·Έ ]
|
10 |
-
flex-box μμμ μμ§ λ°©ν₯ μ λ ¬ λ°©μμ μ€μ
|
11 |
-
ex. flex-start, flex-end, center
|
12 |
-
*/
|
13 |
-
align-items: center;
|
14 |
-
|
15 |
-
/*
|
16 |
-
[ justify-content νκ·Έ ]
|
17 |
-
flex-box μμμ μν λ°©ν₯ μ λ ¬ λ°©μμ μ€μ
|
18 |
-
ex. flex-start, flex-end, center
|
19 |
-
*/
|
20 |
-
justify-content: center;
|
21 |
-
|
22 |
-
/*
|
23 |
-
[ text-align νκ·Έ ]
|
24 |
-
ν
μ€νΈμ μ λ ¬ λ°©ν₯μ μ€μ
|
25 |
-
|
26 |
-
left: μΌμͺ½ μ λ ¬
|
27 |
-
right: μ€λ₯Έμͺ½ μ λ ¬
|
28 |
-
center: μ€μ μ λ ¬
|
29 |
-
justify: μμͺ½ μ λ ¬ (μλ μ€λ°κΏμ μ€λ₯Έμͺ½ κ²½κ³μ λΆλΆ μ 리)
|
30 |
-
*/
|
31 |
-
text-align: center;
|
32 |
-
|
33 |
-
|
34 |
-
/*
|
35 |
-
[ margin νκ·Έ ]
|
36 |
-
margin-top (μλ¨ μ¬λ°±)
|
37 |
-
margin-right (μ€λ₯Έμͺ½ μ¬λ°±)
|
38 |
-
margin-bottom (μλ μ¬λ°±)
|
39 |
-
margin-left (μΌμͺ½ μ¬λ°±)
|
40 |
-
|
41 |
-
μ§μ κ°μ px, cm, %λ‘ μ§μ ν μ μλ€.
|
42 |
-
μμκ°λ μ§μ κ°λ₯(ex. -10px)
|
43 |
-
|
44 |
-
* 4λ©΄ νκΊΌλ²μ margin μ§μ νκΈ°
|
45 |
-
ex) margin: 5px 7px 3px 0px;
|
46 |
-
(μ, μ€λ₯Έμͺ½, μλ, μΌμͺ½)
|
47 |
-
* 4λ©΄μ΄ λͺ¨λ κ°μ λ margin μ§μ νκΈ°
|
48 |
-
ex) margin: 5px;
|
49 |
-
* μ, μ€λ₯Έμͺ½&μΌμͺ½, μλ margin μ§μ νκΈ°
|
50 |
-
ex) margin: 5px 10px 0px;
|
51 |
-
* μ&μλ, μ€λ₯Έμͺ½&μΌμͺ½ margin μ§μ νκΈ°
|
52 |
-
ex) margin: 5px 10px;
|
53 |
-
* margin μλ μ§μ νκΈ°
|
54 |
-
ex) margin: auto 0;
|
55 |
-
(μμλ κ°μ΄ μλ, μ’μ°κ° 0px)
|
56 |
-
ex) margin-left: auto;
|
57 |
-
|
58 |
-
*/
|
59 |
-
margin: 1rem;
|
60 |
-
|
61 |
-
|
62 |
-
min-height: 1.2rem;
|
63 |
-
border: 0.5px solid grey;
|
64 |
-
padding: 0.5rem 1rem;
|
65 |
-
}
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
/* NER label_ */
|
70 |
-
.entities .entity_person {
|
71 |
-
background-color: #aa9cfc;
|
72 |
-
}
|
73 |
-
|
74 |
-
.entities .entity_org {
|
75 |
-
background-color: #7aecec;
|
76 |
-
}
|
77 |
-
|
78 |
-
.entities .entity_fac {
|
79 |
-
background-color: #9cc9cc;
|
80 |
-
}
|
81 |
-
|
82 |
-
.entities .entity_gpe {
|
83 |
-
background-color: #feca74;
|
84 |
-
}
|
85 |
-
|
86 |
-
.entities .entity_product {
|
87 |
-
background-color: #bfeeb7;
|
88 |
-
}
|
89 |
-
|
90 |
-
.entities .none {
|
91 |
-
background-color: transparent;
|
92 |
-
}
|
93 |
-
|
94 |
-
/* λ§μ°μ€ μ¬λ Έμ λ, 보μ΄κ² νλ κ² */
|
95 |
-
.entities .show-label {
|
96 |
-
display: none;
|
97 |
-
}
|
98 |
-
|
99 |
-
.entities .entity_person:hover .show-label,
|
100 |
-
.entities .entity_org:hover .show-label,
|
101 |
-
.entities .entity_fac:hover .show-label,
|
102 |
-
.entities .entity_gpe:hover .show-label,
|
103 |
-
.entities .entity_product:hover .show-label {
|
104 |
-
display: block;
|
105 |
-
}
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
/* Model κ΄λ ¨ */
|
112 |
-
|
113 |
-
/* id : "#" */
|
114 |
-
#model {
|
115 |
-
/*
|
116 |
-
[ text-align νκ·Έ ]
|
117 |
-
ν
μ€νΈμ μ λ ¬ λ°©ν₯μ μ€μ
|
118 |
-
|
119 |
-
left: μΌμͺ½ μ λ ¬
|
120 |
-
right: μ€λ₯Έμͺ½ μ λ ¬
|
121 |
-
center: μ€μ μ λ ¬
|
122 |
-
justify: μμͺ½ μ λ ¬ (μλ μ€λ°κΏμ μ€λ₯Έμͺ½ κ²½κ³μ λΆλΆ μ 리)
|
123 |
-
*/
|
124 |
-
text-align: center;
|
125 |
-
}
|
126 |
-
|
127 |
-
/* id : "#" */
|
128 |
-
#text-input {
|
129 |
-
width: calc(100% / 2); /* μμ±μ μμ λλΉ */
|
130 |
-
height: 78px; /* μμ±μ μμμ λμ΄λ₯Ό μ§μ */
|
131 |
-
word-break: break-all;
|
132 |
-
}
|
133 |
-
|
134 |
-
|
135 |
-
.text-output {
|
136 |
-
width: calc(100% * (2/3)); /* μμ±μ μμ λλΉ */
|
137 |
-
min-height: 10rem;
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
/*
|
142 |
-
[ margin νκ·Έ ]
|
143 |
-
margin-top (μλ¨ μ¬λ°±)
|
144 |
-
margin-right (μ€λ₯Έμͺ½ μ¬λ°±)
|
145 |
-
margin-bottom (μλ μ¬λ°±)
|
146 |
-
margin-left (μΌμͺ½ μ¬λ°±)
|
147 |
-
|
148 |
-
μ§μ κ°μ px, cm, %λ‘ μ§μ ν μ μλ€.
|
149 |
-
μμκ°λ μ§μ κ°λ₯(ex. -10px)
|
150 |
-
|
151 |
-
* 4λ©΄ νκΊΌλ²μ margin μ§μ νκΈ°
|
152 |
-
ex) margin: 5px 7px 3px 0px;
|
153 |
-
(μ, μ€λ₯Έμͺ½, μλ, μΌμͺ½)
|
154 |
-
* 4λ©΄μ΄ λͺ¨λ κ°μ λ margin μ§μ νκΈ°
|
155 |
-
ex) margin: 5px;
|
156 |
-
* μ, μ€λ₯Έμͺ½&μΌμͺ½, μλ margin μ§μ νκΈ°
|
157 |
-
ex) margin: 5px 10px 0px;
|
158 |
-
* μ&μλ, μ€λ₯Έμͺ½&μΌμͺ½ margin μ§μ νκΈ°
|
159 |
-
ex) margin: 5px 10px;
|
160 |
-
* margin μλ μ§μ νκΈ°
|
161 |
-
ex) margin: auto 0;
|
162 |
-
(μμλ κ°μ΄ μλ, μ’μ°κ° 0px)
|
163 |
-
ex) margin-left: auto;
|
164 |
-
|
165 |
-
*/
|
166 |
-
margin: 20px auto;
|
167 |
-
|
168 |
-
/*
|
169 |
-
[ border νκ·Έ ]
|
170 |
-
ν΄λΉ νκ·Έμ ν
λ리λ₯Ό μ€μ
|
171 |
-
width - style - color
|
172 |
-
border-width - border-style - border-color
|
173 |
-
|
174 |
-
border-width : ν
λ리μ λκ»λ‘, μ£Όλ‘ px λ¨μλ₯Ό μ¬μ©
|
175 |
-
border-style : ν
λ리μ μ€νμΌλ‘ μ€μ , μ μ , μ΄μ€μ λ±μ μ΅μ
μ΄ μ‘΄μ¬
|
176 |
-
border-color : ν
λ리μ μμμΌλ‘, κ°μ color μμ±μ ν¬λ§·μ μ¬μ©
|
177 |
-
*/
|
178 |
-
border: 0.5px solid grey;
|
179 |
-
|
180 |
-
/*
|
181 |
-
[ padding νκ·Έ ]
|
182 |
-
μ§μ κ°μ px, cm, %λ‘ μ§μ ν μ μλ€.
|
183 |
-
marginμ μμκ°μ΄ μ§μ κ°λ₯νμ§λ§ paddingμ μμκ° μ§μ μ΄ μλλ€.
|
184 |
-
|
185 |
-
padding νκ·Έμ λΉμ·ν νκ·Έ
|
186 |
-
: padding-top, padding-right, padding-bottom, padding-left
|
187 |
-
|
188 |
-
* 4λ©΄ νκΊΌλ²μ padding μ§μ νκΈ°
|
189 |
-
ex) padding: 5px, 7px, 3px, 0px;
|
190 |
-
(μ, μ€λ₯ΈοΏ½οΏ½οΏ½, μλ, μΌμͺ½)
|
191 |
-
* 4λ©΄ λͺ¨λ κ°μ λ padding μ§μ νκΈ°
|
192 |
-
ex) padding: 5px;
|
193 |
-
* μ, μ€λ₯Έμͺ½&μΌμͺ½, μλ padding μ§μ νκΈ°
|
194 |
-
ex) padding: 5px 10px 0px;
|
195 |
-
* μ&μλ, μ€λ₯Έμͺ½&μΌμͺ½ padding μ§μ νκΈ°
|
196 |
-
ex) padding: 5px, 10px;
|
197 |
-
|
198 |
-
*/
|
199 |
-
padding: 0.5rem 1rem;
|
200 |
-
}
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
/* h1, h2 νκ·Έ λΆλΆ */
|
214 |
-
.gohome, .goticker {
|
215 |
-
text-decoration: none;
|
216 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static/js/chartIndex.js
DELETED
@@ -1,169 +0,0 @@
|
|
1 |
-
|
2 |
-
// jQuery
|
3 |
-
// $(document).ready(function() { });
|
4 |
-
$(function() {
|
5 |
-
chartInit();
|
6 |
-
});
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
function chartInit() {
|
11 |
-
// Ticker μ΄λ¦ κ°μ Έμ€κΈ°
|
12 |
-
// ν΄λΉ classμ text κ°μ Έμ€κΈ°
|
13 |
-
let ticker = document.querySelector('.tickerName').textContent;
|
14 |
-
// console.log(ticker.indexOf(' '));
|
15 |
-
idx = ticker.indexOf(' ');
|
16 |
-
ticker = ticker.substring(0, idx);
|
17 |
-
|
18 |
-
|
19 |
-
// Javascript -> Flask (Python) -> Javascript
|
20 |
-
chart_data = sendAjax_sync("/chart", {"ticker": ticker}, "json", handle_one_return);
|
21 |
-
console.log(chart_data);
|
22 |
-
console.log(Object.keys(chart_data.Close));
|
23 |
-
|
24 |
-
|
25 |
-
// xμΆκ³Ό data μ€μ
|
26 |
-
// data: [{'x': date, 'o': open, 'h': high, 'l': low, 'c': close}, { }, { }, ... ]
|
27 |
-
data = [];
|
28 |
-
key_list = Object.keys(chart_data.Close);
|
29 |
-
for (var i=key_list.length-15; i<key_list.length; i++) {
|
30 |
-
key = key_list[i];
|
31 |
-
const [year, month, day] = key.split("-");
|
32 |
-
const x = new Date(parseInt(year), parseInt(month), parseInt(day), 9, 0, 0, 0).getTime();
|
33 |
-
data.push({'x': x, 'o': chart_data.Open[key].toFixed(2), 'h': chart_data.High[key].toFixed(2), 'l': chart_data.Low[key].toFixed(2), 'c': chart_data.Close[key].toFixed(2)})
|
34 |
-
}
|
35 |
-
console.log("data : ", data);
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
// Javascript chart.js candlestick
|
41 |
-
let mychart = document.getElementById('myChart');
|
42 |
-
new Chart(mychart, {
|
43 |
-
type: 'candlestick',
|
44 |
-
data: {
|
45 |
-
datasets: [{
|
46 |
-
label: 'CHRT - '.concat(ticker),
|
47 |
-
data: data
|
48 |
-
}]
|
49 |
-
}
|
50 |
-
});
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
//////////////////////////////////////////////////////////////////
|
57 |
-
|
58 |
-
// Javascriptλ₯Ό μ΄μ©ν΄ HTMLμ λμ μΌλ‘ νκ·Έ μΆκ°
|
59 |
-
|
60 |
-
// a νκ·Έ onclick μ μ©
|
61 |
-
const goTicker = document.querySelector('.goticker');
|
62 |
-
let goTickerURL = '/'.concat(ticker)
|
63 |
-
goTicker.setAttribute('href', goTickerURL);
|
64 |
-
|
65 |
-
//////////////////////////////////////////////////////////////////
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
//////////////////////////////////////////////////////////////////
|
72 |
-
|
73 |
-
// table title νμ
|
74 |
-
// ν΄λΉ classμ text μ§μ΄λ£κΈ°
|
75 |
-
const table_title = document.querySelector('.table-title');
|
76 |
-
$('.table .table-title').text(ticker.concat(' News'));
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
// Javascript -> Flask (Python) -> Javascript
|
82 |
-
news = sendAjax_sync(url="/news", data={"ticker": ticker}, dataType="json", handle=handle_one_return);
|
83 |
-
|
84 |
-
news_table = document.querySelector('.table .news-table');
|
85 |
-
// console.log(news_table.innerHTML);
|
86 |
-
|
87 |
-
|
88 |
-
// console.log(news);
|
89 |
-
// console.log(Object.keys(news)); // key λ°°μ΄ λ§λ€κΈ°
|
90 |
-
// console.log(typeof Object.keys(news));
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
/*
|
96 |
-
[ λ μ§ μ λ ¬ ]
|
97 |
-
"news"μμ indexμ λν΄μ μ λ ¬μ νκ³ reduce() ν¨μλ₯Ό μ μ©.
|
98 |
-
|
99 |
-
reduce() : λ°°μ΄μ κ° μμμ λν΄ μ£Όμ΄μ§ reducer ν¨μλ₯Ό μ€ννκ³ , νλμ κ²°κ³Όκ°μ λ°ν
|
100 |
-
*/
|
101 |
-
sorted_news = {}
|
102 |
-
sorted_news = Object.keys(news).sort(function (a, b) {
|
103 |
-
if (a < b) { return 1; }
|
104 |
-
else if (a > b) { return -1; }
|
105 |
-
else { return 0; }
|
106 |
-
}).reduce((sorted_news, key) => {
|
107 |
-
sorted_news[key] = news[key];
|
108 |
-
return sorted_news;
|
109 |
-
}, {});
|
110 |
-
// console.log(sorted_news);
|
111 |
-
|
112 |
-
var key_list = Object.keys(chart_data.Open);
|
113 |
-
var open_list = Object.values(chart_data.Open);
|
114 |
-
var close_list = Object.values(chart_data.Close);
|
115 |
-
|
116 |
-
for (var i=0; i<key_list.length; i++) {
|
117 |
-
const [year, month, day] = key_list[i].split("-");
|
118 |
-
key_list[i] = year + '.' + month + '.' + day;
|
119 |
-
}
|
120 |
-
console.log(key_list);
|
121 |
-
|
122 |
-
// List μμ valueλ₯Ό λ½μ λ, (Python) => for item in list:
|
123 |
-
Object.keys(sorted_news).forEach(key => {
|
124 |
-
var idx = key_list.indexOf(String(key));
|
125 |
-
|
126 |
-
if (idx != -1) { var diff = ((open_list[idx]-close_list[idx-1])/(open_list[idx]) * 100.0).toFixed(2); }
|
127 |
-
else { var diff = '.'; }
|
128 |
-
|
129 |
-
if (diff == '.') {
|
130 |
-
var diff_html = '<th class="news diff">' + diff + '</th>';
|
131 |
-
}
|
132 |
-
else if (diff > 0) {
|
133 |
-
var diff_html = '<th class="news diff up">+' + diff + ' %</th>';
|
134 |
-
}
|
135 |
-
else {
|
136 |
-
var diff_html = '<th class="news diff down">' + diff + ' %</th>';
|
137 |
-
}
|
138 |
-
var html = '<tr align="center" bgcolor="white"><th>+</th><th>' + key + '</th>' + diff_html + '<td style="text-align: left;">';
|
139 |
-
|
140 |
-
for (var i = 0; i < sorted_news[key].length; i++) {
|
141 |
-
var title = sorted_news[key][i].substring(0, sorted_news[key][i].length-4);
|
142 |
-
var sendTitle = title; // Javascript -> Python 보λ΄κΈ° μν title
|
143 |
-
|
144 |
-
|
145 |
-
// titleμμ & νμκ° μμ μ μμ.
|
146 |
-
// Title μμ '&'λ‘ νμλμ΄ μλλ° λ°λ‘ ꡬλ³ν΄μΌ λλ€.
|
147 |
-
// andSymbolInTitle μμ κ°μ Έμ¨ '&' μμΉ indexλ₯Ό titleκ³Ό ν©μ³μ€λ€.
|
148 |
-
andSymbolInTitle = [];
|
149 |
-
let idx = 0;
|
150 |
-
// title = "asdf&asdf&AS&DF&&";
|
151 |
-
// sendTitle = title;
|
152 |
-
|
153 |
-
while (true) {
|
154 |
-
idx = sendTitle.indexOf('&', idx);
|
155 |
-
if (idx == -1) { break; }
|
156 |
-
sendTitle = sendTitle.substring(0, idx) + sendTitle.substring(idx+1, sendTitle.length);
|
157 |
-
// console.log(sendTitle);
|
158 |
-
andSymbolInTitle.push(idx + andSymbolInTitle.length);
|
159 |
-
}
|
160 |
-
|
161 |
-
var link = String('"/info?ticker='.concat(ticker, '&date=', key, '&title=', sendTitle, '&andSymbolInTitle=', andSymbolInTitle, '"'));
|
162 |
-
// console.log(link);
|
163 |
-
html = html + '<a href=' + link + '>' + title + '</a><br>';
|
164 |
-
}
|
165 |
-
html = html + '</td>';
|
166 |
-
|
167 |
-
news_table.innerHTML = news_table.innerHTML + html;
|
168 |
-
});
|
169 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static/js/index.js
CHANGED
@@ -102,10 +102,10 @@ function nasdaq_table_init() {
|
|
102 |
stocks.innerHTML = stocks.innerHTML + '<div class="stock industry">' + output.industry[i] + '</div>';
|
103 |
|
104 |
// Add ticker's chart link
|
105 |
-
execution_function =
|
106 |
stock = document.querySelectorAll('.stock.ticker')[i];
|
107 |
stock.innerHTML = '';
|
108 |
-
stock.innerHTML = stock.innerHTML +
|
109 |
}
|
110 |
}
|
111 |
|
@@ -149,9 +149,6 @@ function chartInit(ticker) {
|
|
149 |
const x = new Date(parseInt(year), parseInt(month), parseInt(day), 9, 0, 0, 0).getTime();
|
150 |
data.push({'x': x, 'o': chart_data.Open[key].toFixed(2), 'h': chart_data.High[key].toFixed(2), 'l': chart_data.Low[key].toFixed(2), 'c': chart_data.Close[key].toFixed(2)})
|
151 |
}
|
152 |
-
// console.log("data : ", data);
|
153 |
-
|
154 |
-
|
155 |
|
156 |
|
157 |
// Javascript chart.js candlestick
|
@@ -165,8 +162,7 @@ function chartInit(ticker) {
|
|
165 |
}]
|
166 |
}
|
167 |
});
|
168 |
-
|
169 |
-
|
170 |
|
171 |
|
172 |
|
@@ -244,7 +240,9 @@ function chartInit(ticker) {
|
|
244 |
var date_idx_in_key_list = key_list.indexOf(String(key));
|
245 |
// console.log(key, key_list, date_idx_in_key_list);
|
246 |
|
247 |
-
if (date_idx_in_key_list != -1) {
|
|
|
|
|
248 |
else { var diff = '.'; }
|
249 |
|
250 |
if (diff == '.') {
|
@@ -256,7 +254,7 @@ function chartInit(ticker) {
|
|
256 |
else {
|
257 |
var diff_html = '<th class="news diff down">' + diff + ' %</th>';
|
258 |
}
|
259 |
-
var html = `<tr align="center" bgcolor="white"><th>+</th><th>${key}</th>${diff_html}<td style="text-align: left;">`;
|
260 |
|
261 |
for (var i = 0; i < sorted_news[key].length; i++) {
|
262 |
var title = sorted_news[key][i].substring(0, sorted_news[key][i].length-4);
|
@@ -280,13 +278,11 @@ function chartInit(ticker) {
|
|
280 |
}
|
281 |
|
282 |
|
283 |
-
var link = String(`/info_and_newsNER?ticker=${ticker}&date=${key}&title=${sendTitle}&andSymbolInTitle=${andSymbolInTitle}`);
|
284 |
-
// console.log(link);
|
285 |
linkList.push(link);
|
286 |
|
287 |
-
var execution_function = String(`javascript:getData(linkList[${link_list_idx}]);`);
|
288 |
-
|
289 |
-
html = html + '<a href="' + execution_function + '">' + title + '</a><br>';
|
290 |
link_list_idx = link_list_idx + 1;
|
291 |
}
|
292 |
html = html + '</td>';
|
@@ -356,7 +352,7 @@ function newsInit(ticker, date, title, url, ents) {
|
|
356 |
|
357 |
|
358 |
// a νκ·Έ onclick μ μ©
|
359 |
-
var execution_function = `javascript:chartInit('${ticker}')`;
|
360 |
const goTicker = document.querySelector('#news-container .goticker');
|
361 |
console.log(goTicker);
|
362 |
goTicker.setAttribute('href', execution_function);
|
@@ -448,7 +444,7 @@ function newsInit(ticker, date, title, url, ents) {
|
|
448 |
// "await"λ "async" ν¨μ μμμλ§ λμνλ€.
|
449 |
// "await" ν€μλλ₯Ό λ§λλ©΄ Promiseκ° μ²λ¦¬λ λκΉμ§ κΈ°λ€λ¦°λ€.
|
450 |
// Promiseκ° μ²λ¦¬λκΈΈ κΈ°λ€λ¦¬λ λμμ μμ§μ΄ λ€λ₯ΈμΌ(λ€λ₯Έ μ€ν¬λ¦½νΈλ₯Ό μ€ν, μ΄λ²€νΈ μ²λ¦¬ λ±)μ ν μ μκΈ° λλ¬Έμ, CPU 리μμ€κ° λλΉλμ§ μλλ€.
|
451 |
-
const inferResponse = await fetch(`newsQuestions?ticker=${ticker}&date=${date}&title=${sendTitle}&andSymbolInTitle=${andSymbolInTitle}&questions=${text}`); // Javascript -> Flask(python)
|
452 |
|
453 |
// console.log("inferResponse : ", inferResponse);
|
454 |
|
|
|
102 |
stocks.innerHTML = stocks.innerHTML + '<div class="stock industry">' + output.industry[i] + '</div>';
|
103 |
|
104 |
// Add ticker's chart link
|
105 |
+
execution_function = `javascript:chartInit('${ output.ticker[i] }')`;
|
106 |
stock = document.querySelectorAll('.stock.ticker')[i];
|
107 |
stock.innerHTML = '';
|
108 |
+
stock.innerHTML = stock.innerHTML + `<a href=${ execution_function }>${ output.ticker[i] }</a>`;
|
109 |
}
|
110 |
}
|
111 |
|
|
|
149 |
const x = new Date(parseInt(year), parseInt(month), parseInt(day), 9, 0, 0, 0).getTime();
|
150 |
data.push({'x': x, 'o': chart_data.Open[key].toFixed(2), 'h': chart_data.High[key].toFixed(2), 'l': chart_data.Low[key].toFixed(2), 'c': chart_data.Close[key].toFixed(2)})
|
151 |
}
|
|
|
|
|
|
|
152 |
|
153 |
|
154 |
// Javascript chart.js candlestick
|
|
|
162 |
}]
|
163 |
}
|
164 |
});
|
165 |
+
//////////////////////////////////////////////////////////////////
|
|
|
166 |
|
167 |
|
168 |
|
|
|
240 |
var date_idx_in_key_list = key_list.indexOf(String(key));
|
241 |
// console.log(key, key_list, date_idx_in_key_list);
|
242 |
|
243 |
+
if (date_idx_in_key_list != -1) {
|
244 |
+
var diff = ((open_list[date_idx_in_key_list]-close_list[date_idx_in_key_list-1])/(open_list[date_idx_in_key_list]) * 100.0).toFixed(2);
|
245 |
+
}
|
246 |
else { var diff = '.'; }
|
247 |
|
248 |
if (diff == '.') {
|
|
|
254 |
else {
|
255 |
var diff_html = '<th class="news diff down">' + diff + ' %</th>';
|
256 |
}
|
257 |
+
var html = `<tr align="center" bgcolor="white"><th>+</th><th>${ key }</th>${ diff_html }<td style="text-align: left;">`;
|
258 |
|
259 |
for (var i = 0; i < sorted_news[key].length; i++) {
|
260 |
var title = sorted_news[key][i].substring(0, sorted_news[key][i].length-4);
|
|
|
278 |
}
|
279 |
|
280 |
|
281 |
+
var link = String(`/info_and_newsNER?ticker=${ ticker }&date=${ key }&title=${ sendTitle }&andSymbolInTitle=${ andSymbolInTitle }`);
|
|
|
282 |
linkList.push(link);
|
283 |
|
284 |
+
var execution_function = String(`javascript:getData(linkList[${ link_list_idx }]);`);
|
285 |
+
html = html + `<a href="${ execution_function }">${ title }</a><br>`;
|
|
|
286 |
link_list_idx = link_list_idx + 1;
|
287 |
}
|
288 |
html = html + '</td>';
|
|
|
352 |
|
353 |
|
354 |
// a νκ·Έ onclick μ μ©
|
355 |
+
var execution_function = `javascript:chartInit('${ ticker }')`;
|
356 |
const goTicker = document.querySelector('#news-container .goticker');
|
357 |
console.log(goTicker);
|
358 |
goTicker.setAttribute('href', execution_function);
|
|
|
444 |
// "await"λ "async" ν¨μ μμμλ§ λμνλ€.
|
445 |
// "await" ν€μλλ₯Ό λ§λλ©΄ Promiseκ° μ²λ¦¬λ λκΉμ§ κΈ°λ€λ¦°λ€.
|
446 |
// Promiseκ° μ²λ¦¬λκΈΈ κΈ°λ€λ¦¬λ λμμ μμ§μ΄ λ€λ₯ΈμΌ(λ€λ₯Έ μ€ν¬λ¦½νΈλ₯Ό μ€ν, μ΄λ²€νΈ μ²λ¦¬ λ±)μ ν μ μκΈ° λλ¬Έμ, CPU 리μμ€κ° λλΉλμ§ μλλ€.
|
447 |
+
const inferResponse = await fetch(`newsQuestions?ticker=${ ticker }&date=${ date }&title=${ sendTitle }&andSymbolInTitle=${ andSymbolInTitle }&questions=${ text }`); // Javascript -> Flask(python)
|
448 |
|
449 |
// console.log("inferResponse : ", inferResponse);
|
450 |
|
static/js/news.js
DELETED
@@ -1,182 +0,0 @@
|
|
1 |
-
// jQuery
|
2 |
-
// $(document).ready(function() { });
|
3 |
-
$(function() {
|
4 |
-
console.log("Start News's Title !");
|
5 |
-
newsInit();
|
6 |
-
});
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
function newsInit() {
|
13 |
-
// Ticker μ΄λ¦ κ°μ Έμ€κΈ°
|
14 |
-
// ν΄λΉ classμ text κ°μ Έμ€κΈ°
|
15 |
-
let ticker = document.querySelector('.goticker .tickerName').textContent;
|
16 |
-
let date = document.querySelector('.titleDate').textContent;
|
17 |
-
let title = document.querySelector('.titleName').textContent;
|
18 |
-
let url = document.querySelector('.NewsURL').textContent;
|
19 |
-
|
20 |
-
ticker = ticker;
|
21 |
-
date = date.substring(6, date.length);
|
22 |
-
title = title.substring(7, title.length);
|
23 |
-
url = url.substring(5, url.length);
|
24 |
-
|
25 |
-
console.log(ticker);
|
26 |
-
console.log(date);
|
27 |
-
console.log(title);
|
28 |
-
console.log(url);
|
29 |
-
|
30 |
-
|
31 |
-
//////////////////////////////////////////////////////////////////////
|
32 |
-
|
33 |
-
// Javascriptλ₯Ό μ΄μ©ν΄ HTMLμ λμ μΌλ‘ νκ·Έ μΆκ°
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
// a νκ·Έ onclick μ μ©
|
38 |
-
const goticker = document.querySelector('.goticker');
|
39 |
-
let stockURL = '/'.concat(ticker);
|
40 |
-
goticker.setAttribute('href', stockURL);
|
41 |
-
|
42 |
-
|
43 |
-
// a νκ·Έμ URL μ μ©
|
44 |
-
const addURL = document.querySelector('.NewsURL .input-News-URL');
|
45 |
-
addURL.setAttribute('href', url);
|
46 |
-
|
47 |
-
|
48 |
-
// λͺ¨λΈμμ μ§λ¬Έ μμ Tickerμ μλ§κ² μμ±νκΈ°
|
49 |
-
const example_value = document.querySelector('#model .text-form #text-input');
|
50 |
-
example = "Why did " + ticker + "'s stock go down?";
|
51 |
-
example_value.setAttribute('value', example);
|
52 |
-
|
53 |
-
|
54 |
-
//////////////////////////////////////////////////////////////////////
|
55 |
-
// NER κ΄λ ¨
|
56 |
-
|
57 |
-
ents = sendAjax_sync('/ner', {'ticker': ticker, 'date': date, 'title': title}, dataType="json", handle=handle_one_return);
|
58 |
-
// ents = {'text': [], 'start_char': [], 'end_char': [], 'label_': [], 'news': []}
|
59 |
-
console.log(ents);
|
60 |
-
|
61 |
-
let news = ents['news'];
|
62 |
-
let numOfNER = ents['text'].length;
|
63 |
-
|
64 |
-
|
65 |
-
// λλλ§ html μμ μμ±
|
66 |
-
news_ner = document.querySelector('.entities');
|
67 |
-
news_ner.innerHTML = '';
|
68 |
-
|
69 |
-
for (i=0; i<numOfNER-1; i++) {
|
70 |
-
start_idx = (i == 0) ? 0 : ents['end_char'][i-1];
|
71 |
-
end_idx = ents['start_char'][i];
|
72 |
-
last_idx = ents['end_char'][i];
|
73 |
-
|
74 |
-
label = ents['label_'][i];
|
75 |
-
if (label == 'ORG') { class_name = "entity_org"; }
|
76 |
-
else if (label == 'PERSON') { class_name = "entity_person"; }
|
77 |
-
else if (label == 'FAC') { class_name = "entity_fac"; }
|
78 |
-
else if (label == 'GPE') { class_name = "entity_gpe"; }
|
79 |
-
else if (label == 'PRODUCT') { class_name = "entity_product"; }
|
80 |
-
else { console.log("[ Error !!! - New NER label_ ] : ", ents['label_'][i], ents['text'][i]); class_name = "none"; }
|
81 |
-
|
82 |
-
news_ner.innerHTML = news_ner.innerHTML + news.substring(start_idx, end_idx);
|
83 |
-
news_ner.innerHTML = news_ner.innerHTML + '<mark class=' + class_name
|
84 |
-
+ ' style="line-height: 1;">'
|
85 |
-
+ news.substring(end_idx, last_idx)
|
86 |
-
+ '<span class="show-label" style="font-size: 0.8em; font-weight: bold; line-height: 1; border-radius: 0.35em; vertical-align: middle; margin-left: 0.5rem">'
|
87 |
-
+ label + '</span></mark>';
|
88 |
-
}
|
89 |
-
news_ner.innerHTML = news_ner.innerHTML + news.substring(ents['end_char'][numOfNER-1]);
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
//////////////////////////////////////////////////////////////////////
|
103 |
-
// λͺ¨λΈ μ μ© λ΄μ© ( Submit )
|
104 |
-
|
105 |
-
var sendTitle = title; // Javascript -> Python 보λ΄κΈ° μν title
|
106 |
-
|
107 |
-
|
108 |
-
// titleμμ & νμκ° μμ μ μμ.
|
109 |
-
// Title μμ '&'λ‘ νμλμ΄ μλλ° λ°λ‘ ꡬλ³ν΄μΌ λλ€.
|
110 |
-
// andSymbolInTitle μμ κ°μ Έμ¨ '&' μμΉ indexλ₯Ό titleκ³Ό ν©μ³μ€λ€.
|
111 |
-
andSymbolInTitle = [];
|
112 |
-
let idx = 0;
|
113 |
-
// title = "asdf&asdf&AS&DF&&";
|
114 |
-
// sendTitle = title;
|
115 |
-
|
116 |
-
while (true) {
|
117 |
-
idx = sendTitle.indexOf('&', idx);
|
118 |
-
if (idx == -1) { break; }
|
119 |
-
sendTitle = sendTitle.substring(0, idx) + sendTitle.substring(idx+1, sendTitle.length);
|
120 |
-
console.log(sendTitle);
|
121 |
-
andSymbolInTitle.push(idx + andSymbolInTitle.length);
|
122 |
-
}
|
123 |
-
|
124 |
-
console.log(andSymbolInTitle);
|
125 |
-
console.log("Last String", sendTitle);
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
// function μμ "async"λ₯Ό λΆμ΄λ©΄ ν΄λΉ ν¨μλ νμ νλΌλ―Έμ€λ₯Ό λ°ννλ€.
|
130 |
-
const translateText = async (text) => {
|
131 |
-
// λͺ©μ : Flaskμ inputμ 보λ΄μ£Όκ³ outputμ λ°μμ€λ κ³Όμ
|
132 |
-
console.log("Start translateText async");
|
133 |
-
|
134 |
-
// "await"λ "async" ν¨μ μμμλ§ λμνλ€.
|
135 |
-
// "await" ν€μλλ₯Ό λ§λλ©΄ Promiseκ° μ²λ¦¬λ λκΉμ§ κΈ°λ€λ¦°λ€.
|
136 |
-
// Promiseκ° μ²λ¦¬λκΈΈ κΈ°λ€λ¦¬λ λμμ μμ§μ΄ λ€λ₯ΈμΌ(λ€λ₯Έ μ€ν¬λ¦½νΈλ₯Ό μ€ν, μ΄λ²€νΈ μ²λ¦¬ λ±)μ ν μ μκΈ° λλ¬Έμ, CPU 리μμ€κ° λλΉλμ§ μλλ€.
|
137 |
-
const inferResponse = await fetch(`newsQuestions?ticker=${ticker}&date=${date}&title=${sendTitle}&andSymbolInTitle=${andSymbolInTitle}&questions=${text}`); // Javascript -> Flask(python)
|
138 |
-
|
139 |
-
// console.log("inferResponse : ", inferResponse);
|
140 |
-
|
141 |
-
const inferJson = await inferResponse.json(); // Flask(python) -> Javascript
|
142 |
-
|
143 |
-
// console.log(inferJson);
|
144 |
-
return inferJson.result['answer'];
|
145 |
-
};
|
146 |
-
|
147 |
-
|
148 |
-
/* λͺ¨λΈ Submit button κ΄λ ¨ λ΄μ© */
|
149 |
-
// form νκ·Έμ class μ΄λ¦
|
150 |
-
const textForm = document.querySelector('.text-form');
|
151 |
-
|
152 |
-
|
153 |
-
// addEventListener(type, listener)
|
154 |
-
// addEventListener(type, listener, options)
|
155 |
-
// addEventListener(type, listener, useCapture)
|
156 |
-
textForm.addEventListener('submit', async (event) => {
|
157 |
-
event.preventDefault();
|
158 |
-
// console.log(event);
|
159 |
-
|
160 |
-
// html -> javascript : input λ°μμμ output 보λ΄κΈ°
|
161 |
-
const textInput = document.getElementById('text-input');
|
162 |
-
console.log("element : ", textInput);
|
163 |
-
const textParagraph = document.querySelector('.text-output');
|
164 |
-
|
165 |
-
console.log("textInput : ", textInput, textInput.value);
|
166 |
-
try {
|
167 |
-
// sendAjax("/inference", {"input_text" : textInput.value}, handleOutput);
|
168 |
-
|
169 |
-
// "await"λ "async" ν¨μ μμμλ§ λμνλ€.
|
170 |
-
// "await" ν€μλλ₯Ό λ§λλ©΄ Promiseκ° μ²λ¦¬λ λκΉμ§ κΈ°λ€λ¦°λ€.
|
171 |
-
// Promiseκ° μ²λ¦¬λκΈΈ κΈ°λ€λ¦¬λ λμμ μμ§μ΄ λ€λ₯ΈμΌ(λ€λ₯Έ μ€ν¬λ¦½νΈλ₯Ό μ€ν, μ΄λ²€νΈ μ²λ¦¬ λ±)μ ν μ μκΈ° λλ¬Έμ, CPU 리μμ€κ° λλΉλμ§ μλλ€.
|
172 |
-
const answer = await translateText(textInput.value); // Flaskμ inputμ 보λ΄μ£Όκ³ outputμ λ°μμ€λ κ³Όμ
|
173 |
-
|
174 |
-
console.log("Answer : ", answer);
|
175 |
-
textParagraph.textContent = answer;
|
176 |
-
} catch (err) {
|
177 |
-
console.error(err);
|
178 |
-
}
|
179 |
-
});
|
180 |
-
}
|
181 |
-
|
182 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
templates/chart.html
DELETED
@@ -1,116 +0,0 @@
|
|
1 |
-
<!-- html νκ·Έ : HTMLλ‘ μμ±λμ΄ μλ€λ κ²μ μλ €μ€ -->
|
2 |
-
<!-- html νκ·Έ : html νμΌ μ 체λ₯Ό κ°μΈλ νκ·Έ -->
|
3 |
-
<html>
|
4 |
-
<!-- head νκ·Έ : 머리λ§μ ν΄λΉ -->
|
5 |
-
<!-- head νκ·Έ : cssλ javascriptλ₯Ό μ°κ²°ν΄μ€ -->
|
6 |
-
<!-- head νκ·Έ : νλΉμ½μ΄λ λ¬Έμμ΄ μΈμ½λ©κ³Ό κ°μ λ¬Έμμ λ€μν μ 보λ₯Ό μ 곡 -->
|
7 |
-
<head>
|
8 |
-
|
9 |
-
<!-- link νκ·Έ : μ£Όλ‘ μΈλΆ css νμΌμ μ°κ²°ν λ μ¬μ© -->
|
10 |
-
<link rel="stylesheet" href="static/css/chartStyle.css" />
|
11 |
-
|
12 |
-
|
13 |
-
<!-- jQuery -->
|
14 |
-
<script src='//cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js'></script>
|
15 |
-
<!-- script νκ·Έ : μΈλΆ js νμΌμ μ°κ²°νκ±°λ javascript μ½λλ₯Ό μ
λ ₯ν λ μ¬μ© -->
|
16 |
-
<script type="text/javascript" src="static/js/utils.js"></script>
|
17 |
-
<script type="text/javascript" src="static/js/chartIndex.js"></script>
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
<script src="https://cdn.jsdelivr.net/npm/[email protected]"></script>
|
24 |
-
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/chart.js"></script>
|
25 |
-
<script src="https://cdn.jsdelivr.net/npm/[email protected]"></script>
|
26 |
-
<script src="static/js/chartjs-chart-financial.js" type="text/javascript"></script>
|
27 |
-
|
28 |
-
</head>
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
<!-- body νκ·Έ : λ³Έλ¬Έμ ν΄λΉνλ λΆλΆ, μ€μ 보μ¬μ§λ νλ©΄μ ν΄λΉ -->
|
35 |
-
<body>
|
36 |
-
<h1><a class="gohome" href="/">Stock News Summaries AI</a></h1>
|
37 |
-
<a class="goticker"><h2 class="tickerName">{{embed}}</h2></a>
|
38 |
-
<h3 class="practice"></h3>
|
39 |
-
|
40 |
-
<div>
|
41 |
-
<div id="chart-container" width="974" height="486"></div>
|
42 |
-
|
43 |
-
<div class="myChart-container">
|
44 |
-
<canvas id="myChart"></canvas>
|
45 |
-
</div>
|
46 |
-
|
47 |
-
</div>
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
<!--
|
54 |
-
[ μμ± ]
|
55 |
-
|
56 |
-
align : μ λ ¬μ μ§μ νλ€. (left, center, right)
|
57 |
-
border : ν
λ리 μ μ λκ»λ₯Ό μ§μ νλ€.
|
58 |
-
bgcolor : λ°°κ²½μμ μ§μ νλ€. (μμ "red", "black" μ²λΌ κΈ°μ‘΄μ μ μλμ΄μλ μμ μ¬μ©ν μλ μμΌλ©°
|
59 |
-
rgbνμμ #000000 μΌλ‘λ μμ μ§μ ν μ μλ€.)
|
60 |
-
bordercolor : ν
λ리 μ μ μμ μ§μ νλ€. μμ μ§μ νλ λ°©λ²μ bgcolorμ λμΌνλ€.
|
61 |
-
cellspacing : μ
κ°μ κ°κ²©μ μ§μ νλ€.
|
62 |
-
width : κ°λ‘ κΈΈμ΄λ₯Ό μ§μ νλ€. (μμ κ°μ μ
λ ₯ν μλ, % λ¨μλ‘ μ
λ ₯ν μ μλ€.
|
63 |
-
%λ₯Ό μ¬μ©ν λλ μΉλΈλΌμ°μ ν¬κΈ°μ λν % μ΄λ€.)
|
64 |
-
height : μΈλ‘ κΈΈμ΄λ₯Ό μ§μ νλ€.
|
65 |
-
rawspan : μ§μ ν κ°λ§νΌ νμ λ³ν©νλ€. (μμλλ‘)
|
66 |
-
colspan : μ§μ ν κ°λ§νΌ μ΄μ λ³ν©νλ€. (μ’μ°λ‘)
|
67 |
-
-->
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
<!-- table νκ·Έ : ν
μ΄λΈμ λ§λ λ€. -->
|
76 |
-
<table class="table"
|
77 |
-
|
78 |
-
text-align="center"
|
79 |
-
align-items="center"
|
80 |
-
justify-content="center"
|
81 |
-
|
82 |
-
border="1"
|
83 |
-
width="90%"
|
84 |
-
height="200"
|
85 |
-
cellspacing="5">
|
86 |
-
|
87 |
-
|
88 |
-
<!-- caption νκ·Έ : ν
μ΄λΈ μ΄λ¦ νμ -->
|
89 |
-
<caption class="table-title"></caption>
|
90 |
-
|
91 |
-
<!-- ν
μ΄λΈμ ν€λ μμ μ§μ -->
|
92 |
-
<thread>
|
93 |
-
<!-- tr νκ·Έ : ν
μ΄λΈμ ν(κ°λ‘ νμ€)μ λ§λ λ€. -->
|
94 |
-
<tr align="center" bgcolor="white">
|
95 |
-
<!-- td νκ·Έ : ν
μ΄λΈμ μ΄μ λ§λ λ€. -->
|
96 |
-
<td width="5%"></td>
|
97 |
-
|
98 |
-
<!-- th νκ·Έ : ν
μ΄λΈ(ν)μ ν€λ λΆλΆ(μλμΌλ‘ κ°μ΄λ° μ λ ¬, κ΅΅κ² μ μ©) -->
|
99 |
-
<th width="10%">Date</th>
|
100 |
-
<th width="10%">Diff</th>
|
101 |
-
<th class="title-width">Articles</th>
|
102 |
-
</tr>
|
103 |
-
</thread>
|
104 |
-
|
105 |
-
<!-- tbody νκ·Έ : -->
|
106 |
-
<tbody class="news-table">
|
107 |
-
|
108 |
-
<!-- News: Date, Diff, Title μΆκ° -->
|
109 |
-
|
110 |
-
</tbody>
|
111 |
-
|
112 |
-
</table>
|
113 |
-
|
114 |
-
|
115 |
-
</body>
|
116 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|