rqalpha 5.5.2__tar.gz → 5.5.4__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.5.2/rqalpha.egg-info → rqalpha-5.5.4}/PKG-INFO +1 -1
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/_version.py +3 -3
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/apis/api_rqdatac.py +9 -5
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/environment.py +3 -3
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/main.py +1 -2
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/mod/rqalpha_mod_sys_accounts/position_model.py +5 -2
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/portfolio/position.py +84 -3
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/utils/testing/fixtures.py +8 -2
- {rqalpha-5.5.2 → rqalpha-5.5.4/rqalpha.egg-info}/PKG-INFO +1 -1
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha.egg-info/SOURCES.txt +1 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/setup.cfg +1 -1
- rqalpha-5.5.4/tests/api_tests/test_position_queue.py +445 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/CHANGELOG.rst +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/LICENSE +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/MANIFEST.in +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/README.rst +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/__init__.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/__main__.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/api.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/apis/__init__.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/apis/api_abstract.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/apis/api_base.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/apis/names.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/cmds/__init__.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/cmds/bundle.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/cmds/entry.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/cmds/misc.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/cmds/mod.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/cmds/run.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/config.yml +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/const.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/core/__init__.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/core/events.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/core/execution_context.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/core/executor.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/core/global_var.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/core/strategy.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/core/strategy_context.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/core/strategy_loader.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/core/strategy_universe.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/data/__init__.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/data/bar_dict_price_board.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/data/base_data_source/__init__.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/data/base_data_source/adjust.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/data/base_data_source/data_source.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/data/base_data_source/storage_interface.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/data/base_data_source/storages.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/data/bundle.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/data/data_proxy.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/data/trading_dates_mixin.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/examples/IF1706_20161108.csv +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/examples/IF_macd.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/examples/buy_and_hold.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/examples/data_source/get_csv_module.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/examples/data_source/import_get_csv_module.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/examples/data_source/read_csv_as_df.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/examples/extend_api/rqalpha_mod_extend_api_demo.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/examples/extend_api/test_extend_api.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/examples/golden_cross.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/examples/macd.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/examples/pair_trading.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/examples/rsi.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/examples/run_code_demo.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/examples/run_file_demo.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/examples/run_func_demo.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/examples/subscribe_event.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/examples/test_pt.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/examples/turtle.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/interface.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/mod/__init__.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/mod/rqalpha_mod_sys_accounts/__init__.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/mod/rqalpha_mod_sys_accounts/api/__init__.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/mod/rqalpha_mod_sys_accounts/api/api_future.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/mod/rqalpha_mod_sys_accounts/api/api_stock.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/mod/rqalpha_mod_sys_accounts/component_validator.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/mod/rqalpha_mod_sys_accounts/mod.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/mod/rqalpha_mod_sys_accounts/position_validator.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/mod/rqalpha_mod_sys_accounts/validator.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/mod/rqalpha_mod_sys_analyser/__init__.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/mod/rqalpha_mod_sys_analyser/mod.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/mod/rqalpha_mod_sys_analyser/plot/__init__.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/mod/rqalpha_mod_sys_analyser/plot/consts.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/mod/rqalpha_mod_sys_analyser/plot/plot.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/mod/rqalpha_mod_sys_analyser/plot/utils.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/mod/rqalpha_mod_sys_analyser/plot_store.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/mod/rqalpha_mod_sys_analyser/report/__init__.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/mod/rqalpha_mod_sys_analyser/report/excel_template.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/mod/rqalpha_mod_sys_analyser/report/report.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/mod/rqalpha_mod_sys_analyser/report/templates/summary.xlsx +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/mod/rqalpha_mod_sys_progress/__init__.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/mod/rqalpha_mod_sys_progress/mod.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/mod/rqalpha_mod_sys_risk/__init__.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/mod/rqalpha_mod_sys_risk/mod.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/mod/rqalpha_mod_sys_risk/validators/__init__.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/mod/rqalpha_mod_sys_risk/validators/cash_validator.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/mod/rqalpha_mod_sys_risk/validators/is_trading_validator.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/mod/rqalpha_mod_sys_risk/validators/price_validator.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/mod/rqalpha_mod_sys_risk/validators/self_trade_validator.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/mod/rqalpha_mod_sys_scheduler/__init__.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/mod/rqalpha_mod_sys_scheduler/mod.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/mod/rqalpha_mod_sys_scheduler/scheduler.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/mod/rqalpha_mod_sys_simulation/__init__.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/mod/rqalpha_mod_sys_simulation/matcher.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/mod/rqalpha_mod_sys_simulation/mod.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/mod/rqalpha_mod_sys_simulation/signal_broker.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/mod/rqalpha_mod_sys_simulation/simulation_broker.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/mod/rqalpha_mod_sys_simulation/simulation_event_source.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/mod/rqalpha_mod_sys_simulation/slippage.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/mod/rqalpha_mod_sys_simulation/testing.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/mod/rqalpha_mod_sys_simulation/validator.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/mod/rqalpha_mod_sys_transaction_cost/__init__.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/mod/rqalpha_mod_sys_transaction_cost/deciders.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/mod/rqalpha_mod_sys_transaction_cost/mod.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/mod/utils.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/mod_config.yml +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/model/__init__.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/model/bar.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/model/instrument.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/model/order.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/model/tick.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/model/trade.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/portfolio/__init__.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/portfolio/account.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/resource/ricequant-logo.png +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/user_module.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/utils/__init__.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/utils/arg_checker.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/utils/class_helper.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/utils/click_helper.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/utils/concurrent.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/utils/config.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/utils/datetime_func.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/utils/dict_func.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/utils/exception.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/utils/functools.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/utils/i18n.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/utils/log_capture.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/utils/logger.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/utils/package_helper.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/utils/persisit_helper.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/utils/repr.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/utils/risk_free_helper.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/utils/rq_json.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/utils/strategy_loader_help.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/utils/testing/__init__.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/utils/testing/mocking.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/utils/translations/__init__.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/utils/translations/zh_Hans_CN/LC_MESSAGES/__init__.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/utils/translations/zh_Hans_CN/LC_MESSAGES/messages.mo +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/utils/translations/zh_Hans_CN/LC_MESSAGES/messages.po +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/utils/translations/zh_Hans_CN/__init__.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha/utils/typing.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha.egg-info/dependency_links.txt +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha.egg-info/entry_points.txt +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha.egg-info/not-zip-safe +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha.egg-info/requires.txt +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/rqalpha.egg-info/top_level.txt +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/setup.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/tests/__init__.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/tests/api_tests/__init__.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/tests/api_tests/mod/__init__.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/tests/api_tests/mod/sys_accounts/__init__.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/tests/api_tests/mod/sys_accounts/test_account_model.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/tests/api_tests/mod/sys_accounts/test_futures_settlement_price_type.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/tests/api_tests/mod/sys_accounts/test_margin_stocks.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/tests/api_tests/mod/sys_accounts/test_position_models.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/tests/api_tests/mod/sys_scheduler/__init__.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/tests/api_tests/mod/sys_scheduler/test_physical_time.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/tests/api_tests/mod/sys_scheduler/test_scheduler.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/tests/api_tests/mod/sys_simulation/__init__.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/tests/api_tests/mod/sys_simulation/test_management_fee.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/tests/api_tests/mod/sys_simulation/test_match.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/tests/api_tests/mod/sys_simulation/test_signal_broker.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/tests/api_tests/mod/sys_simulation/test_simulation_broker.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/tests/api_tests/mod/sys_simulation/test_simulation_event_source.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/tests/api_tests/mod/sys_transaction_cost/__init__.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/tests/api_tests/mod/sys_transaction_cost/test_commission_multiplier.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/tests/api_tests/test_api_base.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/tests/api_tests/test_api_future.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/tests/api_tests/test_api_stock.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/tests/api_tests/test_config.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/tests/api_tests/utils.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/tests/test_f_buy_and_hold.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/tests/test_f_delivery.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/tests/test_f_macd.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/tests/test_f_macd_signal.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/tests/test_f_mean_reverting.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/tests/test_f_tick_size.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/tests/test_s_buy_and_hold.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/tests/test_s_dual_thrust.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/tests/test_s_pit_tax.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/tests/test_s_scheduler.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/tests/test_s_tick_size.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/tests/test_s_turtle.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/tests/test_s_turtle_signal.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/tests/test_sf_buy_and_hold.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/tests/unittest/__init__.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/tests/unittest/test_data/__init__.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/tests/unittest/test_data/test_auto_update_bundle/__init__.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/tests/unittest/test_data/test_auto_update_bundle/test_auto_update_bundle_mixin.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/tests/unittest/test_data/test_instrument_mixin.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/tests/unittest/test_data/test_trading_dates_mixin.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/tests/unittest/test_mod/__init__.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/tests/unittest/test_mod/test_sys_simulation/__init__.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/tests/unittest/test_mod/test_sys_simulation/test_simulation_event_source.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/tests/utils.py +0 -0
- {rqalpha-5.5.2 → rqalpha-5.5.4}/versioneer.py +0 -0
|
@@ -8,11 +8,11 @@ import json
|
|
|
8
8
|
|
|
9
9
|
version_json = '''
|
|
10
10
|
{
|
|
11
|
-
"date": "2025-
|
|
11
|
+
"date": "2025-05-27T16:58:35+0800",
|
|
12
12
|
"dirty": false,
|
|
13
13
|
"error": null,
|
|
14
|
-
"full-revisionid": "
|
|
15
|
-
"version": "5.5.
|
|
14
|
+
"full-revisionid": "6de68c9350eb08aacd72d6694ad40eeec076b7c7",
|
|
15
|
+
"version": "5.5.4"
|
|
16
16
|
}
|
|
17
17
|
''' # END VERSION_JSON
|
|
18
18
|
|
|
@@ -429,8 +429,8 @@ def get_securities_margin(
|
|
|
429
429
|
order_book_ids, # type: Union[str, Iterable[str]]
|
|
430
430
|
count=1, # type: Optional[int]
|
|
431
431
|
fields=None, # type: Optional[str]
|
|
432
|
-
expect_df=
|
|
433
|
-
): # type: (...) -> Union[pd.Series, pd.DataFrame
|
|
432
|
+
expect_df=True # type: Optional[bool]
|
|
433
|
+
): # type: (...) -> Union[pd.Series, pd.DataFrame]
|
|
434
434
|
"""
|
|
435
435
|
获取融资融券信息。包括 `深证融资融券数据 <http://www.szse.cn/main/disclosure/rzrqxx/rzrqjy/>`_ 以及 `上证融资融券数据 <http://www.sse.com.cn/market/othersdata/margin/detail/>`_ 情况。既包括个股数据,也包括市场整体数据。需要注意,融资融券的开始日期为2010年3月31日。
|
|
436
436
|
|
|
@@ -524,11 +524,15 @@ def get_securities_margin(
|
|
|
524
524
|
start_dt = dt
|
|
525
525
|
else:
|
|
526
526
|
start_dt = data_proxy.get_previous_trading_date(dt, count - 1)
|
|
527
|
-
|
|
527
|
+
|
|
528
|
+
overall_code = {"XSHG", "XSHE", "sh", "sz"}
|
|
528
529
|
if isinstance(order_book_ids, six.string_types):
|
|
529
|
-
order_book_ids
|
|
530
|
+
if order_book_ids not in overall_code:
|
|
531
|
+
order_book_ids = assure_order_book_id(order_book_ids)
|
|
530
532
|
else:
|
|
531
|
-
|
|
533
|
+
overall_code_list = [i for i in order_book_ids if i in overall_code]
|
|
534
|
+
order_book_ids = [assure_order_book_id(i) for i in order_book_ids if i not in overall_code]
|
|
535
|
+
order_book_ids = order_book_ids + overall_code_list
|
|
532
536
|
|
|
533
537
|
return rqdatac.get_securities_margin(order_book_ids, start_dt, dt, fields=fields, expect_df=expect_df)
|
|
534
538
|
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
# 在此前提下,对本软件的使用同样需要遵守 Apache 2.0 许可,Apache 2.0 许可与本许可冲突之处,以本许可为准。
|
|
16
16
|
# 详细的授权流程,请联系 public@ricequant.com 获取。
|
|
17
17
|
|
|
18
|
-
from datetime import datetime
|
|
18
|
+
from datetime import date, datetime
|
|
19
19
|
from typing import Optional, Dict, List
|
|
20
20
|
from itertools import chain
|
|
21
21
|
from typing import TYPE_CHECKING
|
|
@@ -53,8 +53,8 @@ class Environment(object):
|
|
|
53
53
|
self.user_system_log = user_system_log
|
|
54
54
|
self.event_bus = EventBus()
|
|
55
55
|
self.portfolio = None # type: Optional[rqalpha.portfolio.Portfolio]
|
|
56
|
-
self.calendar_dt =
|
|
57
|
-
self.trading_dt =
|
|
56
|
+
self.calendar_dt: datetime = datetime.combine(config.base.start_date, datetime.min.time())
|
|
57
|
+
self.trading_dt: datetime = datetime.combine(config.base.start_date, datetime.min.time())
|
|
58
58
|
self.mod_dict = None
|
|
59
59
|
self.user_strategy = None
|
|
60
60
|
self._frontend_validators = {} # type: Dict[str, List]
|
|
@@ -312,6 +312,5 @@ def set_loggers(config):
|
|
|
312
312
|
for logger_name, level in extra_config.logger:
|
|
313
313
|
getattr(logger, logger_name).level = getattr(logbook, level.upper())
|
|
314
314
|
|
|
315
|
-
if extra_config
|
|
315
|
+
if getattr(extra_config, "log_file", None):
|
|
316
316
|
logbook.FileHandler(filename=extra_config.log_file, mode="a").push_application()
|
|
317
|
-
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
# 否则米筐科技有权追究相应的知识产权侵权责任。
|
|
15
15
|
# 在此前提下,对本软件的使用同样需要遵守 Apache 2.0 许可,Apache 2.0 许可与本许可冲突之处,以本许可为准。
|
|
16
16
|
# 详细的授权流程,请联系 public@ricequant.com 获取。
|
|
17
|
-
|
|
17
|
+
from collections import deque
|
|
18
18
|
from datetime import date
|
|
19
19
|
|
|
20
20
|
from decimal import Decimal
|
|
@@ -150,6 +150,7 @@ class StockPosition(Position):
|
|
|
150
150
|
if self.cash_return_by_stock_delisted:
|
|
151
151
|
delta_cash = self.market_value
|
|
152
152
|
self._quantity = self._old_quantity = 0
|
|
153
|
+
self._queue.clear()
|
|
153
154
|
return delta_cash
|
|
154
155
|
|
|
155
156
|
@cached_property
|
|
@@ -212,7 +213,7 @@ class StockPosition(Position):
|
|
|
212
213
|
# int(6000 * 1.15) -> 6899
|
|
213
214
|
self._old_quantity = self._quantity = round(Decimal(self._quantity) * ratio)
|
|
214
215
|
self._logical_old_quantity = round(Decimal(self._logical_old_quantity) * ratio)
|
|
215
|
-
|
|
216
|
+
self._queue.handle_split(ratio, self._quantity)
|
|
216
217
|
|
|
217
218
|
class FuturePosition(Position):
|
|
218
219
|
__repr_properties__ = (
|
|
@@ -282,6 +283,7 @@ class FuturePosition(Position):
|
|
|
282
283
|
self._transaction_cost += trade.transaction_cost
|
|
283
284
|
self._quantity -= trade.last_quantity
|
|
284
285
|
self._trade_cost -= trade.last_price * trade.last_quantity
|
|
286
|
+
self._queue.handle_trade(-trade.last_quantity, self._env.trading_dt.date(), close_today=True)
|
|
285
287
|
else:
|
|
286
288
|
super(FuturePosition, self).apply_trade(trade)
|
|
287
289
|
|
|
@@ -325,6 +327,7 @@ class FuturePosition(Position):
|
|
|
325
327
|
)
|
|
326
328
|
self._env.event_bus.publish_event(Event(EVENT.TRADE, account=account, trade=trade, order=None))
|
|
327
329
|
self._quantity = self._old_quantity = 0
|
|
330
|
+
self._queue.clear()
|
|
328
331
|
return delta_cash
|
|
329
332
|
|
|
330
333
|
def post_settlement(self):
|
|
@@ -15,9 +15,10 @@
|
|
|
15
15
|
# 在此前提下,对本软件的使用同样需要遵守 Apache 2.0 许可,Apache 2.0 许可与本许可冲突之处,以本许可为准。
|
|
16
16
|
# 详细的授权流程,请联系 public@ricequant.com 获取。
|
|
17
17
|
|
|
18
|
-
from collections import UserDict
|
|
18
|
+
from collections import UserDict, deque
|
|
19
19
|
from datetime import date
|
|
20
|
-
from
|
|
20
|
+
from decimal import Decimal
|
|
21
|
+
from typing import Dict, Iterable, Tuple, Optional, Deque, List
|
|
21
22
|
|
|
22
23
|
from rqalpha.const import POSITION_DIRECTION, POSITION_EFFECT
|
|
23
24
|
from rqalpha.environment import Environment
|
|
@@ -91,6 +92,10 @@ class Position(AbstractPosition, metaclass=PositionMeta):
|
|
|
91
92
|
|
|
92
93
|
self._direction_factor = 1 if direction == POSITION_DIRECTION.LONG else -1
|
|
93
94
|
|
|
95
|
+
self._queue = PositionQueue()
|
|
96
|
+
if init_quantity:
|
|
97
|
+
self._queue.handle_trade(init_quantity, self._env.trading_dt.date())
|
|
98
|
+
|
|
94
99
|
@property
|
|
95
100
|
def order_book_id(self):
|
|
96
101
|
# type: () -> str
|
|
@@ -193,7 +198,8 @@ class Position(AbstractPosition, metaclass=PositionMeta):
|
|
|
193
198
|
"avg_price": self._avg_price,
|
|
194
199
|
"trade_cost": self._trade_cost,
|
|
195
200
|
"transaction_cost": self._transaction_cost,
|
|
196
|
-
"prev_close": self._prev_close
|
|
201
|
+
"prev_close": self._prev_close,
|
|
202
|
+
"position_queue": list(self._queue.queue)
|
|
197
203
|
}
|
|
198
204
|
|
|
199
205
|
def set_state(self, state):
|
|
@@ -209,6 +215,7 @@ class Position(AbstractPosition, metaclass=PositionMeta):
|
|
|
209
215
|
self._trade_cost = state.get("trade_cost", 0)
|
|
210
216
|
self._transaction_cost = state.get("transaction_cost", 0)
|
|
211
217
|
self._prev_close = state.get("prev_close")
|
|
218
|
+
self._queue.set_sate(state.get("position_queue", []))
|
|
212
219
|
|
|
213
220
|
def before_trading(self, trading_date):
|
|
214
221
|
# type: (date) -> float
|
|
@@ -225,6 +232,7 @@ class Position(AbstractPosition, metaclass=PositionMeta):
|
|
|
225
232
|
# 返回总资金的变化量
|
|
226
233
|
self._transaction_cost += trade.transaction_cost
|
|
227
234
|
if trade.position_effect == POSITION_EFFECT.OPEN:
|
|
235
|
+
self._queue.handle_trade(trade.last_quantity, self._env.trading_dt.date())
|
|
228
236
|
if self._quantity < 0:
|
|
229
237
|
self._avg_price = trade.last_price if self._quantity + trade.last_quantity > 0 else 0
|
|
230
238
|
else:
|
|
@@ -235,6 +243,7 @@ class Position(AbstractPosition, metaclass=PositionMeta):
|
|
|
235
243
|
return (-1 * trade.last_price * trade.last_quantity) - trade.transaction_cost
|
|
236
244
|
elif trade.position_effect == POSITION_EFFECT.CLOSE:
|
|
237
245
|
# 先平昨,后平今
|
|
246
|
+
self._queue.handle_trade(-trade.last_quantity, self._env.trading_dt.date())
|
|
238
247
|
self._old_quantity -= min(trade.last_quantity, self._old_quantity)
|
|
239
248
|
self._quantity -= trade.last_quantity
|
|
240
249
|
self._trade_cost -= trade.last_price * trade.last_quantity
|
|
@@ -255,6 +264,15 @@ class Position(AbstractPosition, metaclass=PositionMeta):
|
|
|
255
264
|
def calc_close_today_amount(self, trade_amount, position_effect):
|
|
256
265
|
return 0
|
|
257
266
|
|
|
267
|
+
@property
|
|
268
|
+
def position_queue(self):
|
|
269
|
+
# type: () -> deque[tuple[date, int]]
|
|
270
|
+
"""
|
|
271
|
+
获取持仓队列,返回每笔持仓的开仓时间和数量
|
|
272
|
+
格式为 [(开仓日期, 持仓数量), ...]
|
|
273
|
+
"""
|
|
274
|
+
return self._queue.queue
|
|
275
|
+
|
|
258
276
|
@property
|
|
259
277
|
def _open_orders(self):
|
|
260
278
|
# type: () -> Iterable[Order]
|
|
@@ -263,6 +281,69 @@ class Position(AbstractPosition, metaclass=PositionMeta):
|
|
|
263
281
|
yield order
|
|
264
282
|
|
|
265
283
|
|
|
284
|
+
class PositionQueue:
|
|
285
|
+
def __init__(self):
|
|
286
|
+
self._queue: Deque[Tuple[date, int]] = deque()
|
|
287
|
+
|
|
288
|
+
def set_sate(self, state: List[Tuple[date, int]]):
|
|
289
|
+
self._queue = deque(state)
|
|
290
|
+
|
|
291
|
+
def handle_trade(self, delta_quantity, trading_date: date, close_today: bool = False):
|
|
292
|
+
if delta_quantity == 0:
|
|
293
|
+
return
|
|
294
|
+
if self._queue and self._queue[0][1] * delta_quantity < 0:
|
|
295
|
+
# 从正平仓到负或者从负平仓到正
|
|
296
|
+
if close_today:
|
|
297
|
+
# 强制先平今
|
|
298
|
+
d, qty_in_queue = self._queue[-1]
|
|
299
|
+
if d >= trading_date:
|
|
300
|
+
if abs(qty_in_queue) <= abs(delta_quantity):
|
|
301
|
+
delta_quantity += qty_in_queue
|
|
302
|
+
self._queue.pop()
|
|
303
|
+
else:
|
|
304
|
+
self._queue[-1] = (d, qty_in_queue + delta_quantity)
|
|
305
|
+
delta_quantity = 0
|
|
306
|
+
while delta_quantity and self._queue:
|
|
307
|
+
d, qty_in_queue = self._queue[0]
|
|
308
|
+
if abs(qty_in_queue) <= abs(delta_quantity):
|
|
309
|
+
# 当前持仓批次全部平掉
|
|
310
|
+
delta_quantity += qty_in_queue
|
|
311
|
+
self._queue.popleft()
|
|
312
|
+
else:
|
|
313
|
+
# 当前持仓批次部分平掉
|
|
314
|
+
self._queue[0] = (d, qty_in_queue + delta_quantity)
|
|
315
|
+
delta_quantity = 0
|
|
316
|
+
if delta_quantity != 0:
|
|
317
|
+
# queue 消耗光了,delta_quantity 还没消耗完
|
|
318
|
+
self._queue.append((trading_date, delta_quantity))
|
|
319
|
+
else:
|
|
320
|
+
# 开仓
|
|
321
|
+
if self._queue and self._queue[-1][0] == trading_date:
|
|
322
|
+
# 当日已有开仓,更新数量
|
|
323
|
+
_, quantity = self._queue.pop()
|
|
324
|
+
self._queue.append((trading_date, quantity + delta_quantity))
|
|
325
|
+
else:
|
|
326
|
+
# 当日首次开仓
|
|
327
|
+
self._queue.append((trading_date, delta_quantity))
|
|
328
|
+
|
|
329
|
+
def handle_split(self, ratio: Decimal, expected_quantity):
|
|
330
|
+
self._queue = deque(
|
|
331
|
+
(d, round(Decimal(q) * ratio)) for d, q in self._queue
|
|
332
|
+
)
|
|
333
|
+
diff = expected_quantity - sum(q for _, q in self._queue)
|
|
334
|
+
if diff != 0:
|
|
335
|
+
# 有可能因为 round 的原因导致差1股
|
|
336
|
+
self._queue[-1] = (self._queue[-1][0], self._queue[-1][1] + diff)
|
|
337
|
+
|
|
338
|
+
|
|
339
|
+
def clear(self):
|
|
340
|
+
self._queue.clear()
|
|
341
|
+
|
|
342
|
+
@property
|
|
343
|
+
def queue(self):
|
|
344
|
+
return self._queue.copy()
|
|
345
|
+
|
|
346
|
+
|
|
266
347
|
class PositionProxy(metaclass=PositionProxyMeta):
|
|
267
348
|
__repr_properties__ = (
|
|
268
349
|
"order_book_id", "positions"
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import os
|
|
2
2
|
import pickle
|
|
3
3
|
from contextlib import contextmanager
|
|
4
|
+
from datetime import date
|
|
4
5
|
|
|
5
6
|
import six
|
|
6
7
|
|
|
@@ -18,7 +19,11 @@ class RQAlphaFixture(object):
|
|
|
18
19
|
class EnvironmentFixture(RQAlphaFixture):
|
|
19
20
|
def __init__(self, *args, **kwargs):
|
|
20
21
|
super(EnvironmentFixture, self).__init__(*args, **kwargs)
|
|
21
|
-
self.env_config = {
|
|
22
|
+
self.env_config = {
|
|
23
|
+
"base":{
|
|
24
|
+
"start_date": date(2016, 1, 1)
|
|
25
|
+
}
|
|
26
|
+
}
|
|
22
27
|
self.env = None
|
|
23
28
|
|
|
24
29
|
def init_fixture(self):
|
|
@@ -72,7 +77,8 @@ class BaseDataSourceFixture(TempDirFixture, EnvironmentFixture):
|
|
|
72
77
|
|
|
73
78
|
self.env_config = {
|
|
74
79
|
"base": {
|
|
75
|
-
"accounts": {"STOCK": 100}
|
|
80
|
+
"accounts": {"STOCK": 100},
|
|
81
|
+
"start_date": date(2016, 1, 1),
|
|
76
82
|
}
|
|
77
83
|
}
|
|
78
84
|
|
|
@@ -176,6 +176,7 @@ tests/api_tests/test_api_base.py
|
|
|
176
176
|
tests/api_tests/test_api_future.py
|
|
177
177
|
tests/api_tests/test_api_stock.py
|
|
178
178
|
tests/api_tests/test_config.py
|
|
179
|
+
tests/api_tests/test_position_queue.py
|
|
179
180
|
tests/api_tests/utils.py
|
|
180
181
|
tests/api_tests/mod/__init__.py
|
|
181
182
|
tests/api_tests/mod/sys_accounts/__init__.py
|