Skip to content

止盈止损单如何传递参数 #55

Answered by wondertrader
chwei2ch asked this question in Q&A
Discussion options

You must be logged in to vote

WonderTrader的下单接口的逻辑,是参考MultiCharts来实现的,以CTA为例,一共提供了5个下单接口

def stra_set_position(self, stdCode:str, qty:float, usertag:str = "", limitprice:float = 0.0, stopprice:float = 0.0):
    '''
    设置仓位
    @stdCode   合约/股票代码
    @qty    目标仓位,正为多仓,负为空仓
    @return 设置结果TRUE/FALSE
    '''
    self.__wrapper__.cta_set_position(self.__id__, stdCode, qty, usertag, limitprice, stopprice)
    

def stra_enter_long(self, stdCode:str, qty:float, usertag:str = "", limitprice:float = 0.0, stopprice:float = 0.0):
    '''
    多仓进场,如果有空仓,则平空再开多
    @stdCode   品种代码
    @qty    数量
    @limitprice 限价,默认为0
    @stopprice  止价,默认为0
    '''
    self.__wrapper__.cta_enter_long(self.__id__, stdCode, qty, usertag, limitp…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
2 replies
@chwei2ch
Comment options

@wondertrader
Comment options

Answer selected by wondertrader
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants