[增强功能] 中文显示
This commit is contained in:
parent
bb9ec7ba98
commit
bd944e30fc
@ -28,7 +28,7 @@ NIGHT_MARKET_SQ1 = {'AU': 0.05, 'AG': 1, 'SC': 0.1}
|
|||||||
# 上期所夜盘,9:00~10:15, 10:30~11:30, 13:30~15:00, 21:00 ~1:00
|
# 上期所夜盘,9:00~10:15, 10:30~11:30, 13:30~15:00, 21:00 ~1:00
|
||||||
NIGHT_MARKET_SQ2 = {'CU': 10, 'PB': 5, 'AL': 5, 'ZN': 5, 'WR': 1, 'NI': 10}
|
NIGHT_MARKET_SQ2 = {'CU': 10, 'PB': 5, 'AL': 5, 'ZN': 5, 'WR': 1, 'NI': 10}
|
||||||
# 上期所夜盘,9:00~10:15, 10:30~11:30, 13:30~15:00, 21:00 ~23:00
|
# 上期所夜盘,9:00~10:15, 10:30~11:30, 13:30~15:00, 21:00 ~23:00
|
||||||
NIGHT_MARKET_SQ3 = {'RU': 5, 'RB': 1, 'HC': 1, 'SP': 2, 'FU': 1, 'BU': 2, 'NR': 5, 'C': 1, 'CS': 1}
|
NIGHT_MARKET_SQ3 = {'RU': 5, 'RB': 1, 'HC': 1, 'SP': 2, 'FU': 1, 'BU': 2, 'NR': 5, 'C': 1, 'CS': 1, 'LU':1}
|
||||||
# 郑商所夜盘,9:00~10:15, 10:30~11:30, 13:30~15:00, 21:00 ~23:00
|
# 郑商所夜盘,9:00~10:15, 10:30~11:30, 13:30~15:00, 21:00 ~23:00
|
||||||
NIGHT_MARKET_ZZ = {'TA': 2, 'JR': 1, 'OI': 0, 'RO': 1, 'PM': 1, 'WH': 1, 'CF': 5, 'SR': 0, 'FG': 1,
|
NIGHT_MARKET_ZZ = {'TA': 2, 'JR': 1, 'OI': 0, 'RO': 1, 'PM': 1, 'WH': 1, 'CF': 5, 'SR': 0, 'FG': 1,
|
||||||
'MA': 1, 'RS': 1, 'RM': 1, 'RI': 1, 'ZC': 0.2}
|
'MA': 1, 'RS': 1, 'RM': 1, 'RI': 1, 'ZC': 0.2}
|
||||||
|
@ -888,7 +888,7 @@ class CtaGridTrade(CtaComponent):
|
|||||||
data[u'dn_grids'] = dn_grids
|
data[u'dn_grids'] = dn_grids
|
||||||
|
|
||||||
with open(grid_json_file, 'w', encoding='utf8') as f:
|
with open(grid_json_file, 'w', encoding='utf8') as f:
|
||||||
json_data = json.dumps(data, indent=4, ensure_ascii=True)
|
json_data = json.dumps(data, indent=4, ensure_ascii=False)
|
||||||
f.write(json_data)
|
f.write(json_data)
|
||||||
|
|
||||||
self.write_log(u'GrideTrade保存文件{}完成'.format(grid_json_file))
|
self.write_log(u'GrideTrade保存文件{}完成'.format(grid_json_file))
|
||||||
@ -915,7 +915,7 @@ class CtaGridTrade(CtaComponent):
|
|||||||
self.write_log(u'{}不存在,新建保存保存'.format(grid_json_file))
|
self.write_log(u'{}不存在,新建保存保存'.format(grid_json_file))
|
||||||
try:
|
try:
|
||||||
with open(grid_json_file, 'w') as f:
|
with open(grid_json_file, 'w') as f:
|
||||||
json_data = json.dumps(data, indent=4, ensure_ascii=True)
|
json_data = json.dumps(data, indent=4, ensure_ascii=False)
|
||||||
f.write(json_data)
|
f.write(json_data)
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
self.write_log(u'写入网格文件{}异常:{}'.format(grid_json_file, str(ex)))
|
self.write_log(u'写入网格文件{}异常:{}'.format(grid_json_file, str(ex)))
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# encoding: UTF-8
|
# encoding: UTF-8
|
||||||
|
from __future__ import unicode_literals
|
||||||
import os
|
import os
|
||||||
import json
|
import json
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
@ -103,7 +103,7 @@ class CtaPolicy(CtaComponent):
|
|||||||
json_data = self.to_json()
|
json_data = self.to_json()
|
||||||
json_data['save_time'] = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
|
json_data['save_time'] = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
|
||||||
with open(json_file, 'w') as f:
|
with open(json_file, 'w') as f:
|
||||||
data = json.dumps(json_data, indent=4)
|
data = json.dumps(json_data, indent=4, ensure_ascii=False)
|
||||||
f.write(data)
|
f.write(data)
|
||||||
|
|
||||||
except IOError as ex:
|
except IOError as ex:
|
||||||
|
Loading…
Reference in New Issue
Block a user