def __init__(self, gateway):
        """Constructor"""
        super(Api, self).__init__()

        self.gateway = gateway                  # gateway对象
        self.gatewayName = gateway.gatewayName  # gateway对象名称

        self.cbDict = {}
        self.tickDict = {}
        self.orderDict = {}

        self.lastOrderID = ''
        self.orderCondition = Condition()
        self.trade_password = False

        #self.initCallback()
        self.tradeFlag=False
        self.logger = rwLoggerFunction()
Exemple #2
0
    def __init__(self, ctaEngine, setting):
        """Constructor"""
        super(Price_Different, self).__init__(ctaEngine, setting)
        self.logger = rwLoggerFunction()
        self.dbCon = rwDbConnection()
        self.positionDict = {}
        self.tickDict = {}
        self.orderDict = {}
        self.tradeDict = {}
        self.messageFlag = False
        self.buySellFlag = 0
        self.positionDict_huobi = {}
        self.positionDict_okcoin = {}

        # 注意策略类中的可变对象属性(通常是list和dict等),在策略初始化时需要重新创建,
        # 否则会出现多个策略实例之间数据共享的情况,有可能导致潜在的策略逻辑错误风险,
        # 策略类中的这些可变对象属性可以选择不写,全都放在__init__下面,写主要是为了阅读
        # 策略时方便(更多是个编程习惯的选择)
        self.flag = False
Exemple #3
0
 def __init__(self, ctaEngine, setting):
     """Constructor"""
     super(Bolling, self).__init__(ctaEngine, setting)
     self.logger = rwLoggerFunction()
     self.dbCon = rwDbConnection()
     self.positionDict = {}