Esempio n. 1
0
    def set_params(self):
        period = self.cbx_period.currentText().strip()
        ema_fast = self.txt_ema_fast.toPlainText().strip()
        ema_slow = self.txt_ema_slow.toPlainText().strip()
        open_offset = self.txt_open_offset.toPlainText().strip()
        open_interval = self.txt_open_interval.toPlainText().strip()
        stop_earning_offset = self.txt_stop_earning_offset.toPlainText().strip(
        )
        stop_loss_offset = self.txt_stop_loss_offset.toPlainText().strip()
        level_rate = self.txt_level_rate.toPlainText().strip()
        max_number = self.txt_max_num.toPlainText().strip()

        file = 'config.xml'
        config_helper = ConfigHelper(file)
        config_to_save = ConfigData()
        ret = config_helper.init_root()
        if ret:
            config_helper.parse(config_to_save)
            config_to_save._period = period
            config_to_save._ema_fast = ema_fast
            config_to_save._ema_slow = ema_slow
            config_to_save._open_offset = open_offset
            config_to_save._open_interval = open_interval
            config_to_save._stop_earning_offset = stop_earning_offset
            config_to_save._level_rate = level_rate
            config_to_save._max_open_number = max_number
            config_helper.save(config_to_save)
        else:
            QMessageBox.information(self, '提示', '配置文件config.xml出错')
Esempio n. 2
0
 def get_registration_info(self):
     file = 'config.xml'
     config_helper = ConfigHelper(file)
     config = ConfigData()
     ret = config_helper.init_root()
     if ret:
         config_helper.parse(config)
         self.txt_registration_info.setText(config._qds_id)
     else:
         QMessageBox.information(self, '提示', '配置文件config.xml出错')
Esempio n. 3
0
 def get_authorize(self):
     file = 'config.xml'
     config_helper = ConfigHelper(file)
     config = ConfigData()
     ret = config_helper.init_root()
     if ret:
         config_helper.parse(config)
         self.txt_access_key.setText(config._access_key)
         self.txt_secret_key.setText(config._secret_key)
     else:
         QMessageBox.information(self, '提示', '配置文件config.xml出错')
Esempio n. 4
0
 def save_registration_info(self):
     registration_info = self.txt_registration_info.toPlainText().strip()
     if not registration_info:
         QMessageBox.information(self, '提示', '注册信息不完整')
         return
     file = 'config.xml'
     config_helper = ConfigHelper(file)
     config_to_save = ConfigData()
     ret = config_helper.init_root()
     if ret:
         config_helper.parse(config_to_save)
         config_to_save._qds_id = registration_info
         config_helper.save(config_to_save)
         QMessageBox.information(self, '提示', '信息已保存, 重启软件生效')
     else:
         QMessageBox.information(self, '警告', '配置文件config.xml出错')
Esempio n. 5
0
 def set_authorize(self):
     access_key = self.txt_access_key.toPlainText().strip()
     secret_key = self.txt_secret_key.toPlainText().strip()
     if not access_key or not secret_key:
         QMessageBox.information(self, '提示', '信息不完整')
         return
     file = 'config.xml'
     config_helper = ConfigHelper(file)
     config_to_save = ConfigData()
     ret = config_helper.init_root()
     if ret:
         config_helper.parse(config_to_save)
         config_to_save._access_key = access_key
         config_to_save._secret_key = secret_key
         config_helper.save(config_to_save)
         QMessageBox.information(self, '提示', '信息已保存,重启软件生效')
     else:
         QMessageBox.information(self, '提示', '配置文件config.xml出错')
Esempio n. 6
0
 def get_params(self):
     file = 'config.xml'
     config_helper = ConfigHelper(file)
     config = ConfigData()
     global g_config
     g_config = config
     ret = config_helper.init_root()
     if ret:
         config_helper.parse(config)
         self.cbx_period.setCurrentText(config._period)
         self.txt_ema_fast.setText(config._ema_fast)
         self.txt_ema_slow.setText(config._ema_slow)
         self.txt_open_offset.setText(config._open_offset)
         self.txt_open_interval.setText(config._open_interval)
         self.txt_stop_earning_offset.setText(config._stop_earning_offset)
         self.txt_stop_loss_offset.setText("0")
         self.txt_level_rate.setText(config._level_rate)
         self.txt_max_num.setText(config._max_open_number)
     else:
         QMessageBox.information(self, '提示', '配置文件config.xml出错')
Esempio n. 7
0
                    filemode='w',  ##模式,有w和a,w就是写模式,每次都会重新写日志,覆盖之前的日志
                    # a是追加模式,默认如果不写的话,就是追加模式
                    format='%(asctime)s : %(message)s'
                    # '%(asctime)s - %(pathname)s[line:%(lineno)d] - %(levelname)s: %(message)s'
                    # 日志格式
                    )

URL = 'https://api.btcgateway.pro'


file = 'config.xml'
config_helper = ConfigHelper(file)
config = ConfigData()
ret = config_helper.init_root()
if ret:
    config_helper.parse(config)
else:
    logging.debug("Error, please check file {0}".format(file))
    sys.exit(-1)

ACCESS_KEY = config._access_key
SECRET_KEY = config._secret_key

dm = ReliableHuobiDM(URL, ACCESS_KEY, SECRET_KEY)

# 1min, 5min, 15min, 30min, 60min,4hour,1day, 1mon
period = config._period
# ma快线周期
ma_fast = int(config._ema_fast)
# ma慢线周期
ma_slow = int(config._ema_slow)