[Add]WebTrader增加获取策略名功能

This commit is contained in:
vn.py 2018-02-09 13:37:05 +08:00
parent 6798a2234f
commit 4691e0c152

View File

@ -494,6 +494,30 @@ class CtaStrategyStop(Resource):
engine.stopStrategy(name)
########################################################################
class CtaStrategyName(Resource):
"""获取策略名"""
#----------------------------------------------------------------------
def __init__(self):
"""初始化"""
self.parser = reqparse.RequestParser()
self.parser.add_argument('token')
super(CtaStrategyName, self).__init__()
#----------------------------------------------------------------------
def get(self):
"""获取策略名"""
args = self.parser.parse_args()
token = args['token']
if token != TOKEN:
return None
engine = me.getApp('CtaStrategy')
l = engine.getStrategyNames()
return l
########################################################################
class CtaStrategyLoad(Resource):
"""加载策略"""
@ -589,6 +613,7 @@ api.add_resource(CtaStrategyStart, '/ctastrategy/start')
api.add_resource(CtaStrategyStop, '/ctastrategy/stop')
api.add_resource(CtaStrategyParam, '/ctastrategy/param')
api.add_resource(CtaStrategyVar, '/ctastrategy/var')
api.add_resource(CtaStrategyName, '/ctastrategy/name')
# SocketIO