Skip to content

Commit f53b766

Browse files
committed
格式化代码
1 parent c28a545 commit f53b766

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,5 +140,5 @@ ENV/
140140

141141
# Rope project settings
142142
.ropeproject
143-
143+
/test/test_jq2.py
144144
/test/test_jq.py

trader/strategy/brother2.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@
2424
from talib import ATR
2525
import ujson as json
2626
import aioredis
27-
28-
import trader.utils.ApiStruct
2927
from trader.strategy import BaseModule
3028
from trader.utils.func_container import RegisterCallback
3129
from trader.utils.read_config import config, ctp_errors
@@ -740,10 +738,8 @@ def calc_signal(self, inst: Instrument, day: datetime.datetime) -> (Signal, Deci
740738
df["high_line"] = df.close.rolling(window=break_n).max()
741739
df["low_line"] = df.close.rolling(window=break_n).min()
742740
idx = -1
743-
buy_sig = df.short_trend[idx] > df.long_trend[idx] and price_round(df.close[idx], inst.price_tick) >= price_round(df.high_line[idx - 1],
744-
inst.price_tick)
745-
sell_sig = df.short_trend[idx] < df.long_trend[idx] and price_round(df.close[idx], inst.price_tick) <= price_round(df.low_line[idx - 1],
746-
inst.price_tick)
741+
buy_sig = df.short_trend[idx] > df.long_trend[idx] and price_round(df.close[idx], inst.price_tick) >= price_round(df.high_line[idx - 1], inst.price_tick)
742+
sell_sig = df.short_trend[idx] < df.long_trend[idx] and price_round(df.close[idx], inst.price_tick) <= price_round(df.low_line[idx - 1], inst.price_tick)
747743
pos = Trade.objects.filter(close_time__isnull=True, broker=self.__broker, strategy=self.__strategy, instrument=inst, shares__gt=0).first()
748744
roll_over = False
749745
if pos:
@@ -756,7 +752,6 @@ def calc_signal(self, inst: Instrument, day: datetime.datetime) -> (Signal, Deci
756752
sell_sig = True
757753
self.__strategy.force_opens.remove(inst)
758754
signal = signal_code = price = volume = volume_ori = use_margin = None
759-
760755
priority = PriorityType.LOW
761756
if pos:
762757
# 多头持仓

0 commit comments

Comments
 (0)