Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion opendatatools/swindex/swindex_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,13 @@ def get_index_cons(self, index_code):

def get_index_daily(self, index_code, start_date, end_date):
url = 'http://www.swsindex.com/excel2.aspx?ctable=swindexhistory&where=%s '
where_cond = " swindexcode in ('%s') and BargainDate >= '%s' and BargainDate <= '%s'" % (index_code, start_date, end_date)
if isinstance(index_code, str):
where_cond = " swindexcode in ('%s') and BargainDate >= '%s' and BargainDate <= '%s'" % (index_code, start_date, end_date)
elif isinstance(index_code,list):
index_code_list = "','".join(index_code)
where_cond = " swindexcode in ('%s') and BargainDate >= '%s' and BargainDate <= '%s'" % (index_code_list, start_date, end_date)
else:
return None, 'Input Error:index_code should be a string or a list of string'
url = url % where_cond
print(url)

Expand Down