From bd944e30fc25eb602fa55a1844d465145316c152 Mon Sep 17 00:00:00 2001 From: msincenselee Date: Thu, 2 Jul 2020 17:22:07 +0800 Subject: [PATCH] =?UTF-8?q?[=E5=A2=9E=E5=BC=BA=E5=8A=9F=E8=83=BD]=20?= =?UTF-8?q?=E4=B8=AD=E6=96=87=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vnpy/component/base.py | 2 +- vnpy/component/cta_grid_trade.py | 4 ++-- vnpy/component/cta_policy.py | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/vnpy/component/base.py b/vnpy/component/base.py index 2d3d672f..131db431 100644 --- a/vnpy/component/base.py +++ b/vnpy/component/base.py @@ -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 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 -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 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} diff --git a/vnpy/component/cta_grid_trade.py b/vnpy/component/cta_grid_trade.py index c1699d48..0060a60d 100644 --- a/vnpy/component/cta_grid_trade.py +++ b/vnpy/component/cta_grid_trade.py @@ -888,7 +888,7 @@ class CtaGridTrade(CtaComponent): data[u'dn_grids'] = dn_grids 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) self.write_log(u'GrideTrade保存文件{}完成'.format(grid_json_file)) @@ -915,7 +915,7 @@ class CtaGridTrade(CtaComponent): self.write_log(u'{}不存在,新建保存保存'.format(grid_json_file)) try: 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) except Exception as ex: self.write_log(u'写入网格文件{}异常:{}'.format(grid_json_file, str(ex))) diff --git a/vnpy/component/cta_policy.py b/vnpy/component/cta_policy.py index 7925e355..cc1e6840 100644 --- a/vnpy/component/cta_policy.py +++ b/vnpy/component/cta_policy.py @@ -1,5 +1,5 @@ # encoding: UTF-8 - +from __future__ import unicode_literals import os import json from datetime import datetime @@ -103,7 +103,7 @@ class CtaPolicy(CtaComponent): json_data = self.to_json() json_data['save_time'] = datetime.now().strftime('%Y-%m-%d %H:%M:%S') 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) except IOError as ex: