rqalpha 5.4.1__tar.gz → 5.4.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {rqalpha-5.4.1/rqalpha.egg-info → rqalpha-5.4.3}/PKG-INFO +1 -1
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/_version.py +3 -3
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/cmds/bundle.py +4 -1
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/data/bundle.py +54 -26
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/environment.py +6 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/interface.py +10 -7
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/mod/rqalpha_mod_sys_accounts/api/api_stock.py +39 -14
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/mod/rqalpha_mod_sys_simulation/matcher.py +3 -3
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/mod/rqalpha_mod_sys_transaction_cost/deciders.py +8 -0
- rqalpha-5.4.3/rqalpha/utils/translations/zh_Hans_CN/LC_MESSAGES/messages.mo +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/utils/translations/zh_Hans_CN/LC_MESSAGES/messages.po +50 -48
- {rqalpha-5.4.1 → rqalpha-5.4.3/rqalpha.egg-info}/PKG-INFO +1 -1
- {rqalpha-5.4.1 → rqalpha-5.4.3}/setup.cfg +1 -1
- {rqalpha-5.4.1 → rqalpha-5.4.3}/tests/api_tests/test_api_stock.py +4 -3
- rqalpha-5.4.1/rqalpha/utils/translations/zh_Hans_CN/LC_MESSAGES/messages.mo +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/CHANGELOG.rst +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/LICENSE +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/MANIFEST.in +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/README.rst +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/__init__.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/__main__.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/api.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/apis/__init__.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/apis/api_abstract.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/apis/api_base.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/apis/api_rqdatac.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/apis/names.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/cmds/__init__.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/cmds/entry.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/cmds/misc.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/cmds/mod.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/cmds/run.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/config.yml +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/const.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/core/__init__.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/core/events.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/core/execution_context.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/core/executor.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/core/global_var.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/core/strategy.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/core/strategy_context.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/core/strategy_loader.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/core/strategy_universe.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/data/__init__.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/data/bar_dict_price_board.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/data/base_data_source/__init__.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/data/base_data_source/adjust.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/data/base_data_source/data_source.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/data/base_data_source/storage_interface.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/data/base_data_source/storages.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/data/data_proxy.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/data/trading_dates_mixin.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/examples/IF1706_20161108.csv +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/examples/IF_macd.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/examples/buy_and_hold.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/examples/data_source/get_csv_module.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/examples/data_source/import_get_csv_module.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/examples/data_source/read_csv_as_df.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/examples/extend_api/rqalpha_mod_extend_api_demo.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/examples/extend_api/test_extend_api.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/examples/golden_cross.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/examples/macd.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/examples/pair_trading.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/examples/rsi.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/examples/run_code_demo.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/examples/run_file_demo.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/examples/run_func_demo.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/examples/subscribe_event.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/examples/test_pt.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/examples/turtle.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/main.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/mod/__init__.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/mod/rqalpha_mod_sys_accounts/__init__.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/mod/rqalpha_mod_sys_accounts/api/__init__.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/mod/rqalpha_mod_sys_accounts/api/api_future.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/mod/rqalpha_mod_sys_accounts/component_validator.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/mod/rqalpha_mod_sys_accounts/mod.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/mod/rqalpha_mod_sys_accounts/position_model.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/mod/rqalpha_mod_sys_accounts/position_validator.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/mod/rqalpha_mod_sys_accounts/validator.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/mod/rqalpha_mod_sys_analyser/__init__.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/mod/rqalpha_mod_sys_analyser/mod.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/mod/rqalpha_mod_sys_analyser/plot/__init__.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/mod/rqalpha_mod_sys_analyser/plot/consts.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/mod/rqalpha_mod_sys_analyser/plot/plot.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/mod/rqalpha_mod_sys_analyser/plot/utils.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/mod/rqalpha_mod_sys_analyser/plot_store.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/mod/rqalpha_mod_sys_analyser/report/__init__.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/mod/rqalpha_mod_sys_analyser/report/excel_template.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/mod/rqalpha_mod_sys_analyser/report/report.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/mod/rqalpha_mod_sys_analyser/report/templates/summary.xlsx +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/mod/rqalpha_mod_sys_progress/__init__.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/mod/rqalpha_mod_sys_progress/mod.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/mod/rqalpha_mod_sys_risk/__init__.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/mod/rqalpha_mod_sys_risk/mod.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/mod/rqalpha_mod_sys_risk/validators/__init__.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/mod/rqalpha_mod_sys_risk/validators/cash_validator.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/mod/rqalpha_mod_sys_risk/validators/is_trading_validator.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/mod/rqalpha_mod_sys_risk/validators/price_validator.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/mod/rqalpha_mod_sys_risk/validators/self_trade_validator.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/mod/rqalpha_mod_sys_scheduler/__init__.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/mod/rqalpha_mod_sys_scheduler/mod.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/mod/rqalpha_mod_sys_scheduler/scheduler.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/mod/rqalpha_mod_sys_simulation/__init__.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/mod/rqalpha_mod_sys_simulation/mod.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/mod/rqalpha_mod_sys_simulation/signal_broker.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/mod/rqalpha_mod_sys_simulation/simulation_broker.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/mod/rqalpha_mod_sys_simulation/simulation_event_source.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/mod/rqalpha_mod_sys_simulation/slippage.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/mod/rqalpha_mod_sys_simulation/testing.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/mod/rqalpha_mod_sys_simulation/validator.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/mod/rqalpha_mod_sys_transaction_cost/__init__.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/mod/rqalpha_mod_sys_transaction_cost/mod.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/mod/utils.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/mod_config.yml +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/model/__init__.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/model/bar.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/model/instrument.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/model/order.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/model/tick.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/model/trade.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/portfolio/__init__.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/portfolio/account.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/portfolio/position.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/resource/ricequant-logo.png +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/user_module.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/utils/__init__.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/utils/arg_checker.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/utils/class_helper.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/utils/click_helper.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/utils/concurrent.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/utils/config.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/utils/datetime_func.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/utils/dict_func.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/utils/exception.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/utils/functools.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/utils/i18n.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/utils/log_capture.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/utils/logger.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/utils/package_helper.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/utils/persisit_helper.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/utils/repr.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/utils/risk_free_helper.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/utils/rq_json.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/utils/strategy_loader_help.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/utils/testing/__init__.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/utils/testing/fixtures.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/utils/testing/mocking.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/utils/translations/__init__.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/utils/translations/zh_Hans_CN/LC_MESSAGES/__init__.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/utils/translations/zh_Hans_CN/__init__.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha/utils/typing.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha.egg-info/SOURCES.txt +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha.egg-info/dependency_links.txt +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha.egg-info/entry_points.txt +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha.egg-info/not-zip-safe +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha.egg-info/requires.txt +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/rqalpha.egg-info/top_level.txt +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/setup.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/tests/__init__.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/tests/api_tests/__init__.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/tests/api_tests/mod/__init__.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/tests/api_tests/mod/sys_accounts/__init__.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/tests/api_tests/mod/sys_accounts/test_account_model.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/tests/api_tests/mod/sys_accounts/test_futures_settlement_price_type.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/tests/api_tests/mod/sys_accounts/test_margin_stocks.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/tests/api_tests/mod/sys_accounts/test_position_models.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/tests/api_tests/mod/sys_scheduler/__init__.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/tests/api_tests/mod/sys_scheduler/test_physical_time.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/tests/api_tests/mod/sys_scheduler/test_scheduler.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/tests/api_tests/mod/sys_simulation/__init__.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/tests/api_tests/mod/sys_simulation/test_management_fee.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/tests/api_tests/mod/sys_simulation/test_match.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/tests/api_tests/mod/sys_simulation/test_signal_broker.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/tests/api_tests/mod/sys_simulation/test_simulation_broker.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/tests/api_tests/mod/sys_simulation/test_simulation_event_source.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/tests/api_tests/mod/sys_transaction_cost/__init__.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/tests/api_tests/mod/sys_transaction_cost/test_commission_multiplier.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/tests/api_tests/test_api_base.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/tests/api_tests/test_api_future.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/tests/api_tests/test_config.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/tests/api_tests/utils.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/tests/test_f_buy_and_hold.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/tests/test_f_delivery.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/tests/test_f_macd.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/tests/test_f_macd_signal.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/tests/test_f_mean_reverting.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/tests/test_f_tick_size.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/tests/test_s_buy_and_hold.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/tests/test_s_dual_thrust.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/tests/test_s_pit_tax.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/tests/test_s_scheduler.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/tests/test_s_tick_size.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/tests/test_s_turtle.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/tests/test_s_turtle_signal.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/tests/test_sf_buy_and_hold.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/tests/unittest/__init__.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/tests/unittest/test_data/__init__.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/tests/unittest/test_data/test_auto_update_bundle/__init__.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/tests/unittest/test_data/test_auto_update_bundle/test_auto_update_bundle_mixin.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/tests/unittest/test_data/test_instrument_mixin.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/tests/unittest/test_data/test_trading_dates_mixin.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/tests/unittest/test_mod/__init__.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/tests/unittest/test_mod/test_sys_simulation/__init__.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/tests/unittest/test_mod/test_sys_simulation/test_simulation_event_source.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/tests/utils.py +0 -0
- {rqalpha-5.4.1 → rqalpha-5.4.3}/versioneer.py +0 -0
|
@@ -8,11 +8,11 @@ import json
|
|
|
8
8
|
|
|
9
9
|
version_json = '''
|
|
10
10
|
{
|
|
11
|
-
"date": "2024-
|
|
11
|
+
"date": "2024-11-29T17:58:29+0800",
|
|
12
12
|
"dirty": false,
|
|
13
13
|
"error": null,
|
|
14
|
-
"full-revisionid": "
|
|
15
|
-
"version": "5.4.
|
|
14
|
+
"full-revisionid": "29a200367f13ec777ae5f96bafcd6da3add9007d",
|
|
15
|
+
"version": "5.4.3"
|
|
16
16
|
}
|
|
17
17
|
''' # END VERSION_JSON
|
|
18
18
|
|
|
@@ -19,6 +19,7 @@ import tempfile
|
|
|
19
19
|
import time
|
|
20
20
|
import datetime
|
|
21
21
|
import dateutil
|
|
22
|
+
import sys
|
|
22
23
|
|
|
23
24
|
import click
|
|
24
25
|
import requests
|
|
@@ -89,7 +90,9 @@ def update_bundle(data_bundle_path, rqdatac_uri, compression, concurrency):
|
|
|
89
90
|
return 1
|
|
90
91
|
|
|
91
92
|
from rqalpha.data.bundle import update_bundle as update_bundle_
|
|
92
|
-
update_bundle_(os.path.join(data_bundle_path, 'bundle'), False, compression, concurrency)
|
|
93
|
+
succeed = update_bundle_(os.path.join(data_bundle_path, 'bundle'), False, compression, concurrency)
|
|
94
|
+
if not succeed:
|
|
95
|
+
sys.exit(1)
|
|
93
96
|
|
|
94
97
|
|
|
95
98
|
@cli.command(help=_("Download bundle (monthly updated)"))
|
|
@@ -20,6 +20,9 @@ import re
|
|
|
20
20
|
from itertools import chain
|
|
21
21
|
from typing import Callable, Optional, Union, List
|
|
22
22
|
from filelock import FileLock, Timeout
|
|
23
|
+
import multiprocessing
|
|
24
|
+
from multiprocessing.sharedctypes import Synchronized
|
|
25
|
+
from ctypes import c_bool
|
|
23
26
|
|
|
24
27
|
import h5py
|
|
25
28
|
import numpy as np
|
|
@@ -28,9 +31,11 @@ from rqalpha.utils.concurrent import ProgressedProcessPoolExecutor, ProgressedTa
|
|
|
28
31
|
from rqalpha.utils.datetime_func import convert_date_to_date_int, convert_date_to_int
|
|
29
32
|
from rqalpha.utils.i18n import gettext as _
|
|
30
33
|
from rqalpha.utils.functools import lru_cache
|
|
34
|
+
from rqalpha.utils.logger import init_logger, system_log
|
|
31
35
|
from rqalpha.environment import Environment
|
|
32
36
|
from rqalpha.model.instrument import Instrument
|
|
33
37
|
|
|
38
|
+
|
|
34
39
|
START_DATE = 20050104
|
|
35
40
|
END_DATE = 29991231
|
|
36
41
|
|
|
@@ -310,24 +315,32 @@ class DayBarTask(ProgressedTask):
|
|
|
310
315
|
|
|
311
316
|
class GenerateDayBarTask(DayBarTask):
|
|
312
317
|
def __call__(self, path, fields, **kwargs):
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
318
|
+
try:
|
|
319
|
+
h5 = h5py.File(path, "w")
|
|
320
|
+
except OSError:
|
|
321
|
+
system_log.error("File {} update failed, if it is using, please update later, "
|
|
322
|
+
"or you can delete then update again".format(path))
|
|
323
|
+
sval.value = False
|
|
324
|
+
yield 1
|
|
325
|
+
else:
|
|
326
|
+
with h5:
|
|
327
|
+
i, step = 0, 300
|
|
328
|
+
while True:
|
|
329
|
+
order_book_ids = self._order_book_ids[i:i + step]
|
|
330
|
+
df = rqdatac.get_price(order_book_ids, START_DATE, datetime.date.today(), '1d',
|
|
331
|
+
adjust_type='none', fields=fields, expect_df=True)
|
|
332
|
+
if not (df is None or df.empty):
|
|
333
|
+
df.reset_index(inplace=True)
|
|
334
|
+
df['datetime'] = [convert_date_to_int(d) for d in df['date']]
|
|
335
|
+
del df['date']
|
|
336
|
+
df.set_index(['order_book_id', 'datetime'], inplace=True)
|
|
337
|
+
df.sort_index(inplace=True)
|
|
338
|
+
for order_book_id in df.index.levels[0]:
|
|
339
|
+
h5.create_dataset(order_book_id, data=df.loc[order_book_id].to_records(), **kwargs)
|
|
340
|
+
i += step
|
|
341
|
+
yield len(order_book_ids)
|
|
342
|
+
if i >= len(self._order_book_ids):
|
|
343
|
+
break
|
|
331
344
|
|
|
332
345
|
|
|
333
346
|
class UpdateDayBarTask(DayBarTask):
|
|
@@ -353,12 +366,15 @@ class UpdateDayBarTask(DayBarTask):
|
|
|
353
366
|
if need_recreate_h5:
|
|
354
367
|
yield from GenerateDayBarTask(self._order_book_ids)(path, fields, **kwargs)
|
|
355
368
|
else:
|
|
369
|
+
h5 = None
|
|
356
370
|
try:
|
|
357
371
|
h5 = h5py.File(path, 'a')
|
|
358
372
|
except OSError:
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
373
|
+
system_log.error("File {} update failed, if it is using, please update later, "
|
|
374
|
+
"or you can delete then update again".format(path))
|
|
375
|
+
sval.value = False
|
|
376
|
+
yield 1
|
|
377
|
+
else:
|
|
362
378
|
is_futures = "futures" == os.path.basename(path).split(".")[0]
|
|
363
379
|
for order_book_id in self._order_book_ids:
|
|
364
380
|
# 特殊处理前复权合约,需要全量更新
|
|
@@ -367,8 +383,11 @@ class UpdateDayBarTask(DayBarTask):
|
|
|
367
383
|
try:
|
|
368
384
|
last_date = int(h5[order_book_id]['datetime'][-1] // 1000000)
|
|
369
385
|
except OSError:
|
|
370
|
-
|
|
371
|
-
|
|
386
|
+
system_log.error("File {} update failed, if it is using, please update later, "
|
|
387
|
+
"or you can delete then update again".format(path))
|
|
388
|
+
sval.value = False
|
|
389
|
+
yield 1
|
|
390
|
+
break
|
|
372
391
|
except ValueError:
|
|
373
392
|
h5.pop(order_book_id)
|
|
374
393
|
start_date = START_DATE
|
|
@@ -396,14 +415,20 @@ class UpdateDayBarTask(DayBarTask):
|
|
|
396
415
|
h5.create_dataset(order_book_id, data=df.to_records(), **kwargs)
|
|
397
416
|
yield 1
|
|
398
417
|
finally:
|
|
399
|
-
h5
|
|
418
|
+
if h5:
|
|
419
|
+
h5.close()
|
|
400
420
|
|
|
401
421
|
|
|
402
|
-
def
|
|
422
|
+
def process_init(args: Optional[Synchronized] = None):
|
|
403
423
|
import warnings
|
|
404
424
|
with warnings.catch_warnings(record=True):
|
|
405
425
|
# catch warning: rqdatac is already inited. Settings will be changed
|
|
406
426
|
rqdatac.init()
|
|
427
|
+
init_logger()
|
|
428
|
+
# Initialize process shared variables
|
|
429
|
+
if args:
|
|
430
|
+
global sval
|
|
431
|
+
sval = args
|
|
407
432
|
|
|
408
433
|
|
|
409
434
|
def update_bundle(path, create, enable_compression=False, concurrency=1):
|
|
@@ -412,6 +437,7 @@ def update_bundle(path, create, enable_compression=False, concurrency=1):
|
|
|
412
437
|
else:
|
|
413
438
|
_DayBarTask = UpdateDayBarTask
|
|
414
439
|
|
|
440
|
+
init_logger()
|
|
415
441
|
kwargs = {}
|
|
416
442
|
if enable_compression:
|
|
417
443
|
kwargs['compression'] = 9
|
|
@@ -430,14 +456,16 @@ def update_bundle(path, create, enable_compression=False, concurrency=1):
|
|
|
430
456
|
gen_suspended_days, gen_yield_curve, gen_share_transformation, gen_future_info
|
|
431
457
|
)
|
|
432
458
|
|
|
459
|
+
succeed = multiprocessing.Value(c_bool, True)
|
|
433
460
|
with ProgressedProcessPoolExecutor(
|
|
434
|
-
max_workers=concurrency, initializer=
|
|
461
|
+
max_workers=concurrency, initializer=process_init, initargs=(succeed, )
|
|
435
462
|
) as executor:
|
|
436
463
|
# windows上子进程需要执行rqdatac.init, 其他os则需要执行rqdatac.reset; rqdatac.init包含了rqdatac.reset的功能
|
|
437
464
|
for func in gen_file_funcs:
|
|
438
465
|
executor.submit(GenerateFileTask(func), path)
|
|
439
466
|
for file, order_book_id, field in day_bar_args:
|
|
440
467
|
executor.submit(_DayBarTask(order_book_id), os.path.join(path, file), field, **kwargs)
|
|
468
|
+
return succeed.value
|
|
441
469
|
|
|
442
470
|
|
|
443
471
|
class AutomaticUpdateBundle(object):
|
|
@@ -26,8 +26,10 @@ from rqalpha.const import INSTRUMENT_TYPE
|
|
|
26
26
|
from rqalpha.utils.logger import system_log, user_log, user_system_log
|
|
27
27
|
from rqalpha.core.global_var import GlobalVars
|
|
28
28
|
from rqalpha.utils.i18n import gettext as _
|
|
29
|
+
from rqalpha.const import SIDE
|
|
29
30
|
if TYPE_CHECKING:
|
|
30
31
|
from rqalpha.model.order import Order
|
|
32
|
+
|
|
31
33
|
|
|
32
34
|
|
|
33
35
|
class Environment(object):
|
|
@@ -183,6 +185,10 @@ class Environment(object):
|
|
|
183
185
|
|
|
184
186
|
def get_trade_tax(self, trade):
|
|
185
187
|
return self._get_transaction_cost_decider(trade.order_book_id).get_trade_tax(trade)
|
|
188
|
+
|
|
189
|
+
def get_transaction_cost_with_value(self, value: float) -> float:
|
|
190
|
+
side = SIDE.BUY if value >= 0 else SIDE.SELL
|
|
191
|
+
return self._transaction_cost_decider_dict[INSTRUMENT_TYPE.CS].get_transaction_cost_with_value(abs(value), side)
|
|
186
192
|
|
|
187
193
|
def get_trade_commission(self, trade):
|
|
188
194
|
return self._get_transaction_cost_decider(trade.order_book_id).get_trade_commission(trade)
|
|
@@ -30,7 +30,7 @@ from rqalpha.model.tick import TickObject
|
|
|
30
30
|
from rqalpha.model.order import Order
|
|
31
31
|
from rqalpha.model.trade import Trade
|
|
32
32
|
from rqalpha.model.instrument import Instrument
|
|
33
|
-
from rqalpha.const import POSITION_DIRECTION, TRADING_CALENDAR_TYPE, INSTRUMENT_TYPE
|
|
33
|
+
from rqalpha.const import POSITION_DIRECTION, TRADING_CALENDAR_TYPE, INSTRUMENT_TYPE, SIDE
|
|
34
34
|
|
|
35
35
|
|
|
36
36
|
class AbstractPosition(with_metaclass(abc.ABCMeta)):
|
|
@@ -675,25 +675,28 @@ class AbstractTransactionCostDecider((with_metaclass(abc.ABCMeta))):
|
|
|
675
675
|
订单税费计算接口,通过实现次接口可以定义不同市场、不同合约的个性化税费计算逻辑。
|
|
676
676
|
"""
|
|
677
677
|
@abc.abstractmethod
|
|
678
|
-
def get_trade_tax(self, trade):
|
|
679
|
-
# type: (Trade) -> float
|
|
678
|
+
def get_trade_tax(self, trade: Trade) -> float:
|
|
680
679
|
"""
|
|
681
680
|
计算指定交易应付的印花税
|
|
682
681
|
"""
|
|
683
682
|
raise NotImplementedError
|
|
684
683
|
|
|
685
684
|
@abc.abstractmethod
|
|
686
|
-
def get_trade_commission(self, trade):
|
|
687
|
-
# type: (Trade) -> float
|
|
685
|
+
def get_trade_commission(self, trade: Trade) -> float:
|
|
688
686
|
"""
|
|
689
687
|
计算指定交易应付的佣金
|
|
690
688
|
"""
|
|
691
689
|
raise NotImplementedError
|
|
692
690
|
|
|
693
691
|
@abc.abstractmethod
|
|
694
|
-
def get_order_transaction_cost(self, order):
|
|
695
|
-
# type: (Order) -> float
|
|
692
|
+
def get_order_transaction_cost(self, order: Order) -> float:
|
|
696
693
|
"""
|
|
697
694
|
计算指定订单应付的交易成本(税 + 费)
|
|
698
695
|
"""
|
|
699
696
|
raise NotImplementedError
|
|
697
|
+
|
|
698
|
+
def get_transaction_cost_with_value(self, value: float, side: SIDE) -> float:
|
|
699
|
+
"""
|
|
700
|
+
计算指定价格交易应付的交易成本(税 + 费)
|
|
701
|
+
"""
|
|
702
|
+
raise NotImplementedError
|
|
@@ -18,7 +18,9 @@
|
|
|
18
18
|
import datetime
|
|
19
19
|
from decimal import Decimal, getcontext
|
|
20
20
|
from itertools import chain
|
|
21
|
-
from typing import Dict, List, Optional, Union, Tuple
|
|
21
|
+
from typing import Dict, List, Optional, Union, Tuple, Callable
|
|
22
|
+
import math
|
|
23
|
+
from collections import defaultdict
|
|
22
24
|
|
|
23
25
|
import numpy as np
|
|
24
26
|
import pandas as pd
|
|
@@ -70,14 +72,14 @@ def _get_account_position_ins(id_or_ins):
|
|
|
70
72
|
return account, position, ins
|
|
71
73
|
|
|
72
74
|
|
|
73
|
-
def _round_order_quantity(ins, quantity) -> int:
|
|
75
|
+
def _round_order_quantity(ins, quantity, method: Callable = int) -> int:
|
|
74
76
|
if ins.type == "CS" and ins.board_type == "KSH":
|
|
75
77
|
# KSH can buy(sell) 201, 202 shares
|
|
76
78
|
return 0 if abs(quantity) < KSH_MIN_AMOUNT else int(quantity)
|
|
77
79
|
else:
|
|
78
80
|
round_lot = ins.round_lot
|
|
79
81
|
try:
|
|
80
|
-
return
|
|
82
|
+
return method(Decimal(quantity) / Decimal(round_lot)) * round_lot
|
|
81
83
|
except ValueError:
|
|
82
84
|
raise
|
|
83
85
|
|
|
@@ -372,8 +374,18 @@ def order_target_portfolio(
|
|
|
372
374
|
order_book_id, quantity, SIDE.SELL, MarketOrder(), POSITION_EFFECT.CLOSE
|
|
373
375
|
))
|
|
374
376
|
|
|
375
|
-
account_value
|
|
377
|
+
account_value = account.total_value
|
|
378
|
+
if total_percent == 1:
|
|
379
|
+
# 在此处形成的订单不包含交易费用,需要预留一点余额以供交易费用使用
|
|
380
|
+
estimate_transaction_cost = 0
|
|
381
|
+
for order_book_id, (target_percent, open_style, close_style, last_price) in target.items():
|
|
382
|
+
current_value = current_quantities.get(order_book_id, 0) * last_price
|
|
383
|
+
change_value = target_percent * account_value - current_value
|
|
384
|
+
estimate_transaction_cost += env.get_transaction_cost_with_value(change_value)
|
|
385
|
+
account_value = account_value - estimate_transaction_cost
|
|
386
|
+
|
|
376
387
|
close_orders, open_orders = [], []
|
|
388
|
+
waiting_to_buy = defaultdict()
|
|
377
389
|
for order_book_id, (target_percent, open_style, close_style, last_price) in target.items():
|
|
378
390
|
open_price = _get_order_style_price(order_book_id, open_style)
|
|
379
391
|
close_price = _get_order_style_price(order_book_id, close_style)
|
|
@@ -383,23 +395,36 @@ def order_target_portfolio(
|
|
|
383
395
|
)
|
|
384
396
|
env.order_creation_failed(order_book_id=order_book_id, reason=reason)
|
|
385
397
|
continue
|
|
386
|
-
|
|
387
398
|
delta_quantity = (account_value * target_percent / close_price) - current_quantities.get(order_book_id, 0)
|
|
388
|
-
delta_quantity = _round_order_quantity(env.data_proxy.instrument(order_book_id), delta_quantity)
|
|
399
|
+
delta_quantity = _round_order_quantity(env.data_proxy.instrument(order_book_id), delta_quantity, method=round)
|
|
400
|
+
|
|
401
|
+
# 优先生成卖单,以便计算出剩余现金,进行买单数量的计算
|
|
389
402
|
if delta_quantity == 0:
|
|
390
403
|
continue
|
|
391
404
|
elif delta_quantity > 0:
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
target_style = open_style
|
|
405
|
+
waiting_to_buy[order_book_id] = (delta_quantity, POSITION_EFFECT.OPEN, open_style, last_price)
|
|
406
|
+
continue
|
|
395
407
|
else:
|
|
396
408
|
quantity, side, position_effect = abs(delta_quantity), SIDE.SELL, POSITION_EFFECT.CLOSE
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
409
|
+
order = Order.__from_create__(order_book_id, quantity, side, close_style, position_effect)
|
|
410
|
+
if isinstance(close_style, MarketOrder):
|
|
411
|
+
order.set_frozen_price(last_price)
|
|
412
|
+
close_orders.append(order)
|
|
413
|
+
|
|
414
|
+
estimate_cash = account.cash + sum([o.quantity * o.frozen_price - env.get_order_transaction_cost(o) for o in close_orders])
|
|
415
|
+
for order_book_id, (delta_quantity, position_effect, open_style, last_price) in waiting_to_buy.items():
|
|
416
|
+
cost = delta_quantity * last_price + env.get_transaction_cost_with_value(delta_quantity * last_price)
|
|
417
|
+
if cost > estimate_cash:
|
|
418
|
+
delta_quantity = estimate_cash / last_price
|
|
419
|
+
delta_quantity = _round_order_quantity(env.data_proxy.instrument(order_book_id), delta_quantity)
|
|
420
|
+
if delta_quantity == 0:
|
|
421
|
+
continue
|
|
422
|
+
cost = delta_quantity * last_price + env.get_transaction_cost_with_value(delta_quantity * last_price)
|
|
423
|
+
order = Order.__from_create__(order_book_id, delta_quantity, SIDE.BUY, open_style, position_effect)
|
|
424
|
+
if isinstance(open_style, MarketOrder):
|
|
401
425
|
order.set_frozen_price(last_price)
|
|
402
|
-
|
|
426
|
+
open_orders.append(order)
|
|
427
|
+
estimate_cash -= cost
|
|
403
428
|
|
|
404
429
|
return list(env.submit_order(o) for o in chain(close_orders, open_orders))
|
|
405
430
|
|
|
@@ -123,7 +123,7 @@ class DefaultBarMatcher(AbstractMatcher):
|
|
|
123
123
|
listed_date=listed_date,
|
|
124
124
|
)
|
|
125
125
|
elif isinstance(order.style, ALGO_ORDER_STYLES):
|
|
126
|
-
reason = _(u"Order Cancelled: {order_book_id} bar no volume").format(order_book_id=order.order_book_id)
|
|
126
|
+
reason = _(u"Order Cancelled: {order_book_id} miss market data or bar no volume.").format(order_book_id=order.order_book_id)
|
|
127
127
|
else:
|
|
128
128
|
# 撮合的时候无行情数据也不需要撤单,等到有行情再撮合
|
|
129
129
|
reason = None
|
|
@@ -210,7 +210,7 @@ class DefaultBarMatcher(AbstractMatcher):
|
|
|
210
210
|
trade._commission = self._env.get_trade_commission(trade)
|
|
211
211
|
trade._tax = self._env.get_trade_tax(trade)
|
|
212
212
|
|
|
213
|
-
if order.
|
|
213
|
+
if order.position_effect == POSITION_EFFECT.OPEN and self._slippage_decider.decider.rate != 0:
|
|
214
214
|
# 标的价格经过滑点处理后,账户资金可能不够买入,需要进行验证
|
|
215
215
|
cost_money = instrument.calc_cash_occupation(price, order.quantity, order.position_direction, order.trading_datetime.date())
|
|
216
216
|
cost_money += trade.transaction_cost
|
|
@@ -467,7 +467,7 @@ class DefaultTickMatcher(AbstractMatcher):
|
|
|
467
467
|
trade._commission = self._env.get_trade_commission(trade)
|
|
468
468
|
trade._tax = self._env.get_trade_tax(trade)
|
|
469
469
|
|
|
470
|
-
if order.
|
|
470
|
+
if order.position_effect == POSITION_EFFECT.OPEN and self._slippage_decider.decider.rate != 0:
|
|
471
471
|
cost_money = instrument.calc_cash_occupation(price, order.quantity, order.position_direction, order.trading_datetime.date())
|
|
472
472
|
cost_money += trade.transaction_cost
|
|
473
473
|
if cost_money > account.cash + order.init_frozen_cash:
|
|
@@ -77,6 +77,9 @@ class StockTransactionCostDecider(AbstractTransactionCostDecider):
|
|
|
77
77
|
commission = self._get_order_commission(order.order_book_id, order.side, order.frozen_price, order.quantity)
|
|
78
78
|
tax = self._get_tax(order.order_book_id, order.side, order.frozen_price * order.quantity)
|
|
79
79
|
return tax + commission
|
|
80
|
+
|
|
81
|
+
def get_transaction_cost_with_value(self, value: float, side: SIDE) -> float:
|
|
82
|
+
raise NotImplementedError
|
|
80
83
|
|
|
81
84
|
|
|
82
85
|
class CNStockTransactionCostDecider(StockTransactionCostDecider):
|
|
@@ -99,6 +102,11 @@ class CNStockTransactionCostDecider(StockTransactionCostDecider):
|
|
|
99
102
|
else:
|
|
100
103
|
self.tax_rate = 0.0005
|
|
101
104
|
|
|
105
|
+
def get_transaction_cost_with_value(self, value: float, side: SIDE) -> float:
|
|
106
|
+
tax = value * self.tax_rate * self.tax_multiplier if side == SIDE.SELL else 0
|
|
107
|
+
commission = max(value * self.commission_rate * self.commission_multiplier, self.min_commission)
|
|
108
|
+
return tax + commission
|
|
109
|
+
|
|
102
110
|
|
|
103
111
|
class CNFutureTransactionCostDecider(AbstractTransactionCostDecider):
|
|
104
112
|
def __init__(self, commission_multiplier):
|