def load_setting(self): """""" setting = load_json(self.setting_filename) if not setting: return self.update_setting(setting)
def load_backtesting_setting(self): """""" setting = load_json(self.setting_filename) if not setting: return self.class_combo.setCurrentIndex( self.class_combo.findText(setting["class_name"]) ) self.symbol_line.setText(setting["vt_symbol"]) self.interval_combo.setCurrentIndex( self.interval_combo.findText(setting["interval"]) ) self.rate_line.setText(str(setting["rate"])) self.slippage_line.setText(str(setting["slippage"])) self.size_line.setText(str(setting["size"])) self.pricetick_line.setText(str(setting["pricetick"])) self.capital_line.setText(str(setting["capital"])) if not setting["inverse"]: self.inverse_combo.setCurrentIndex(0) else: self.inverse_combo.setCurrentIndex(1)
def load_algo_setting(self): """""" self.algo_settings = load_json(self.setting_filename) for setting_name, setting in self.algo_settings.items(): self.put_setting_event(setting_name, setting) self.write_log("算法配置载入成功")
def load_setting(self) -> None: """""" setting = load_json(self.setting_filename) if setting: self.trade_slippage = setting["trade_slippage"] self.timer_interval = setting["timer_interval"] self.instant_trade = setting["instant_trade"]
def load_strategy_setting(self): """ Load setting file. """ self.strategy_setting = load_json(self.setting_filename) for strategy_name, strategy_config in self.strategy_setting.items(): self.add_strategy(strategy_config["class_name"], strategy_name, strategy_config["vt_symbol"], strategy_config["setting"])
def load_data(self) -> None: """""" position_data = load_json(self.data_filename) for d in position_data: vt_symbol = d["vt_symbol"] direction = Direction(d["direction"]) position = self.get_position(vt_symbol, direction) position.volume = d["volume"] position.price = d["price"]
def load_setting(self) -> None: """""" setting = load_json(self.setting_filename) for spread_setting in setting: self.add_spread( spread_setting["name"], spread_setting["leg_settings"], spread_setting["active_symbol"], spread_setting.get("min_volume", 1), save=False )
def load_setting(self): """""" setting: dict = load_json(self.setting_filename) for d in setting.values(): self.add_strategy( d["name"], d["vt_symbol"], d["size"], d["net_pos"], d["open_price"], d["last_price"], d["create_time"], d["note_text"], )
def load_strategy_data(self): """ Load strategy data from json file. """ self.strategy_data = load_json(self.data_filename)
def load_setting(self): """""" setting = load_json(self.setting_filename) self.tick_recordings = setting.get("tick", {}) self.bar_recordings = setting.get("bar", {})