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.
Files changed (162) hide show
  1. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/PKG-INFO +86 -38
  2. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/README.md +84 -32
  3. pfund-0.0.1.dev5/pfund/CONTRIBUTING.md +16 -0
  4. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/__init__.py +6 -1
  5. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/adapter.py +1 -1
  6. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/cli/commands/config.py +3 -0
  7. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/cli/commands/docker_compose.py +4 -2
  8. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/config/bybit/config.yml +1 -1
  9. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/config_handler.py +1 -4
  10. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/const/paths.py +4 -3
  11. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/datas/resolution.py +1 -0
  12. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/engines/backtest_engine.py +8 -1
  13. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/exchanges/bybit/exchange.py +9 -16
  14. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/exchanges/exchange_base.py +1 -1
  15. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/mixins/backtest.py +11 -1
  16. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/models/model_base.py +7 -1
  17. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/plogging/__init__.py +5 -0
  18. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/strategies/strategy_base.py +9 -2
  19. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/utils/aliases.py +5 -1
  20. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pyproject.toml +14 -6
  21. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/LICENSE +0 -0
  22. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/accounts/__init__.py +0 -0
  23. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/accounts/account_base.py +0 -0
  24. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/accounts/account_crypto.py +0 -0
  25. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/accounts/account_ib.py +0 -0
  26. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/balances/__init__.py +0 -0
  27. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/balances/balance_base.py +0 -0
  28. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/balances/balance_crypto.py +0 -0
  29. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/balances/balance_ib.py +0 -0
  30. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/brokers/__init__.py +0 -0
  31. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/brokers/broker_backtest.py +0 -0
  32. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/brokers/broker_base.py +0 -0
  33. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/brokers/broker_crypto.py +0 -0
  34. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/brokers/broker_live.py +0 -0
  35. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/brokers/ib/__init__.py +0 -0
  36. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/brokers/ib/broker_ib.py +0 -0
  37. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/brokers/ib/ib_api.py +0 -0
  38. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/brokers/ib/ib_client.py +0 -0
  39. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/brokers/ib/ib_wrapper.py +0 -0
  40. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/cli/__init__.py +0 -0
  41. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/cli/commands/__init__.py +0 -0
  42. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/cli/main.py +0 -0
  43. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/config/bybit/lot_sizes_inverse.yml +0 -0
  44. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/config/bybit/lot_sizes_linear.yml +0 -0
  45. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/config/bybit/lot_sizes_option.yml +0 -0
  46. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/config/bybit/lot_sizes_spot.yml +0 -0
  47. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/config/bybit/pdt_matchings_inverse.yml +0 -0
  48. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/config/bybit/pdt_matchings_linear.yml +0 -0
  49. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/config/bybit/pdt_matchings_option.yml +0 -0
  50. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/config/bybit/pdt_matchings_spot.yml +0 -0
  51. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/config/bybit/tick_sizes_inverse.yml +0 -0
  52. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/config/bybit/tick_sizes_linear.yml +0 -0
  53. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/config/bybit/tick_sizes_option.yml +0 -0
  54. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/config/bybit/tick_sizes_spot.yml +0 -0
  55. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/config/configuration.py +0 -0
  56. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/config/ib/config.yml +0 -0
  57. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/config/logging.yml +0 -0
  58. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/const/__init__.py +0 -0
  59. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/const/_zmq_routes.py +0 -0
  60. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/const/commons.py +0 -0
  61. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/data_tools/data_tool_base.py +0 -0
  62. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/data_tools/data_tool_pandas.py +0 -0
  63. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/datas/__init__.py +0 -0
  64. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/datas/data_bar.py +0 -0
  65. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/datas/data_base.py +0 -0
  66. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/datas/data_quote.py +0 -0
  67. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/datas/data_tick.py +0 -0
  68. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/datas/data_time_based.py +0 -0
  69. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/datas/timeframe.py +0 -0
  70. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/engines/__init__.py +0 -0
  71. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/engines/base_engine.py +0 -0
  72. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/engines/test_engine.py +0 -0
  73. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/engines/trade_engine.py +0 -0
  74. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/engines/train_engine.py +0 -0
  75. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/errors.py +0 -0
  76. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/exchanges/__init__.py +0 -0
  77. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/exchanges/bybit/__init__.py +0 -0
  78. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/exchanges/bybit/rest_api.py +0 -0
  79. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/exchanges/bybit/rest_api_samples/get_markets_result_inverse +0 -0
  80. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/exchanges/bybit/rest_api_samples/get_markets_result_linear +0 -0
  81. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/exchanges/bybit/rest_api_samples/get_markets_result_option +0 -0
  82. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/exchanges/bybit/rest_api_samples/get_markets_result_spot +0 -0
  83. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/exchanges/bybit/rest_api_samples/get_markets_return_inverse +0 -0
  84. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/exchanges/bybit/rest_api_samples/get_markets_return_linear +0 -0
  85. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/exchanges/bybit/rest_api_samples/get_markets_return_option +0 -0
  86. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/exchanges/bybit/rest_api_samples/get_markets_return_spot +0 -0
  87. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/exchanges/bybit/types.py +0 -0
  88. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/exchanges/bybit/ws_api.py +0 -0
  89. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/exchanges/rest_api_base.py +0 -0
  90. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/exchanges/ws_api_base.py +0 -0
  91. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/externals/ibapi/__init__.py +0 -0
  92. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/externals/ibapi/account_summary_tags.py +0 -0
  93. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/externals/ibapi/client.py +0 -0
  94. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/externals/ibapi/comm.py +0 -0
  95. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/externals/ibapi/commission_report.py +0 -0
  96. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/externals/ibapi/common.py +0 -0
  97. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/externals/ibapi/connection.py +0 -0
  98. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/externals/ibapi/contract.py +0 -0
  99. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/externals/ibapi/decoder.py +0 -0
  100. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/externals/ibapi/enum_implem.py +0 -0
  101. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/externals/ibapi/errors.py +0 -0
  102. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/externals/ibapi/execution.py +0 -0
  103. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/externals/ibapi/ibapi.pyproj +0 -0
  104. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/externals/ibapi/message.py +0 -0
  105. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/externals/ibapi/news.py +0 -0
  106. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/externals/ibapi/object_implem.py +0 -0
  107. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/externals/ibapi/order.py +0 -0
  108. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/externals/ibapi/order_condition.py +0 -0
  109. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/externals/ibapi/order_state.py +0 -0
  110. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/externals/ibapi/orderdecoder.py +0 -0
  111. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/externals/ibapi/reader.py +0 -0
  112. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/externals/ibapi/scanner.py +0 -0
  113. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/externals/ibapi/server_versions.py +0 -0
  114. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/externals/ibapi/softdollartier.py +0 -0
  115. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/externals/ibapi/tag_value.py +0 -0
  116. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/externals/ibapi/ticktype.py +0 -0
  117. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/externals/ibapi/utils.py +0 -0
  118. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/externals/ibapi/wrapper.py +0 -0
  119. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/indicators/__init__.py +0 -0
  120. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/indicators/indicator_base.py +0 -0
  121. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/indicators/ta_indicator.py +0 -0
  122. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/indicators/talib_indicator.py +0 -0
  123. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/main.py +0 -0
  124. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/managers/__init__.py +0 -0
  125. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/managers/base_manager.py +0 -0
  126. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/managers/connection_manager.py +0 -0
  127. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/managers/data_manager.py +0 -0
  128. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/managers/order_manager.py +0 -0
  129. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/managers/portfolio_manager.py +0 -0
  130. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/managers/risk_manager.py +0 -0
  131. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/managers/strategy_manager.py +0 -0
  132. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/models/__init__.py +0 -0
  133. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/models/model_backtest.py +0 -0
  134. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/models/model_meta.py +0 -0
  135. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/models/pytorch_model.py +0 -0
  136. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/models/sklearn_model.py +0 -0
  137. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/orders/__init__.py +0 -0
  138. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/orders/order_base.py +0 -0
  139. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/orders/order_crypto.py +0 -0
  140. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/orders/order_ib.py +0 -0
  141. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/orders/order_statuses.py +0 -0
  142. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/orders/order_time_in_force.py +0 -0
  143. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/plogging/config.py +0 -0
  144. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/plogging/filters.py +0 -0
  145. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/plogging/formatter.py +0 -0
  146. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/plogging/handlers.py +0 -0
  147. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/portfolio.py +0 -0
  148. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/positions/__init__.py +0 -0
  149. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/positions/position_base.py +0 -0
  150. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/positions/position_crypto.py +0 -0
  151. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/positions/position_ib.py +0 -0
  152. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/products/__init__.py +0 -0
  153. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/products/product_base.py +0 -0
  154. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/products/product_crypto.py +0 -0
  155. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/products/product_ib.py +0 -0
  156. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/risk_monitor.py +0 -0
  157. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/strategies/__init__.py +0 -0
  158. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/strategies/strategy_backtest.py +0 -0
  159. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/strategies/strategy_meta.py +0 -0
  160. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/utils/envs.py +0 -0
  161. {pfund-0.0.1.dev4 → pfund-0.0.1.dev5}/pfund/utils/utils.py +0 -0
  162. {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.dev4
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: pandas (>=2.2.0,<3.0.0)
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/docs
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
- [![Jupyter Book Badge](docs/images/jupyterbook.svg)](https://jupyterbook.org)
37
- [![Poetry](https://img.shields.io/endpoint?url=https://python-poetry.org/badge/v0.json)](https://python-poetry.org/)
33
+ ![GitHub stars](https://img.shields.io/github/stars/PFund-Software-Ltd/pfund?style=social)
34
+ ![PyPI downloads](https://img.shields.io/pypi/dm/pfund)
38
35
  [![PyPI](https://img.shields.io/pypi/v/pfund.svg)](https://pypi.org/project/pfund)
39
36
  ![PyPI - Support Python Versions](https://img.shields.io/pypi/pyversions/pfund)
37
+ [![Jupyter Book Badge](https://raw.githubusercontent.com/PFund-Software-Ltd/pfund/main/docs/images/jupyterbook.svg
38
+ )](https://jupyterbook.org)
39
+ [![Poetry](https://img.shields.io/endpoint?url=https://python-poetry.org/badge/v0.json)](https://python-poetry.org/)
40
40
 
41
- 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](https://dydx.exchange)), or in simple terms, **Stocks** and **Cryptos**.
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](https://pola.rs/) etc.
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](https://pfund.ai) - a trading platform that bridges algo-trading and manual trading using AI (LLM).
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](https://github.com/PFund-Software-Ltd/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.
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](https://bybit.com/) and Yahoo Finance data for testing purpose.
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](https://pfund.ai) as if they are operating their personal hedge fund, hence the name *PFund*.
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](https://ui.mantine.dev/) and TradingView's Charts library
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
- ### Using [Poetry](https://python-poetry.org) (Recommended)
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
- engine = pf.BacktestEngine(...)
143
- strategy = engine.add_strategy(YourStrategy())
144
- strategy.add_data(...)
145
- strategy.add_model(...)
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
- strategy.add_model(...)
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 in [PFund.ai](https://pfund.ai), Stay Tuned!
244
+ > Model Hub is coming soon on [PFund.ai], Stay Tuned!
197
245
 
198
246
 
199
247
  ## Supported Trading Venues
200
- | Trading Venue | Vectorized Backtesting | Event-Driven Backtesting | Paper Trading | Live Trading |
201
- | ------------------------------- | ---------------------- | ------------------------ | ------------- | ------------ |
202
- | Bybit | 🟢 | 🟡 | 🟡 | 🟡 |
203
- | *Interactive Brokers (IB) | 🟡 | 🟡 | 🟡 | 🟡 |
204
- | Binance | 🔴 | 🔴 | 🔴 | 🔴 |
205
- | OKX | 🔴 | 🔴 | 🔴 | 🔴 |
206
- | *Alpaca | 🔴 | 🔴 | 🔴 | 🔴 |
207
- | *[Futu](https://www.futunn.com) | 🔴 | 🔴 | 🔴 | 🔴 |
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](https://firstratedata.com)) for backtesting
261
+ \* = use a **_separate data source_** (e.g. [FirstRate Data]) for backtesting
214
262
 
215
263
 
216
264
  ## Related Projects
217
- - [PFeed](https://github.com/PFund-Software-Ltd/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.
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
- [![Jupyter Book Badge](docs/images/jupyterbook.svg)](https://jupyterbook.org)
4
- [![Poetry](https://img.shields.io/endpoint?url=https://python-poetry.org/badge/v0.json)](https://python-poetry.org/)
3
+ ![GitHub stars](https://img.shields.io/github/stars/PFund-Software-Ltd/pfund?style=social)
4
+ ![PyPI downloads](https://img.shields.io/pypi/dm/pfund)
5
5
  [![PyPI](https://img.shields.io/pypi/v/pfund.svg)](https://pypi.org/project/pfund)
6
6
  ![PyPI - Support Python Versions](https://img.shields.io/pypi/pyversions/pfund)
7
+ [![Jupyter Book Badge](https://raw.githubusercontent.com/PFund-Software-Ltd/pfund/main/docs/images/jupyterbook.svg
8
+ )](https://jupyterbook.org)
9
+ [![Poetry](https://img.shields.io/endpoint?url=https://python-poetry.org/badge/v0.json)](https://python-poetry.org/)
7
10
 
8
- 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](https://dydx.exchange)), or in simple terms, **Stocks** and **Cryptos**.
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](https://pola.rs/) etc.
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](https://pfund.ai) - a trading platform that bridges algo-trading and manual trading using AI (LLM).
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](https://github.com/PFund-Software-Ltd/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.
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](https://bybit.com/) and Yahoo Finance data for testing purpose.
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](https://pfund.ai) as if they are operating their personal hedge fund, hence the name *PFund*.
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](https://ui.mantine.dev/) and TradingView's Charts library
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
- ### Using [Poetry](https://python-poetry.org) (Recommended)
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
- engine = pf.BacktestEngine(...)
110
- strategy = engine.add_strategy(YourStrategy())
111
- strategy.add_data(...)
112
- strategy.add_model(...)
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
- strategy.add_model(...)
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 in [PFund.ai](https://pfund.ai), Stay Tuned!
214
+ > Model Hub is coming soon on [PFund.ai], Stay Tuned!
164
215
 
165
216
 
166
217
  ## Supported Trading Venues
167
- | Trading Venue | Vectorized Backtesting | Event-Driven Backtesting | Paper Trading | Live Trading |
168
- | ------------------------------- | ---------------------- | ------------------------ | ------------- | ------------ |
169
- | Bybit | 🟢 | 🟡 | 🟡 | 🟡 |
170
- | *Interactive Brokers (IB) | 🟡 | 🟡 | 🟡 | 🟡 |
171
- | Binance | 🔴 | 🔴 | 🔴 | 🔴 |
172
- | OKX | 🔴 | 🔴 | 🔴 | 🔴 |
173
- | *Alpaca | 🔴 | 🔴 | 🔴 | 🔴 |
174
- | *[Futu](https://www.futunn.com) | 🔴 | 🔴 | 🔴 | 🔴 |
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](https://firstratedata.com)) for backtesting
231
+ \* = use a **_separate data source_** (e.g. [FirstRate Data]) for backtesting
181
232
 
182
233
 
183
234
  ## Related Projects
184
- - [PFeed](https://github.com/PFund-Software-Ltd/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.
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 = find_dotenv(usecwd=True, raise_error_if_not_found=True)
22
- click.echo(f'.env file path is not specified, using env file in "{env_file_path}"')
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]
@@ -65,7 +65,7 @@ adapter:
65
65
  CF--: 'Filled'
66
66
  C-C-: 'Cancelled'
67
67
  offset: {}
68
- px_directions: {
68
+ price_directions: {
69
69
  # internal definitions:
70
70
  # PlusTick: ...,
71
71
  # ZeroPlusTick: ...,
@@ -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, PROJ_PATH, LOG_PATH, PROJ_CONFIG_PATH, DATA_PATH, USER_CONFIG_FILE_PATH
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[2].name
7
- MAIN_PATH = Path(__file__).resolve().parents[3]
8
- PROJ_PATH = MAIN_PATH / PROJ_NAME / 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.categorize_product_type(ptype) if hasattr(self, 'categorize_product_type') else '':
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)