Commit 99e568d6 authored by stephen.wang's avatar stephen.wang

修正benchmark bug

parent 5f50db57
...@@ -47,16 +47,17 @@ class BenchmarkAlligamReportor(RoboReportor): ...@@ -47,16 +47,17 @@ class BenchmarkAlligamReportor(RoboReportor):
response = requests.get(f'http://jdcprod.thiztech.com/api/datas/asset-value?{urlencode(params)}').json() response = requests.get(f'http://jdcprod.thiztech.com/api/datas/asset-value?{urlencode(params)}').json()
if not response['success']: if not response['success']:
raise Exception(f'''request jdc alligam failed: {response['status']}''') raise Exception(f'''request jdc alligam failed: {response['status']}''')
rb.batch_insert([{ if response['body']['content']:
'date': dt.fromtimestamp(x['date'] / 1000), rb.batch_insert([{
'module': self.module_name, 'date': dt.fromtimestamp(x['date'] / 1000),
'risk': self.risk, 'module': self.module_name,
'nav': x['calibrateValue'], 'risk': self.risk,
'remarks': json.dumps({ 'nav': x['calibrateValue'],
'av': x['originValue'], 'remarks': json.dumps({
'div': x['dividend'] if 'dividend' in x else 0 'av': x['originValue'],
}, ensure_ascii=False) 'div': x['dividend'] if 'dividend' in x else 0
} for x in response['body']['content']]) }, ensure_ascii=False)
} for x in response['body']['content']])
if response['body']['last']: if response['body']['last']:
break break
else: else:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment