Merge pull request #1531 from 1122455801/22
[FIX] 修改multi_signal, multi_timeframe 和test Strategy的代码风格
This commit is contained in:
commit
cc390e9ba7
@ -134,7 +134,7 @@ class MaSignal(CtaSignal):
|
||||
class MultiSignalStrategy(TargetPosTemplate):
|
||||
""""""
|
||||
|
||||
author = '用Python的交易员'
|
||||
author = "用Python的交易员"
|
||||
|
||||
rsi_window = 14
|
||||
rsi_level = 20
|
||||
@ -145,9 +145,9 @@ class MultiSignalStrategy(TargetPosTemplate):
|
||||
|
||||
signal_pos = {}
|
||||
|
||||
parameters = ['rsi_window', 'rsi_level', 'cci_window',
|
||||
'cci_level', 'fast_window', 'slow_window']
|
||||
variables = ['signal_pos', 'target_pos']
|
||||
parameters = ["rsi_window", "rsi_level", "cci_window",
|
||||
"cci_level", "fast_window", "slow_window"]
|
||||
variables = ["signal_pos", "target_pos"]
|
||||
|
||||
def __init__(self, cta_engine, strategy_name, vt_symbol, setting):
|
||||
""""""
|
||||
@ -210,9 +210,9 @@ class MultiSignalStrategy(TargetPosTemplate):
|
||||
|
||||
def calculate_target_pos(self):
|
||||
""""""
|
||||
self.signal_pos['rsi'] = self.rsi_signal.get_signal_pos()
|
||||
self.signal_pos['cci'] = self.cci_signal.get_signal_pos()
|
||||
self.signal_pos['ma'] = self.ma_signal.get_signal_pos()
|
||||
self.signal_pos["rsi"] = self.rsi_signal.get_signal_pos()
|
||||
self.signal_pos["cci"] = self.cci_signal.get_signal_pos()
|
||||
self.signal_pos["ma"] = self.ma_signal.get_signal_pos()
|
||||
|
||||
target_pos = 0
|
||||
for v in self.signal_pos.values():
|
||||
|
@ -12,7 +12,7 @@ from vnpy.app.cta_strategy import (
|
||||
|
||||
class MultiTimeframeStrategy(CtaTemplate):
|
||||
""""""
|
||||
author = '用Python的交易员'
|
||||
author = "用Python的交易员"
|
||||
|
||||
rsi_signal = 20
|
||||
rsi_window = 14
|
||||
@ -27,12 +27,12 @@ class MultiTimeframeStrategy(CtaTemplate):
|
||||
slow_ma = 0
|
||||
ma_trend = 0
|
||||
|
||||
parameters = ['rsi_signal', 'rsi_window',
|
||||
'fast_window', 'slow_window',
|
||||
'fixed_size']
|
||||
parameters = ["rsi_signal", "rsi_window",
|
||||
"fast_window", "slow_window",
|
||||
"fixed_size"]
|
||||
|
||||
variables = ['rsi_value', 'rsi_long', 'rsi_short',
|
||||
'fast_ma', 'slow_ma', 'ma_trend']
|
||||
variables = ["rsi_value", "rsi_long", "rsi_short",
|
||||
"fast_ma", "slow_ma", "ma_trend"]
|
||||
|
||||
def __init__(self, cta_engine, strategy_name, vt_symbol, setting):
|
||||
""""""
|
||||
|
@ -12,7 +12,7 @@ from time import time
|
||||
|
||||
class TestStrategy(CtaTemplate):
|
||||
""""""
|
||||
author = '用Python的交易员'
|
||||
author = "用Python的交易员"
|
||||
|
||||
test_trigger = 10
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user