Skip to content

Commit

Permalink
修正bug
Browse files Browse the repository at this point in the history
  • Loading branch information
PKUJohnson committed Oct 10, 2019
1 parent 2ea5201 commit 66dacd3
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion opendatatools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@

import os

__version__ = '0.9.4'
__version__ = '0.9.5'
SOURCE_ROOT_DIR = os.path.dirname(os.path.abspath(__file__))

6 changes: 3 additions & 3 deletions opendatatools/economy/nbs_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -633,13 +633,13 @@ def get_fiscal_expend(self):
return self._get_qg_indicator('A01', 'A1A02', dbcode = 'hgyd')

def get_manufacturing_pmi(self):
return self._get_qg_indicator('A01', 'A1901', dbcode = 'hgyd')
return self._get_qg_indicator('A01', 'A0B01', dbcode = 'hgyd')

def get_non_manufacturing_pmi(self):
return self._get_qg_indicator('A01', 'A1902', dbcode = 'hgyd')
return self._get_qg_indicator('A01', 'A0B02', dbcode = 'hgyd')

def get_pmi(self):
return self._get_qg_indicator('A01', 'A1903', dbcode = 'hgyd')
return self._get_qg_indicator('A01', 'A0B03', dbcode = 'hgyd')

def get_import_export(self):
return self._get_qg_indicator('A01', 'A1601', dbcode = 'hgyd')
Expand Down
4 changes: 2 additions & 2 deletions opendatatools/hedgefund/hedgefund_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ def load_data():
def get_fund_list():
return simu_agent.get_fund_list()

def get_fund_nav(fund_id):
return simu_agent.get_fund_nav(fund_id)
def get_fund_nav(fund_id, time_span = 0):
return simu_agent.get_fund_nav(fund_id, time_span)

def get_barclay_data(index):
return barclay_agent.get_data(index)
Expand Down
7 changes: 5 additions & 2 deletions opendatatools/hedgefund/simu_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import pandas as pd
import io
import hashlib
import time

index_map = {
'Barclay_Hedge_Fund_Index' : 'ghsndx',
Expand Down Expand Up @@ -218,15 +219,15 @@ def _get_decrypt_info(self, fund_id):
else:
decrypt_func = self._bit_encrypt2

if response.index("return xOrEncrypt(str, ")> 0:
if response.find("return xOrEncrypt(str, ")> 0:
tag = "return xOrEncrypt(str, "
else:
tag = "return bitEncrypt(str, "
pos = response.index(tag) + len(tag) + 1
key = response[pos:pos+32]
return decrypt_func, key

def get_fund_nav(self, fund_id):
def get_fund_nav(self, fund_id, time_elapse = 0):

if self.user_info is None:
return None, '请先登录'
Expand Down Expand Up @@ -255,6 +256,8 @@ def get_fund_nav(self, fund_id):
df_list.append(df)
break
page_no = page_no + 1
if time_elapse > 0:
time.sleep(time_elapse)

df_nav = pd.concat(df_list)
df_nav.drop('c', axis=1, inplace=True)
Expand Down

0 comments on commit 66dacd3

Please sign in to comment.