Ubuntu

chatbot help modified(챗봇 도움말 수정)

...@@ -24,10 +24,6 @@ app.post('/hook', function (req, res) { ...@@ -24,10 +24,6 @@ app.post('/hook', function (req, res) {
24 var eventObj = req.body.events[0]; 24 var eventObj = req.body.events[0];
25 var source = eventObj.source; 25 var source = eventObj.source;
26 var message = eventObj.message; 26 var message = eventObj.message;
27 -<<<<<<< HEAD
28 - var pystring;
29 - console.log(message);
30 -=======
31 // request log 27 // request log
32 console.log('======================', new Date() ,'======================'); 28 console.log('======================', new Date() ,'======================');
33 console.log('[request]', req.body); 29 console.log('[request]', req.body);
...@@ -45,19 +41,7 @@ app.post('/hook', function (req, res) { ...@@ -45,19 +41,7 @@ app.post('/hook', function (req, res) {
45 } 41 }
46 else 42 else
47 { 43 {
48 - if(eventObj.message.text == '도움말') 44 + if(eventObj.message.text == '도움말' || '주가 도움말' || '비중 추천 도움말' || '백테스트 도움말')
49 - {
50 - printhelp(eventObj.replyToken, eventObj.message.text)
51 - }
52 - else if(eventObj.message.text == '주가')
53 - {
54 - printhelp(eventObj.replyToken, eventObj.message.text)
55 - }
56 - else if(eventObj.message.text == '비중 추천')
57 - {
58 - printhelp(eventObj.replyToken, eventObj.message.text)
59 - }
60 - else if(eventObj.message.text == '백테스트')
61 { 45 {
62 printhelp(eventObj.replyToken, eventObj.message.text) 46 printhelp(eventObj.replyToken, eventObj.message.text)
63 } 47 }
...@@ -72,7 +56,6 @@ app.post('/hook', function (req, res) { ...@@ -72,7 +56,6 @@ app.post('/hook', function (req, res) {
72 56
73 } 57 }
74 58
75 -
76 res.sendStatus(200); 59 res.sendStatus(200);
77 60
78 }); 61 });
...@@ -98,7 +81,7 @@ function printhelp(replyToken, message){ ...@@ -98,7 +81,7 @@ function printhelp(replyToken, message){
98 "action": { 81 "action": {
99 "type": "message", 82 "type": "message",
100 "label": '주가', 83 "label": '주가',
101 - "text": '주가' 84 + "text": '주가 기능 도움말'
102 } 85 }
103 }, 86 },
104 { 87 {
...@@ -106,7 +89,7 @@ function printhelp(replyToken, message){ ...@@ -106,7 +89,7 @@ function printhelp(replyToken, message){
106 "action": { 89 "action": {
107 "type": "message", 90 "type": "message",
108 "label": '비중 추천', 91 "label": '비중 추천',
109 - "text": '비중 추천' 92 + "text": '비중 추천 기능 도움말'
110 } 93 }
111 }, 94 },
112 { 95 {
...@@ -114,7 +97,7 @@ function printhelp(replyToken, message){ ...@@ -114,7 +97,7 @@ function printhelp(replyToken, message){
114 "action": { 97 "action": {
115 "type": "message", 98 "type": "message",
116 "label": '백테스트', 99 "label": '백테스트',
117 - "text": '백테스트' 100 + "text": '백테스트 기능 도움말'
118 } 101 }
119 } 102 }
120 ] 103 ]
...@@ -126,7 +109,7 @@ function printhelp(replyToken, message){ ...@@ -126,7 +109,7 @@ function printhelp(replyToken, message){
126 console.log(body) 109 console.log(body)
127 }); 110 });
128 } 111 }
129 - else if(message == '주가') 112 + else if(message == '주가 기능 도움말')
130 { 113 {
131 request.post( 114 request.post(
132 { 115 {
...@@ -147,7 +130,7 @@ function printhelp(replyToken, message){ ...@@ -147,7 +130,7 @@ function printhelp(replyToken, message){
147 console.log(body) 130 console.log(body)
148 }); 131 });
149 } 132 }
150 - else if(message == '비중 추천') 133 + else if(message == '비중 추천 기능 도움말')
151 { 134 {
152 request.post( 135 request.post(
153 { 136 {
...@@ -168,7 +151,7 @@ function printhelp(replyToken, message){ ...@@ -168,7 +151,7 @@ function printhelp(replyToken, message){
168 console.log(body) 151 console.log(body)
169 }); 152 });
170 } 153 }
171 - else if(message == '백테스트') 154 + else if(message == '백테스트 기능 도움말')
172 { 155 {
173 request.post( 156 request.post(
174 { 157 {
...@@ -189,33 +172,11 @@ function printhelp(replyToken, message){ ...@@ -189,33 +172,11 @@ function printhelp(replyToken, message){
189 console.log(body) 172 console.log(body)
190 }); 173 });
191 } 174 }
192 - else if(message == '주가')
193 - {
194 - request.post(
195 - {
196 - url: TARGET_URL,
197 - headers: {
198 - 'Authorization': `Bearer ${TOKEN}`
199 - },
200 - json: {
201 - "replyToken":replyToken,
202 - "messages":[
203 - {
204 - "type":"text",
205 - "text":"사용자 : 주가\n챗봇: 종목명을 알려주세요.\n사용자: 종목명 입력 (ex 삼성전자)\n챗봇 : 현재가 거래량 전일대비 수익률"
206 - }
207 - ]
208 - }
209 - },(error, response, body) => {
210 - console.log(body)
211 - });
212 - }
213 175
214 } 176 }
215 177
216 function basicinform(replyToken, message) { 178 function basicinform(replyToken, message) {
217 var pystring; 179 var pystring;
218 ->>>>>>> f1c2d34f3272bc7cfebf6e887b72493185c4c57c
219 const spawn = require("child_process").spawn; 180 const spawn = require("child_process").spawn;
220 const process = spawn("python", ["basic.py", message]); 181 const process = spawn("python", ["basic.py", message]);
221 const Callback = (data) => { 182 const Callback = (data) => {
...@@ -318,14 +279,11 @@ function optimizer(replyToken, stock1, stock2, sdate) { ...@@ -318,14 +279,11 @@ function optimizer(replyToken, stock1, stock2, sdate) {
318 "type":"text", 279 "type":"text",
319 "text":'조회하신 ' + holder1 +', ' + holder2 + '의 백테스트 결과입니다.' 280 "text":'조회하신 ' + holder1 +', ' + holder2 + '의 백테스트 결과입니다.'
320 }, 281 },
321 -<<<<<<< HEAD
322 -=======
323 { 282 {
324 "type":"image", 283 "type":"image",
325 "originalContentUrl": "https://2017103989.oss2021.tk:23023/simages/test.png", 284 "originalContentUrl": "https://2017103989.oss2021.tk:23023/simages/test.png",
326 "previewImageUrl": "https://2017103989.oss2021.tk:23023/simages/test.png" 285 "previewImageUrl": "https://2017103989.oss2021.tk:23023/simages/test.png"
327 } 286 }
328 ->>>>>>> f1c2d34f3272bc7cfebf6e887b72493185c4c57c
329 ] 287 ]
330 } 288 }
331 },(error, response, body) => { 289 },(error, response, body) => {
......
...@@ -584,6 +584,7 @@ class back_test: ...@@ -584,6 +584,7 @@ class back_test:
584 # print(back_test().backtest_data(['삼성전자','LG전자'],[0.9,0.1],'2018-01-01', '2021-01-01',10000000,6, 'monthly', 'gmv')) 584 # print(back_test().backtest_data(['삼성전자','LG전자'],[0.9,0.1],'2018-01-01', '2021-01-01',10000000,6, 'monthly', 'gmv'))
585 585
586 586
587 +print(sys.argv[0])
587 data = back_test().backtest_data([sys.argv[1],sys.argv[2]],[0.5,0.5],sys.argv[3], '2021-01-02',10000000,6, 'monthly', 'gmv') 588 data = back_test().backtest_data([sys.argv[1],sys.argv[2]],[0.5,0.5],sys.argv[3], '2021-01-02',10000000,6, 'monthly', 'gmv')
588 # data = back_test().backtest_data(['삼성전자','LG전자'],[0.5,0.5],'2020-01-01', '2021-01-02',10000000,6, 'monthly', 'gmv') 589 # data = back_test().backtest_data(['삼성전자','LG전자'],[0.5,0.5],'2020-01-01', '2021-01-02',10000000,6, 'monthly', 'gmv')
589 x = data['pfo_return'][0]['Date'] 590 x = data['pfo_return'][0]['Date']
......