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-03 15:26:11 +0000
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
3e5b407c8b0aa8b5c6356a848b7faf0164f6c644
3e5b407c
2 parents
1b9d88b1
878c88d2
2
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
3 deletions
server/basic.py
server/basic.py
View file @
3e5b407
import
FinanceDataReader
as
fdr
import
pandas
as
pd
import
sys
from
fuzzywuzzy
import
process
# -*- coding: utf-8 -*-
def
get_matches
(
query
,
choices
,
limit
=
3
):
result
=
process
.
extract
(
query
,
choices
,
limit
=
limit
)
return
result
def
basicinform
(
input
):
stocks
=
pd
.
read_csv
(
'stockcodename.csv'
,
index_col
=
0
)
symbol
=
''
for
i
in
enumerate
(
stocks
.
Name
):
if
i
[
1
]
==
input
:
symbol
=
(
stocks
.
iloc
[
i
[
0
]]
.
Symbol
)
break
if
(
symbol
==
''
):
fuzzy
=
get_matches
(
input
,
stocks
.
Name
)
cand
=
''
for
i
in
fuzzy
:
cand
+=
i
[
0
]
cand
+=
" "
cand
+=
"중 찾는게 있으신가요?
\n
다시 입력해주세요."
return
cand
df
=
fdr
.
DataReader
(
symbol
)
ror_df
=
df
.
Close
.
pct_change
()
volume
=
df
.
Volume
.
iloc
[
-
1
]
...
...
@@ -25,7 +41,5 @@ def basicinform(input):
return
value
#print(basicinform('삼성전자'))
args
=
sys
.
argv
print
(
basicinform
(
args
[
1
]))
print
(
basicinform
(
args
[
0
]))
...
...
Please
register
or
login
to post a comment