Toggle navigation
Toggle navigation
This project
Loading...
Sign in
박하늘
/
stock_chatbot
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
Ubuntu
2021-06-07 17:51:14 +0000
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
06ffa03560b1f287bb57c75655de5b3f16ac0ba7
06ffa035
2 parents
95447879
4fa03acb
chatbot help modified(챗봇 도움말 수정)
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
49 deletions
server/app.js
server/optimizer.py
server/app.js
View file @
06ffa03
...
...
@@ -24,10 +24,6 @@ app.post('/hook', function (req, res) {
var
eventObj
=
req
.
body
.
events
[
0
];
var
source
=
eventObj
.
source
;
var
message
=
eventObj
.
message
;
<<<<<<<
HEAD
var
pystring
;
console
.
log
(
message
);
=======
// request log
console
.
log
(
'======================'
,
new
Date
()
,
'======================'
);
console
.
log
(
'[request]'
,
req
.
body
);
...
...
@@ -45,19 +41,7 @@ app.post('/hook', function (req, res) {
}
else
{
if
(
eventObj
.
message
.
text
==
'도움말'
)
{
printhelp
(
eventObj
.
replyToken
,
eventObj
.
message
.
text
)
}
else
if
(
eventObj
.
message
.
text
==
'주가'
)
{
printhelp
(
eventObj
.
replyToken
,
eventObj
.
message
.
text
)
}
else
if
(
eventObj
.
message
.
text
==
'비중 추천'
)
{
printhelp
(
eventObj
.
replyToken
,
eventObj
.
message
.
text
)
}
else
if
(
eventObj
.
message
.
text
==
'백테스트'
)
if
(
eventObj
.
message
.
text
==
'도움말'
||
'주가 도움말'
||
'비중 추천 도움말'
||
'백테스트 도움말'
)
{
printhelp
(
eventObj
.
replyToken
,
eventObj
.
message
.
text
)
}
...
...
@@ -72,7 +56,6 @@ app.post('/hook', function (req, res) {
}
res
.
sendStatus
(
200
);
});
...
...
@@ -98,7 +81,7 @@ function printhelp(replyToken, message){
"action"
:
{
"type"
:
"message"
,
"label"
:
'주가'
,
"text"
:
'주가'
"text"
:
'주가
기능 도움말
'
}
},
{
...
...
@@ -106,7 +89,7 @@ function printhelp(replyToken, message){
"action"
:
{
"type"
:
"message"
,
"label"
:
'비중 추천'
,
"text"
:
'비중 추천'
"text"
:
'비중 추천
기능 도움말
'
}
},
{
...
...
@@ -114,7 +97,7 @@ function printhelp(replyToken, message){
"action"
:
{
"type"
:
"message"
,
"label"
:
'백테스트'
,
"text"
:
'백테스트'
"text"
:
'백테스트
기능 도움말
'
}
}
]
...
...
@@ -126,7 +109,7 @@ function printhelp(replyToken, message){
console
.
log
(
body
)
});
}
else
if
(
message
==
'주가'
)
else
if
(
message
==
'주가
기능 도움말
'
)
{
request
.
post
(
{
...
...
@@ -147,7 +130,7 @@ function printhelp(replyToken, message){
console
.
log
(
body
)
});
}
else
if
(
message
==
'비중 추천'
)
else
if
(
message
==
'비중 추천
기능 도움말
'
)
{
request
.
post
(
{
...
...
@@ -168,7 +151,7 @@ function printhelp(replyToken, message){
console
.
log
(
body
)
});
}
else
if
(
message
==
'백테스트'
)
else
if
(
message
==
'백테스트
기능 도움말
'
)
{
request
.
post
(
{
...
...
@@ -189,33 +172,11 @@ function printhelp(replyToken, message){
console
.
log
(
body
)
});
}
else
if
(
message
==
'주가'
)
{
request
.
post
(
{
url
:
TARGET_URL
,
headers
:
{
'Authorization'
:
`Bearer
${
TOKEN
}
`
},
json
:
{
"replyToken"
:
replyToken
,
"messages"
:[
{
"type"
:
"text"
,
"text"
:
"사용자 : 주가\n챗봇: 종목명을 알려주세요.\n사용자: 종목명 입력 (ex 삼성전자)\n챗봇 : 현재가 거래량 전일대비 수익률"
}
]
}
},(
error
,
response
,
body
)
=>
{
console
.
log
(
body
)
});
}
}
function
basicinform
(
replyToken
,
message
)
{
var
pystring
;
>>>>>>>
f1c2d34f3272bc7cfebf6e887b72493185c4c57c
const
spawn
=
require
(
"child_process"
).
spawn
;
const
process
=
spawn
(
"python"
,
[
"basic.py"
,
message
]);
const
Callback
=
(
data
)
=>
{
...
...
@@ -318,14 +279,11 @@ function optimizer(replyToken, stock1, stock2, sdate) {
"type"
:
"text"
,
"text"
:
'조회하신 '
+
holder1
+
', '
+
holder2
+
'의 백테스트 결과입니다.'
},
<<<<<<<
HEAD
=======
{
"type"
:
"image"
,
"originalContentUrl"
:
"https://2017103989.oss2021.tk:23023/simages/test.png"
,
"previewImageUrl"
:
"https://2017103989.oss2021.tk:23023/simages/test.png"
}
>>>>>>>
f1c2d34f3272bc7cfebf6e887b72493185c4c57c
]
}
},(
error
,
response
,
body
)
=>
{
...
...
server/optimizer.py
View file @
06ffa03
...
...
@@ -584,6 +584,7 @@ class back_test:
# print(back_test().backtest_data(['삼성전자','LG전자'],[0.9,0.1],'2018-01-01', '2021-01-01',10000000,6, 'monthly', 'gmv'))
print
(
sys
.
argv
[
0
])
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'
)
# data = back_test().backtest_data(['삼성전자','LG전자'],[0.5,0.5],'2020-01-01', '2021-01-02',10000000,6, 'monthly', 'gmv')
x
=
data
[
'pfo_return'
][
0
][
'Date'
]
...
...
Please
register
or
login
to post a comment