pfund 0.0.1.dev4__tar.gz → 0.0.1.dev5__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.
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/PKG-INFO +86 -38
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/README.md +84 -32
- pfund-0.0.1.dev5/pfund/CONTRIBUTING.md +16 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/__init__.py +6 -1
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/adapter.py +1 -1
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/cli/commands/config.py +3 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/cli/commands/docker_compose.py +4 -2
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/config/bybit/config.yml +1 -1
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/config_handler.py +1 -4
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/const/paths.py +4 -3
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/datas/resolution.py +1 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/engines/backtest_engine.py +8 -1
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/exchanges/bybit/exchange.py +9 -16
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/exchanges/exchange_base.py +1 -1
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/mixins/backtest.py +11 -1
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/models/model_base.py +7 -1
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/plogging/__init__.py +5 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/strategies/strategy_base.py +9 -2
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/utils/aliases.py +5 -1
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pyproject.toml +14 -6
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/LICENSE +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/accounts/__init__.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/accounts/account_base.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/accounts/account_crypto.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/accounts/account_ib.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/balances/__init__.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/balances/balance_base.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/balances/balance_crypto.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/balances/balance_ib.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/brokers/__init__.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/brokers/broker_backtest.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/brokers/broker_base.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/brokers/broker_crypto.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/brokers/broker_live.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/brokers/ib/__init__.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/brokers/ib/broker_ib.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/brokers/ib/ib_api.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/brokers/ib/ib_client.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/brokers/ib/ib_wrapper.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/cli/__init__.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/cli/commands/__init__.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/cli/main.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/config/bybit/lot_sizes_inverse.yml +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/config/bybit/lot_sizes_linear.yml +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/config/bybit/lot_sizes_option.yml +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/config/bybit/lot_sizes_spot.yml +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/config/bybit/pdt_matchings_inverse.yml +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/config/bybit/pdt_matchings_linear.yml +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/config/bybit/pdt_matchings_option.yml +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/config/bybit/pdt_matchings_spot.yml +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/config/bybit/tick_sizes_inverse.yml +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/config/bybit/tick_sizes_linear.yml +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/config/bybit/tick_sizes_option.yml +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/config/bybit/tick_sizes_spot.yml +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/config/configuration.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/config/ib/config.yml +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/config/logging.yml +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/const/__init__.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/const/_zmq_routes.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/const/commons.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/data_tools/data_tool_base.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/data_tools/data_tool_pandas.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/datas/__init__.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/datas/data_bar.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/datas/data_base.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/datas/data_quote.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/datas/data_tick.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/datas/data_time_based.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/datas/timeframe.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/engines/__init__.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/engines/base_engine.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/engines/test_engine.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/engines/trade_engine.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/engines/train_engine.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/errors.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/exchanges/__init__.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/exchanges/bybit/__init__.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/exchanges/bybit/rest_api.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/exchanges/bybit/rest_api_samples/get_markets_result_inverse +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/exchanges/bybit/rest_api_samples/get_markets_result_linear +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/exchanges/bybit/rest_api_samples/get_markets_result_option +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/exchanges/bybit/rest_api_samples/get_markets_result_spot +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/exchanges/bybit/rest_api_samples/get_markets_return_inverse +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/exchanges/bybit/rest_api_samples/get_markets_return_linear +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/exchanges/bybit/rest_api_samples/get_markets_return_option +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/exchanges/bybit/rest_api_samples/get_markets_return_spot +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/exchanges/bybit/types.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/exchanges/bybit/ws_api.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/exchanges/rest_api_base.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/exchanges/ws_api_base.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/externals/ibapi/__init__.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/externals/ibapi/account_summary_tags.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/externals/ibapi/client.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/externals/ibapi/comm.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/externals/ibapi/commission_report.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/externals/ibapi/common.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/externals/ibapi/connection.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/externals/ibapi/contract.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/externals/ibapi/decoder.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/externals/ibapi/enum_implem.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/externals/ibapi/errors.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/externals/ibapi/execution.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/externals/ibapi/ibapi.pyproj +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/externals/ibapi/message.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/externals/ibapi/news.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/externals/ibapi/object_implem.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/externals/ibapi/order.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/externals/ibapi/order_condition.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/externals/ibapi/order_state.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/externals/ibapi/orderdecoder.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/externals/ibapi/reader.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/externals/ibapi/scanner.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/externals/ibapi/server_versions.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/externals/ibapi/softdollartier.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/externals/ibapi/tag_value.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/externals/ibapi/ticktype.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/externals/ibapi/utils.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/externals/ibapi/wrapper.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/indicators/__init__.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/indicators/indicator_base.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/indicators/ta_indicator.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/indicators/talib_indicator.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/main.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/managers/__init__.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/managers/base_manager.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/managers/connection_manager.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/managers/data_manager.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/managers/order_manager.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/managers/portfolio_manager.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/managers/risk_manager.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/managers/strategy_manager.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/models/__init__.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/models/model_backtest.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/models/model_meta.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/models/pytorch_model.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/models/sklearn_model.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/orders/__init__.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/orders/order_base.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/orders/order_crypto.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/orders/order_ib.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/orders/order_statuses.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/orders/order_time_in_force.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/plogging/config.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/plogging/filters.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/plogging/formatter.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/plogging/handlers.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/portfolio.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/positions/__init__.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/positions/position_base.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/positions/position_crypto.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/positions/position_ib.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/products/__init__.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/products/product_base.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/products/product_crypto.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/products/product_ib.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/risk_monitor.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/strategies/__init__.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/strategies/strategy_backtest.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/strategies/strategy_meta.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/utils/envs.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/utils/utils.py +0 -0
- {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/zeromq.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: pfund
|
|
3
|
-
Version: 0.0.1.
|
|
3
|
+
Version: 0.0.1.dev5
|
|
4
4
|
Summary: A Complete Algo-Trading Framework for Machine Learning, enabling trading across TradFi, CeFi and DeFi. Supports Vectorized and Event-Driven Backtesting, Paper and Live Trading
|
|
5
5
|
Home-page: https://pfund.ai
|
|
6
6
|
License: Apache-2.0
|
|
@@ -14,8 +14,7 @@ Classifier: Programming Language :: Python :: 3.10
|
|
|
14
14
|
Classifier: Programming Language :: Python :: 3.11
|
|
15
15
|
Requires-Dist: click (>=8.1.7,<9.0.0)
|
|
16
16
|
Requires-Dist: orjson (>=3.9.14,<4.0.0)
|
|
17
|
-
Requires-Dist:
|
|
18
|
-
Requires-Dist: pfeed (>=0.0.1.dev4,<0.0.2)
|
|
17
|
+
Requires-Dist: pfeed (>=0.0.1.dev5,<0.0.2)
|
|
19
18
|
Requires-Dist: platformdirs (>=4.2.0,<5.0.0)
|
|
20
19
|
Requires-Dist: psutil (>=5.9.8,<6.0.0)
|
|
21
20
|
Requires-Dist: python-telegram-bot (>=20.7,<21.0)
|
|
@@ -23,35 +22,52 @@ Requires-Dist: pyyaml (>=6.0.1,<7.0.0)
|
|
|
23
22
|
Requires-Dist: pyzmq (>=25.1.2,<26.0.0)
|
|
24
23
|
Requires-Dist: rich (>=13.7.0,<14.0.0)
|
|
25
24
|
Requires-Dist: schedule (>=1.2.1,<2.0.0)
|
|
26
|
-
Requires-Dist: scikit-learn (>=1.4.0,<2.0.0)
|
|
27
25
|
Requires-Dist: ta (>=0.11.0,<0.12.0)
|
|
28
|
-
Requires-Dist: torch (>=2.1.2,<3.0.0)
|
|
29
26
|
Requires-Dist: websocket-client (>=1.7.0,<2.0.0)
|
|
30
|
-
Project-URL: Documentation, https://pfund.ai
|
|
27
|
+
Project-URL: Documentation, https://pfund-docs.pfund.ai
|
|
31
28
|
Project-URL: Repository, https://github.com/PFund-Software-Ltd/pfund
|
|
32
29
|
Description-Content-Type: text/markdown
|
|
33
30
|
|
|
34
31
|
# PFund: Algo-Trading Framework for Machine Learning, TradFi, CeFi and DeFi ready.
|
|
35
32
|
|
|
36
|
-
|
|
37
|
-
|
|
33
|
+

|
|
34
|
+

|
|
38
35
|
[](https://pypi.org/project/pfund)
|
|
39
36
|

|
|
37
|
+
[](https://jupyterbook.org)
|
|
39
|
+
[](https://python-poetry.org/)
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
[TradFi]: https://www.techopedia.com/definition/traditional-finance-tradfi
|
|
42
|
+
[CeFi]: https://www.techopedia.com/definition/centralized-finance-cefi
|
|
43
|
+
[DeFi]: https://www.coinbase.com/learn/crypto-basics/what-is-defi
|
|
44
|
+
[pytrade.org]: https://pytrade.org
|
|
45
|
+
[dYdX]: https://dydx.exchange
|
|
46
|
+
[polars]: https://pola.rs/
|
|
47
|
+
[PFund.ai]: https://pfund.ai
|
|
48
|
+
[PFeed]: https://github.com/PFund-Software-Ltd/pfeed
|
|
49
|
+
[Bybit]: https://bybit.com/
|
|
50
|
+
[PyTorch]: https://pytorch.org/
|
|
51
|
+
[Poetry]: https://python-poetry.org
|
|
52
|
+
[Futu]: https://www.futunn.com
|
|
53
|
+
[FirstRate Data]: https://firstratedata.com
|
|
54
|
+
[Mantine UI]: https://ui.mantine.dev/
|
|
55
|
+
|
|
56
|
+
PFund (/piː fʌnd/), which stands for "**Personal Fund**", is an **algo-trading framework** designed for using **machine learning** models to trade across [TradFi] (Traditional Finance, e.g. **Interactive Brokers**), [CeFi] (Centralized Finance, e.g. Binance) and [DeFi] (Decentralized Finance, e.g. [dYdX]), or in simple terms, **Stocks** and **Cryptos**.
|
|
42
57
|
|
|
43
58
|
PFund allows traders to:
|
|
44
59
|
- perform vectorized or event-driven backtesting with
|
|
45
60
|
- different resolutions of data, e.g. orderbook data, tick data, bar data etc.
|
|
46
|
-
- different data tools, e.g. pandas, [polars]
|
|
61
|
+
- different data tools, e.g. pandas, [polars] etc.
|
|
47
62
|
- train machine learning models using their favorite frameworks, i.e. PFund is **ML-framework agnostic**
|
|
48
63
|
- tune strategy (hyper)parameters by splitting data into training sets, development sets and test sets
|
|
49
64
|
- go from backtesting to live trading by just changing **ONE line of code!!**
|
|
65
|
+
- execute trades manually/semi-manually via a trading app (frontend+backend)
|
|
50
66
|
|
|
51
|
-
It is created to enable trading for [PFund.ai]
|
|
67
|
+
It is created to enable trading for [PFund.ai] - a trading platform that bridges algo-trading and manual trading using AI (LLM).
|
|
52
68
|
|
|
53
69
|
Since PFund's sole purpose is for trading only, for all the data work, there is a separate library to handle that: \
|
|
54
|
-
[PFeed]
|
|
70
|
+
[PFeed] - Data pipeline for algo-trading, helping traders in getting real-time and historical data, and storing them in a local data lake for quantitative research.
|
|
55
71
|
|
|
56
72
|
|
|
57
73
|
<details>
|
|
@@ -78,12 +94,12 @@ Since PFund's sole purpose is for trading only, for all the data work, there is
|
|
|
78
94
|
**_Caution: PFund is at a VERY EARLY stage, use it at your own risk._**
|
|
79
95
|
|
|
80
96
|
PFund is currently under active development, the framework design will be prioritized first over
|
|
81
|
-
stability and scalability.
|
|
97
|
+
stability and scalability.
|
|
82
98
|
|
|
83
99
|
Please note that the available version is a *dev* version, not a *stable* one. \
|
|
84
100
|
You are encouraged to play with the *dev* version, but only use it when a *stable* version is released.
|
|
85
101
|
|
|
86
|
-
> PFund for the time being **_only supports vectorized backtesting_** using [Bybit]
|
|
102
|
+
> PFund for the time being **_only supports vectorized backtesting_** using [Bybit] and Yahoo Finance data for testing purpose.
|
|
87
103
|
|
|
88
104
|
|
|
89
105
|
## Mission
|
|
@@ -99,7 +115,7 @@ As an algo-trader, if you aim to quickly try out some trading ideas to see if th
|
|
|
99
115
|
|
|
100
116
|
This overview already omits some intricate steps, such as data handling and API integration.
|
|
101
117
|
|
|
102
|
-
> PFund's mission is to **_enable traders to concentrate solely on strategy formulation_** while the framework manages the rest. With PFund serving as the core trade engine, it empowers retail traders to have a fund management experience on [PFund.ai]
|
|
118
|
+
> PFund's mission is to **_enable traders to concentrate solely on strategy formulation_** while the framework manages the rest. With PFund serving as the core trade engine, it empowers retail traders to have a fund management experience on [PFund.ai] as if they are operating their personal hedge fund, hence the name *PFund*.
|
|
103
119
|
|
|
104
120
|
|
|
105
121
|
## Core Features
|
|
@@ -110,20 +126,36 @@ This overview already omits some intricate steps, such as data handling and API
|
|
|
110
126
|
- [x] Streamlines the algo-trading flow, from vectorized backtesting for strategy prototyping and event-driven backtesting for strategy development, to live trading for strategy deployment
|
|
111
127
|
- [x] Enables parallel data processing, e.g. Interactive Brokers and Binance each have their own process for receiving data feeds
|
|
112
128
|
- [ ] Allows choosing your preferred data tool, e.g. pandas, polars, pyspark etc.
|
|
113
|
-
- [ ] Features a modern frontend using [Mantine UI]
|
|
114
|
-
|
|
129
|
+
- [ ] Features a modern frontend using [Mantine UI] and TradingView's Charts library
|
|
130
|
+
- [ ] Supports manual/semi-manual trading using the frontend
|
|
115
131
|
|
|
116
132
|
|
|
117
133
|
## Installation
|
|
118
|
-
|
|
134
|
+
> Python 3.12 is not supported until [PyTorch]supports it
|
|
135
|
+
|
|
136
|
+
### Using [Poetry] (Recommended)
|
|
119
137
|
```bash
|
|
120
138
|
poetry add pfund
|
|
139
|
+
|
|
140
|
+
# update to the latest version:
|
|
141
|
+
poetry update pfund
|
|
121
142
|
```
|
|
122
143
|
|
|
123
144
|
|
|
124
145
|
### Using Pip
|
|
125
146
|
```bash
|
|
126
147
|
pip install pfund
|
|
148
|
+
|
|
149
|
+
# install the latest version:
|
|
150
|
+
pip install -U pfund
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
### Checking your installation
|
|
155
|
+
```bash
|
|
156
|
+
$ pfund --version
|
|
157
|
+
|
|
158
|
+
pfund, version 0.0.1.dev4
|
|
127
159
|
```
|
|
128
160
|
|
|
129
161
|
|
|
@@ -139,10 +171,18 @@ class YourStrategy(pf.Strategy):
|
|
|
139
171
|
# write your trading logic here
|
|
140
172
|
pass
|
|
141
173
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
strategy.
|
|
145
|
-
strategy.
|
|
174
|
+
|
|
175
|
+
engine = pf.BacktestEngine(mode='vectorized')
|
|
176
|
+
strategy = engine.add_strategy(YourStrategy(), name='your_strategy')
|
|
177
|
+
strategy.add_data(
|
|
178
|
+
'IB', 'AAPL', 'USD', 'STK', resolutions=['1d'],
|
|
179
|
+
backtest={
|
|
180
|
+
# NOTE: since IB does not provide any historical data for backtesting purpose, use data from 'YAHOO_FINANCE'
|
|
181
|
+
'data_source': 'YAHOO_FINANCE',
|
|
182
|
+
'start_date': '2024-01-01',
|
|
183
|
+
'end_date': '2024-02-01',
|
|
184
|
+
}
|
|
185
|
+
)
|
|
146
186
|
engine.run()
|
|
147
187
|
```
|
|
148
188
|
|
|
@@ -153,9 +193,17 @@ engine.run()
|
|
|
153
193
|
import pfund as pf
|
|
154
194
|
|
|
155
195
|
engine = pf.TradeEngine(env='LIVE')
|
|
156
|
-
strategy = engine.add_strategy(YourStrategy())
|
|
157
|
-
strategy.add_data(
|
|
158
|
-
|
|
196
|
+
strategy = engine.add_strategy(YourStrategy(), name='your_strategy')
|
|
197
|
+
strategy.add_data(
|
|
198
|
+
'IB', 'AAPL', 'USD', 'STK', resolutions=['1d'],
|
|
199
|
+
# for convenience, you can keep the kwarg `backtest`, `TradeEngine` will ignore it
|
|
200
|
+
backtest={
|
|
201
|
+
# NOTE: since IB does not provide any historical data for backtesting purpose, use data from 'YAHOO_FINANCE'
|
|
202
|
+
'data_source': 'YAHOO_FINANCE',
|
|
203
|
+
'start_date': '2024-01-01',
|
|
204
|
+
'end_date': '2024-02-01',
|
|
205
|
+
}
|
|
206
|
+
)
|
|
159
207
|
engine.run()
|
|
160
208
|
```
|
|
161
209
|
|
|
@@ -193,28 +241,29 @@ engine.run()
|
|
|
193
241
|
## Model Hub
|
|
194
242
|
Imagine a space where algo-traders can share their machine learning models with one another.
|
|
195
243
|
Strategy and model development could be so much faster since you can build on top of an existing working model.
|
|
196
|
-
> Model Hub is coming soon
|
|
244
|
+
> Model Hub is coming soon on [PFund.ai], Stay Tuned!
|
|
197
245
|
|
|
198
246
|
|
|
199
247
|
## Supported Trading Venues
|
|
200
|
-
| Trading Venue
|
|
201
|
-
|
|
|
202
|
-
| Bybit
|
|
203
|
-
| *Interactive Brokers (IB)
|
|
204
|
-
| Binance
|
|
205
|
-
| OKX
|
|
206
|
-
| *Alpaca
|
|
207
|
-
| *[Futu]
|
|
208
|
-
| dYdX
|
|
248
|
+
| Trading Venue | Vectorized Backtesting | Event-Driven Backtesting | Paper Trading | Live Trading |
|
|
249
|
+
| ------------------------- | ---------------------- | ------------------------ | ------------- | ------------ |
|
|
250
|
+
| Bybit | 🟢 | 🟡 | 🟡 | 🟡 |
|
|
251
|
+
| *Interactive Brokers (IB) | 🟡 | 🟡 | 🟡 | 🟡 |
|
|
252
|
+
| Binance | 🔴 | 🔴 | 🔴 | 🔴 |
|
|
253
|
+
| OKX | 🔴 | 🔴 | 🔴 | 🔴 |
|
|
254
|
+
| *Alpaca | 🔴 | 🔴 | 🔴 | 🔴 |
|
|
255
|
+
| *[Futu] | 🔴 | 🔴 | 🔴 | 🔴 |
|
|
256
|
+
| dYdX | 🔴 | 🔴 | 🔴 | 🔴 |
|
|
209
257
|
|
|
210
258
|
🟢 = finished \
|
|
211
259
|
🟡 = in progress \
|
|
212
260
|
🔴 = todo \
|
|
213
|
-
\* = use a **_separate data source_** (e.g. [FirstRate Data]
|
|
261
|
+
\* = use a **_separate data source_** (e.g. [FirstRate Data]) for backtesting
|
|
214
262
|
|
|
215
263
|
|
|
216
264
|
## Related Projects
|
|
217
|
-
- [PFeed]
|
|
265
|
+
- [PFeed] — Data pipeline for algo-trading, helping traders in getting real-time and historical data, and storing them in a local data lake for quantitative research.
|
|
266
|
+
- [PyTrade.org] - A curated list of Python libraries and resources for algorithmic trading.
|
|
218
267
|
|
|
219
268
|
|
|
220
269
|
## Disclaimer
|
|
@@ -223,4 +272,3 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
|
|
223
272
|
This algo-trading framework is intended for educational and research purposes only. It should not be used for real trading without understanding the risks involved. Trading in financial markets involves significant risk, and there is always the potential for loss. Your trading results may vary. No representation is being made that any account will or is likely to achieve profits or losses similar to those discussed on this platform.
|
|
224
273
|
|
|
225
274
|
The developers of this framework are not responsible for any financial losses incurred from using this software. Users should conduct their due diligence and consult with a professional financial advisor before engaging in real trading activities.
|
|
226
|
-
|
|
@@ -1,24 +1,43 @@
|
|
|
1
1
|
# PFund: Algo-Trading Framework for Machine Learning, TradFi, CeFi and DeFi ready.
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+

|
|
4
|
+

|
|
5
5
|
[](https://pypi.org/project/pfund)
|
|
6
6
|

|
|
7
|
+
[](https://jupyterbook.org)
|
|
9
|
+
[](https://python-poetry.org/)
|
|
7
10
|
|
|
8
|
-
|
|
11
|
+
[TradFi]: https://www.techopedia.com/definition/traditional-finance-tradfi
|
|
12
|
+
[CeFi]: https://www.techopedia.com/definition/centralized-finance-cefi
|
|
13
|
+
[DeFi]: https://www.coinbase.com/learn/crypto-basics/what-is-defi
|
|
14
|
+
[pytrade.org]: https://pytrade.org
|
|
15
|
+
[dYdX]: https://dydx.exchange
|
|
16
|
+
[polars]: https://pola.rs/
|
|
17
|
+
[PFund.ai]: https://pfund.ai
|
|
18
|
+
[PFeed]: https://github.com/PFund-Software-Ltd/pfeed
|
|
19
|
+
[Bybit]: https://bybit.com/
|
|
20
|
+
[PyTorch]: https://pytorch.org/
|
|
21
|
+
[Poetry]: https://python-poetry.org
|
|
22
|
+
[Futu]: https://www.futunn.com
|
|
23
|
+
[FirstRate Data]: https://firstratedata.com
|
|
24
|
+
[Mantine UI]: https://ui.mantine.dev/
|
|
25
|
+
|
|
26
|
+
PFund (/piː fʌnd/), which stands for "**Personal Fund**", is an **algo-trading framework** designed for using **machine learning** models to trade across [TradFi] (Traditional Finance, e.g. **Interactive Brokers**), [CeFi] (Centralized Finance, e.g. Binance) and [DeFi] (Decentralized Finance, e.g. [dYdX]), or in simple terms, **Stocks** and **Cryptos**.
|
|
9
27
|
|
|
10
28
|
PFund allows traders to:
|
|
11
29
|
- perform vectorized or event-driven backtesting with
|
|
12
30
|
- different resolutions of data, e.g. orderbook data, tick data, bar data etc.
|
|
13
|
-
- different data tools, e.g. pandas, [polars]
|
|
31
|
+
- different data tools, e.g. pandas, [polars] etc.
|
|
14
32
|
- train machine learning models using their favorite frameworks, i.e. PFund is **ML-framework agnostic**
|
|
15
33
|
- tune strategy (hyper)parameters by splitting data into training sets, development sets and test sets
|
|
16
34
|
- go from backtesting to live trading by just changing **ONE line of code!!**
|
|
35
|
+
- execute trades manually/semi-manually via a trading app (frontend+backend)
|
|
17
36
|
|
|
18
|
-
It is created to enable trading for [PFund.ai]
|
|
37
|
+
It is created to enable trading for [PFund.ai] - a trading platform that bridges algo-trading and manual trading using AI (LLM).
|
|
19
38
|
|
|
20
39
|
Since PFund's sole purpose is for trading only, for all the data work, there is a separate library to handle that: \
|
|
21
|
-
[PFeed]
|
|
40
|
+
[PFeed] - Data pipeline for algo-trading, helping traders in getting real-time and historical data, and storing them in a local data lake for quantitative research.
|
|
22
41
|
|
|
23
42
|
|
|
24
43
|
<details>
|
|
@@ -45,12 +64,12 @@ Since PFund's sole purpose is for trading only, for all the data work, there is
|
|
|
45
64
|
**_Caution: PFund is at a VERY EARLY stage, use it at your own risk._**
|
|
46
65
|
|
|
47
66
|
PFund is currently under active development, the framework design will be prioritized first over
|
|
48
|
-
stability and scalability.
|
|
67
|
+
stability and scalability.
|
|
49
68
|
|
|
50
69
|
Please note that the available version is a *dev* version, not a *stable* one. \
|
|
51
70
|
You are encouraged to play with the *dev* version, but only use it when a *stable* version is released.
|
|
52
71
|
|
|
53
|
-
> PFund for the time being **_only supports vectorized backtesting_** using [Bybit]
|
|
72
|
+
> PFund for the time being **_only supports vectorized backtesting_** using [Bybit] and Yahoo Finance data for testing purpose.
|
|
54
73
|
|
|
55
74
|
|
|
56
75
|
## Mission
|
|
@@ -66,7 +85,7 @@ As an algo-trader, if you aim to quickly try out some trading ideas to see if th
|
|
|
66
85
|
|
|
67
86
|
This overview already omits some intricate steps, such as data handling and API integration.
|
|
68
87
|
|
|
69
|
-
> PFund's mission is to **_enable traders to concentrate solely on strategy formulation_** while the framework manages the rest. With PFund serving as the core trade engine, it empowers retail traders to have a fund management experience on [PFund.ai]
|
|
88
|
+
> PFund's mission is to **_enable traders to concentrate solely on strategy formulation_** while the framework manages the rest. With PFund serving as the core trade engine, it empowers retail traders to have a fund management experience on [PFund.ai] as if they are operating their personal hedge fund, hence the name *PFund*.
|
|
70
89
|
|
|
71
90
|
|
|
72
91
|
## Core Features
|
|
@@ -77,20 +96,36 @@ This overview already omits some intricate steps, such as data handling and API
|
|
|
77
96
|
- [x] Streamlines the algo-trading flow, from vectorized backtesting for strategy prototyping and event-driven backtesting for strategy development, to live trading for strategy deployment
|
|
78
97
|
- [x] Enables parallel data processing, e.g. Interactive Brokers and Binance each have their own process for receiving data feeds
|
|
79
98
|
- [ ] Allows choosing your preferred data tool, e.g. pandas, polars, pyspark etc.
|
|
80
|
-
- [ ] Features a modern frontend using [Mantine UI]
|
|
81
|
-
|
|
99
|
+
- [ ] Features a modern frontend using [Mantine UI] and TradingView's Charts library
|
|
100
|
+
- [ ] Supports manual/semi-manual trading using the frontend
|
|
82
101
|
|
|
83
102
|
|
|
84
103
|
## Installation
|
|
85
|
-
|
|
104
|
+
> Python 3.12 is not supported until [PyTorch]supports it
|
|
105
|
+
|
|
106
|
+
### Using [Poetry] (Recommended)
|
|
86
107
|
```bash
|
|
87
108
|
poetry add pfund
|
|
109
|
+
|
|
110
|
+
# update to the latest version:
|
|
111
|
+
poetry update pfund
|
|
88
112
|
```
|
|
89
113
|
|
|
90
114
|
|
|
91
115
|
### Using Pip
|
|
92
116
|
```bash
|
|
93
117
|
pip install pfund
|
|
118
|
+
|
|
119
|
+
# install the latest version:
|
|
120
|
+
pip install -U pfund
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
### Checking your installation
|
|
125
|
+
```bash
|
|
126
|
+
$ pfund --version
|
|
127
|
+
|
|
128
|
+
pfund, version 0.0.1.dev4
|
|
94
129
|
```
|
|
95
130
|
|
|
96
131
|
|
|
@@ -106,10 +141,18 @@ class YourStrategy(pf.Strategy):
|
|
|
106
141
|
# write your trading logic here
|
|
107
142
|
pass
|
|
108
143
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
strategy.
|
|
112
|
-
strategy.
|
|
144
|
+
|
|
145
|
+
engine = pf.BacktestEngine(mode='vectorized')
|
|
146
|
+
strategy = engine.add_strategy(YourStrategy(), name='your_strategy')
|
|
147
|
+
strategy.add_data(
|
|
148
|
+
'IB', 'AAPL', 'USD', 'STK', resolutions=['1d'],
|
|
149
|
+
backtest={
|
|
150
|
+
# NOTE: since IB does not provide any historical data for backtesting purpose, use data from 'YAHOO_FINANCE'
|
|
151
|
+
'data_source': 'YAHOO_FINANCE',
|
|
152
|
+
'start_date': '2024-01-01',
|
|
153
|
+
'end_date': '2024-02-01',
|
|
154
|
+
}
|
|
155
|
+
)
|
|
113
156
|
engine.run()
|
|
114
157
|
```
|
|
115
158
|
|
|
@@ -120,9 +163,17 @@ engine.run()
|
|
|
120
163
|
import pfund as pf
|
|
121
164
|
|
|
122
165
|
engine = pf.TradeEngine(env='LIVE')
|
|
123
|
-
strategy = engine.add_strategy(YourStrategy())
|
|
124
|
-
strategy.add_data(
|
|
125
|
-
|
|
166
|
+
strategy = engine.add_strategy(YourStrategy(), name='your_strategy')
|
|
167
|
+
strategy.add_data(
|
|
168
|
+
'IB', 'AAPL', 'USD', 'STK', resolutions=['1d'],
|
|
169
|
+
# for convenience, you can keep the kwarg `backtest`, `TradeEngine` will ignore it
|
|
170
|
+
backtest={
|
|
171
|
+
# NOTE: since IB does not provide any historical data for backtesting purpose, use data from 'YAHOO_FINANCE'
|
|
172
|
+
'data_source': 'YAHOO_FINANCE',
|
|
173
|
+
'start_date': '2024-01-01',
|
|
174
|
+
'end_date': '2024-02-01',
|
|
175
|
+
}
|
|
176
|
+
)
|
|
126
177
|
engine.run()
|
|
127
178
|
```
|
|
128
179
|
|
|
@@ -160,28 +211,29 @@ engine.run()
|
|
|
160
211
|
## Model Hub
|
|
161
212
|
Imagine a space where algo-traders can share their machine learning models with one another.
|
|
162
213
|
Strategy and model development could be so much faster since you can build on top of an existing working model.
|
|
163
|
-
> Model Hub is coming soon
|
|
214
|
+
> Model Hub is coming soon on [PFund.ai], Stay Tuned!
|
|
164
215
|
|
|
165
216
|
|
|
166
217
|
## Supported Trading Venues
|
|
167
|
-
| Trading Venue
|
|
168
|
-
|
|
|
169
|
-
| Bybit
|
|
170
|
-
| *Interactive Brokers (IB)
|
|
171
|
-
| Binance
|
|
172
|
-
| OKX
|
|
173
|
-
| *Alpaca
|
|
174
|
-
| *[Futu]
|
|
175
|
-
| dYdX
|
|
218
|
+
| Trading Venue | Vectorized Backtesting | Event-Driven Backtesting | Paper Trading | Live Trading |
|
|
219
|
+
| ------------------------- | ---------------------- | ------------------------ | ------------- | ------------ |
|
|
220
|
+
| Bybit | 🟢 | 🟡 | 🟡 | 🟡 |
|
|
221
|
+
| *Interactive Brokers (IB) | 🟡 | 🟡 | 🟡 | 🟡 |
|
|
222
|
+
| Binance | 🔴 | 🔴 | 🔴 | 🔴 |
|
|
223
|
+
| OKX | 🔴 | 🔴 | 🔴 | 🔴 |
|
|
224
|
+
| *Alpaca | 🔴 | 🔴 | 🔴 | 🔴 |
|
|
225
|
+
| *[Futu] | 🔴 | 🔴 | 🔴 | 🔴 |
|
|
226
|
+
| dYdX | 🔴 | 🔴 | 🔴 | 🔴 |
|
|
176
227
|
|
|
177
228
|
🟢 = finished \
|
|
178
229
|
🟡 = in progress \
|
|
179
230
|
🔴 = todo \
|
|
180
|
-
\* = use a **_separate data source_** (e.g. [FirstRate Data]
|
|
231
|
+
\* = use a **_separate data source_** (e.g. [FirstRate Data]) for backtesting
|
|
181
232
|
|
|
182
233
|
|
|
183
234
|
## Related Projects
|
|
184
|
-
- [PFeed]
|
|
235
|
+
- [PFeed] — Data pipeline for algo-trading, helping traders in getting real-time and historical data, and storing them in a local data lake for quantitative research.
|
|
236
|
+
- [PyTrade.org] - A curated list of Python libraries and resources for algorithmic trading.
|
|
185
237
|
|
|
186
238
|
|
|
187
239
|
## Disclaimer
|
|
@@ -189,4 +241,4 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
|
|
189
241
|
|
|
190
242
|
This algo-trading framework is intended for educational and research purposes only. It should not be used for real trading without understanding the risks involved. Trading in financial markets involves significant risk, and there is always the potential for loss. Your trading results may vary. No representation is being made that any account will or is likely to achieve profits or losses similar to those discussed on this platform.
|
|
191
243
|
|
|
192
|
-
The developers of this framework are not responsible for any financial losses incurred from using this software. Users should conduct their due diligence and consult with a professional financial advisor before engaging in real trading activities.
|
|
244
|
+
The developers of this framework are not responsible for any financial losses incurred from using this software. Users should conduct their due diligence and consult with a professional financial advisor before engaging in real trading activities.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
## Installation
|
|
2
|
+
```bash
|
|
3
|
+
poetry add pfund --with dev,doc
|
|
4
|
+
```
|
|
5
|
+
|
|
6
|
+
## Build Documentation using [jupyterbook](https://jupyterbook.org/)
|
|
7
|
+
```bash
|
|
8
|
+
# at the root directory, run:
|
|
9
|
+
jb build docs/ [--all]
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Update submodules
|
|
13
|
+
```bash
|
|
14
|
+
# run this to see if the version a submodule is using has been changed.
|
|
15
|
+
git submodule update
|
|
16
|
+
```
|
|
@@ -1,9 +1,14 @@
|
|
|
1
|
+
import sys
|
|
1
2
|
from importlib.metadata import version
|
|
2
3
|
|
|
4
|
+
from pfund.const.paths import PROJ_PATH
|
|
5
|
+
# add python path so that for files like "ibapi" (official python code from IB) can find their modules
|
|
6
|
+
sys.path.append(f'{PROJ_PATH}/externals')
|
|
3
7
|
from pfund.config_handler import configure
|
|
4
8
|
from pfund.engines import BacktestEngine, TrainEngine, TestEngine, TradeEngine
|
|
5
9
|
from pfund.strategies import Strategy
|
|
6
10
|
from pfund.models import Feature, Model
|
|
11
|
+
from pfund.utils.aliases import ALIASES
|
|
7
12
|
try:
|
|
8
13
|
from pfund.models import PyTorchModel
|
|
9
14
|
except ImportError:
|
|
@@ -20,7 +25,7 @@ __version__ = version('pfund')
|
|
|
20
25
|
|
|
21
26
|
__all__ = (
|
|
22
27
|
'__version__',
|
|
23
|
-
'configure',
|
|
28
|
+
'configure', 'ALIASES',
|
|
24
29
|
'BacktestEngine', 'TrainEngine', 'TestEngine', 'TradeEngine',
|
|
25
30
|
'Strategy', 'Model', 'PyTorchModel', 'SKLearnModel',
|
|
26
31
|
'Feature', 'TAIndicator', 'TALibIndicator',
|
|
@@ -25,7 +25,7 @@ class Adapter:
|
|
|
25
25
|
return pdt
|
|
26
26
|
|
|
27
27
|
def load_pdt_matchings(self):
|
|
28
|
-
file_path = f'{PROJ_CONFIG_PATH}/{self._trading_venue}'
|
|
28
|
+
file_path = f'{PROJ_CONFIG_PATH}/{self._trading_venue.lower()}'
|
|
29
29
|
config_name = 'pdt_matchings'
|
|
30
30
|
for file_name in os.listdir(file_path):
|
|
31
31
|
if not file_name.startswith(config_name):
|
|
@@ -10,6 +10,9 @@ from pfund.config_handler import ConfigHandler
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
def save_config(config: ConfigHandler, config_file_path: str | Path):
|
|
13
|
+
if type(config_file_path) is str:
|
|
14
|
+
config_file_path = Path(config_file_path)
|
|
15
|
+
config_file_path.parent.mkdir(parents=True, exist_ok=True)
|
|
13
16
|
with open(config_file_path, 'w') as f:
|
|
14
17
|
yaml.dump(config.__dict__, f, default_flow_style=False)
|
|
15
18
|
|
|
@@ -18,8 +18,10 @@ from pfund.const.paths import PROJ_NAME
|
|
|
18
18
|
def docker_compose(ctx, env_file_path, docker_file_path):
|
|
19
19
|
"""Forwards commands to docker-compose with the package's docker-compose.yml file if not specified."""
|
|
20
20
|
if not env_file_path:
|
|
21
|
-
env_file_path
|
|
22
|
-
|
|
21
|
+
if env_file_path := find_dotenv(usecwd=True, raise_error_if_not_found=False):
|
|
22
|
+
click.echo(f'.env file path is not specified, using env file in "{env_file_path}"')
|
|
23
|
+
else:
|
|
24
|
+
click.echo('.env file is not found')
|
|
23
25
|
load_dotenv(env_file_path, override=True)
|
|
24
26
|
if not docker_file_path:
|
|
25
27
|
package_dir = Path(importlib.resources.files(PROJ_NAME)).resolve().parents[0]
|
|
@@ -9,11 +9,8 @@ from dataclasses import dataclass
|
|
|
9
9
|
import yaml
|
|
10
10
|
# from rich.traceback import install
|
|
11
11
|
|
|
12
|
-
from pfund.const.paths import PROJ_NAME,
|
|
12
|
+
from pfund.const.paths import PROJ_NAME, LOG_PATH, PROJ_CONFIG_PATH, DATA_PATH, USER_CONFIG_FILE_PATH
|
|
13
13
|
|
|
14
|
-
# add python path so that for files like "ibapi" (official python code from IB)
|
|
15
|
-
# can find their modules
|
|
16
|
-
sys.path.append(f'{PROJ_PATH}/externals')
|
|
17
14
|
# install(show_locals=False) # rich will set its own sys.excepthook
|
|
18
15
|
# rich_excepthook = sys.excepthook # get rich's excepthook
|
|
19
16
|
|
|
@@ -3,9 +3,10 @@ from platformdirs import user_log_dir, user_data_dir, user_config_dir
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
# project paths
|
|
6
|
-
PROJ_NAME = Path(__file__).resolve().parents[
|
|
7
|
-
MAIN_PATH = Path(__file__).resolve().parents[
|
|
8
|
-
PROJ_PATH = MAIN_PATH / PROJ_NAME
|
|
6
|
+
PROJ_NAME = Path(__file__).resolve().parents[1].name
|
|
7
|
+
MAIN_PATH = Path(__file__).resolve().parents[2]
|
|
8
|
+
PROJ_PATH = MAIN_PATH / PROJ_NAME
|
|
9
|
+
|
|
9
10
|
EXCHANGE_PATH = PROJ_PATH / 'exchanges'
|
|
10
11
|
PROJ_CONFIG_PATH = PROJ_PATH / 'config'
|
|
11
12
|
|
|
@@ -6,6 +6,7 @@ from pfund.const.commons import SUPPORTED_TIMEFRAMES
|
|
|
6
6
|
|
|
7
7
|
class Resolution:
|
|
8
8
|
def __init__(self, resolution: str):
|
|
9
|
+
assert re.match(r"^\d+[a-zA-Z]+$", resolution), f"Invalid {resolution=}, pattern should be e.g. '1d', '2m', '3h' etc."
|
|
9
10
|
self._resolution = self._standardize(resolution)
|
|
10
11
|
# split resolution (e.g. '1m') into period (e.g. '1') and timeframe (e.g. 'm')
|
|
11
12
|
self.period, timeframe = re.split('(\d+)', self._resolution.strip())[1:]
|
|
@@ -2,7 +2,8 @@ from typing import Literal
|
|
|
2
2
|
|
|
3
3
|
from pfund.data_tools.data_tool_base import DataTool
|
|
4
4
|
from pfund.engines.base_engine import BaseEngine
|
|
5
|
-
from pfund.models.model_base import BaseModel
|
|
5
|
+
from pfund.models.model_base import BaseModel, BaseFeature
|
|
6
|
+
from pfund.indicators.indicator_base import BaseIndicator
|
|
6
7
|
from pfund.brokers.broker_backtest import BacktestBroker
|
|
7
8
|
from pfund.strategies.strategy_base import BaseStrategy
|
|
8
9
|
from pfund.strategies.strategy_backtest import BacktestStrategy
|
|
@@ -56,6 +57,12 @@ class BacktestEngine(BaseEngine):
|
|
|
56
57
|
model = strategy.add_model(model, name=name, model_path=model_path, is_load=is_load)
|
|
57
58
|
return model
|
|
58
59
|
|
|
60
|
+
def add_feature(self, feature: BaseFeature, name: str='', feature_path: str='', is_load: bool=True) -> BaseFeature:
|
|
61
|
+
return self.add_model(feature, name=name, model_path=feature_path, is_load=is_load)
|
|
62
|
+
|
|
63
|
+
def add_indicator(self, indicator: BaseIndicator, name: str='', indicator_path: str='', is_load: bool=True) -> BaseIndicator:
|
|
64
|
+
return self.add_model(indicator, name=name, model_path=indicator_path, is_load=is_load)
|
|
65
|
+
|
|
59
66
|
def add_broker(self, bkr: str):
|
|
60
67
|
bkr = bkr.upper()
|
|
61
68
|
if bkr in self.brokers:
|
|
@@ -18,28 +18,21 @@ class Exchange(BaseExchange):
|
|
|
18
18
|
# TODO, come back to this if bybit supports more
|
|
19
19
|
# SUPPORT_PLACE_BATCH_ORDERS = True
|
|
20
20
|
# SUPPORT_CANCEL_BATCH_ORDERS = True
|
|
21
|
+
|
|
22
|
+
PTYPE_TO_CATEGORY = {
|
|
23
|
+
'PERP': 'linear',
|
|
24
|
+
'FUT': 'linear',
|
|
25
|
+
'IPERP': 'inverse',
|
|
26
|
+
'IFUT': 'inverse',
|
|
27
|
+
'SPOT': 'spot',
|
|
28
|
+
'OPT': 'option',
|
|
29
|
+
}
|
|
21
30
|
|
|
22
31
|
_MAX_NUM_OF_PLACE_BATCH_ORDERS = 20
|
|
23
32
|
_MAX_NUM_OF_CANEL_BATCH_ORDERS = 20
|
|
24
33
|
|
|
25
34
|
def __init__(self, env):
|
|
26
35
|
super().__init__(env, 'BYBIT')
|
|
27
|
-
|
|
28
|
-
@staticmethod
|
|
29
|
-
def categorize_product_type(ptype):
|
|
30
|
-
is_spot = (ptype == 'SPOT')
|
|
31
|
-
is_inverse = (ptype in ['IPERP', 'IFUT'])
|
|
32
|
-
is_linear = not is_inverse and not is_spot
|
|
33
|
-
is_option = (ptype == 'OPT')
|
|
34
|
-
if is_linear:
|
|
35
|
-
category = 'linear'
|
|
36
|
-
elif is_inverse:
|
|
37
|
-
category = 'inverse'
|
|
38
|
-
elif is_spot:
|
|
39
|
-
category = 'spot'
|
|
40
|
-
elif is_option:
|
|
41
|
-
category = 'option'
|
|
42
|
-
return category
|
|
43
36
|
|
|
44
37
|
def _create_pdt_matchings_config(
|
|
45
38
|
# general to exchanges
|
|
@@ -57,7 +57,7 @@ class BaseExchange:
|
|
|
57
57
|
self.categories.append(category)
|
|
58
58
|
|
|
59
59
|
def create_product(self, bccy, qccy, ptype, *args, **kwargs) -> CryptoProduct:
|
|
60
|
-
if category := self.
|
|
60
|
+
if category := self.PTYPE_TO_CATEGORY[ptype] if hasattr(self, 'PTYPE_TO_CATEGORY') else '':
|
|
61
61
|
self.add_category(category)
|
|
62
62
|
product = CryptoProduct(self.exch, bccy, qccy, ptype, *args, category=category, **kwargs)
|
|
63
63
|
product.load_configs(self.configs)
|