掘金社区

('exit code: ', 0)Pinned highlighted

139809***724 发表在掘金2 2016-06-18 03:44:33

掘金2
534
1
0

-- coding: utf-8 --

from gmsdk.api import StrategyBase
class Mystrategy(StrategyBase):
def init(self, *args, **kwargs):
super(Mystrategy, self).init(*args, **kwargs)

def on_login(self):
    pass

def on_tick(self, tick):
    print "tick"

if name == 'main':
myStrategy = Mystrategy(
username='1398----724',
password='----',
strategy_id='5595a1f4-3503-11e6-8480-689423ef88b1',
subscribe_symbols='SHFE.rb00.tick',
mode=4,
td_addr='localhost:8001'
)
myStrategy.backtest_config(
start_time='2016-06-03 10:10:00',
end_time='2016-06-16 10:10:00',
initial_cash=10000,
transaction_ratio=1,
commission_ratio=0,
slippage_ratio=0,
price_type=0)
ret = myStrategy.run()
print('exit code: ', ret)

没有调用tick阿

评论: 1
相关阅读
  • 问题反馈'set_token' is not defined
  • Looks like your connection to 掘金量化社区 - 量化交易者的策略交流学习社区 was lost, please wait while we try to reconnect.