修复网格的最高价和最低价
This commit is contained in:
parent
347658abf5
commit
ca80a595f0
@ -1,7 +1,7 @@
|
||||
# encoding: UTF-8
|
||||
|
||||
|
||||
import os
|
||||
import os,sys
|
||||
from datetime import datetime
|
||||
import json
|
||||
import uuid
|
||||
@ -298,8 +298,8 @@ class CtaGridTrade(object):
|
||||
|
||||
# 状态一致,价格大于最低价格
|
||||
if direction == DIRECTION_LONG:
|
||||
if begin == EMPTY_FLOAT: begin = 99999
|
||||
if end == EMPTY_FLOAT: end = -99999
|
||||
if begin == EMPTY_FLOAT: begin = sys.maxint
|
||||
if end == EMPTY_FLOAT: end = 0-sys.maxint
|
||||
grids = [x for x in self.dnGrids
|
||||
if x.orderStatus == ordered
|
||||
and x.openStatus == opened
|
||||
@ -312,8 +312,8 @@ class CtaGridTrade(object):
|
||||
|
||||
# 状态一致,开仓价格小于最高价格
|
||||
if direction == DIRECTION_SHORT:
|
||||
if begin == EMPTY_FLOAT: begin = -99999
|
||||
if end == EMPTY_FLOAT: end = 99999
|
||||
if begin == EMPTY_FLOAT: begin = 0-sys.maxint
|
||||
if end == EMPTY_FLOAT: end = sys.maxint
|
||||
grids = [x for x in self.upGrids
|
||||
if x.orderStatus == ordered
|
||||
and x.openStatus == opened
|
||||
@ -632,10 +632,10 @@ class CtaGridTrade(object):
|
||||
"""计算网格的平均开仓价"""
|
||||
up_open_list = [x for x in self.upGrids if x.openStatus]
|
||||
|
||||
self.max_up_open_price = -99999
|
||||
self.avg_up_open_price = -99999
|
||||
self.min_dn_open_price = 99999
|
||||
self.avg_dn_open_price = 99999
|
||||
self.max_up_open_price = 0 - sys.maxint
|
||||
self.avg_up_open_price = 0 - sys.maxint
|
||||
self.min_dn_open_price = sys.maxint
|
||||
self.avg_dn_open_price = sys.maxint
|
||||
|
||||
total_price = EMPTY_FLOAT
|
||||
total_volume = EMPTY_INT
|
||||
|
Loading…
Reference in New Issue
Block a user