def __init__(self, args): plt.style.use('seaborn-white') plt.rc('grid', linestyle="dotted", color='#a0a0a0') plt.rcParams['axes.edgecolor'] = "#04383F" plt.rcParams['figure.figsize'] = (12, 6) print("\n--* Eiten has been initialized...") self.args = args # Create data engine self.dataEngine = DataEngine(args) # Monto carlo simulator self.simulator = MontoCarloSimulator() # Strategy manager self.strategyManager = StrategyManager() # Back tester self.backTester = BackTester() # Data dictionary self.data_dictionary = {} print('\n')
def __init__(self): print("\n--* Eiten has been initialized...") self.HISTORY_TO_USE = history_to_use self.DATA_GRANULARITY_MINUTES = data_granularity_minutes self.FUTURE_BARS_FOR_TESTING = future_bars self.APPLY_NOISE_FILTERING = apply_noise_filtering self.IS_LONG_ONLY_PORTFOLIO = is_only_long self.MARKET_INDEX = market_index self.IS_TEST = is_test self.EIGEN_PORTFOLIO_NUMBER = eigen_portfolio_number self.STOCKS_FILE_PATH = stocks_file_path # Create data engine self.dataEngine = DataEngine(self.HISTORY_TO_USE, self.DATA_GRANULARITY_MINUTES, self.FUTURE_BARS_FOR_TESTING, self.MARKET_INDEX, self.IS_TEST, self.STOCKS_FILE_PATH) # Monto carlo simulator self.simulator = MontoCarloSimulator() # Strategy manager self.strategyManager = StrategyManager() # Back tester self.backTester = BackTester() # Data dictionary self.data_dictionary = {} print('\n')
mylog.info("walkswing", "game begin") SYMBOL = "SHFE.rb2010" api = TqApi(TqSim()) klines = api.get_kline_serial(SYMBOL, 60, BAR_LENGTH) day_klines = api.get_kline_serial(SYMBOL, 24 * 60 * 60) serial = api.get_tick_serial(SYMBOL) # 账户情况 account = api.get_account() print(account) # 运行时记录 avg_recorder = AvgRecorder("AvgRecord", 60) pos_manage = PositionManger(api, SYMBOL) strage_manager = StrategyManager(pos_manage, SYMBOL) mc_indictor = McIndictors(SYMBOL, strage_manager) mc_indictor.set_avg_recorder(avg_recorder) strage_manager.set_indictor(mc_indictor) strage_manager.set_avg_record(avg_recorder) pos_manage.set_logger(mylog) strage_manager.set_logger(mylog) strage_manager.set_indictor(mc_indictor) mc_indictor.set_logger(mylog) avg_recorder.set_logger(mylog) strage_manager.update_day_klines(day_klines) strage_manager.load_setting() # 策略 stg_watcher = StrategyWatcher(SYMBOL, strage_manager) strage_manager.add(stg_watcher)
"""定义c接口的回调""" from strategy_manager import StrategyManager # 全局变量manager strategy_manager = StrategyManager() def on_recv_market(m): """收到了行情数据 m对象在cython模块定义""" strategy_manager.recv_market(m) def on_recv_order_deal(deal): """收到了订单逐笔成交信息, deal对象在cython模块定义""" strategy_manager.recv_order_deal(deal)