pfund 0.0.1.dev3__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.dev3 → pfund-0.0.1.dev5}/PKG-INFO +87 -38
  2. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/README.md +84 -31
  3. pfund-0.0.1.dev5/pfund/CONTRIBUTING.md +16 -0
  4. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/__init__.py +9 -3
  5. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/adapter.py +1 -1
  6. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/cli/commands/config.py +7 -10
  7. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/cli/commands/docker_compose.py +5 -3
  8. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/cli/main.py +2 -4
  9. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/config/bybit/config.yml +1 -1
  10. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/config_handler.py +15 -7
  11. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/const/paths.py +4 -3
  12. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/datas/resolution.py +1 -0
  13. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/engines/backtest_engine.py +9 -3
  14. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/engines/base_engine.py +3 -2
  15. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/exchanges/bybit/exchange.py +9 -16
  16. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/exchanges/exchange_base.py +1 -1
  17. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/mixins/backtest.py +25 -10
  18. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/models/model_base.py +7 -1
  19. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/plogging/__init__.py +15 -10
  20. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/plogging/config.py +1 -2
  21. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/strategies/strategy_base.py +9 -2
  22. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/utils/aliases.py +5 -1
  23. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pyproject.toml +23 -11
  24. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/LICENSE +0 -0
  25. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/accounts/__init__.py +0 -0
  26. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/accounts/account_base.py +0 -0
  27. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/accounts/account_crypto.py +0 -0
  28. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/accounts/account_ib.py +0 -0
  29. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/balances/__init__.py +0 -0
  30. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/balances/balance_base.py +0 -0
  31. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/balances/balance_crypto.py +0 -0
  32. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/balances/balance_ib.py +0 -0
  33. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/brokers/__init__.py +0 -0
  34. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/brokers/broker_backtest.py +0 -0
  35. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/brokers/broker_base.py +0 -0
  36. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/brokers/broker_crypto.py +0 -0
  37. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/brokers/broker_live.py +0 -0
  38. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/brokers/ib/__init__.py +0 -0
  39. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/brokers/ib/broker_ib.py +0 -0
  40. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/brokers/ib/ib_api.py +0 -0
  41. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/brokers/ib/ib_client.py +0 -0
  42. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/brokers/ib/ib_wrapper.py +0 -0
  43. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/cli/__init__.py +0 -0
  44. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/cli/commands/__init__.py +0 -0
  45. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/config/bybit/lot_sizes_inverse.yml +0 -0
  46. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/config/bybit/lot_sizes_linear.yml +0 -0
  47. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/config/bybit/lot_sizes_option.yml +0 -0
  48. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/config/bybit/lot_sizes_spot.yml +0 -0
  49. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/config/bybit/pdt_matchings_inverse.yml +0 -0
  50. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/config/bybit/pdt_matchings_linear.yml +0 -0
  51. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/config/bybit/pdt_matchings_option.yml +0 -0
  52. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/config/bybit/pdt_matchings_spot.yml +0 -0
  53. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/config/bybit/tick_sizes_inverse.yml +0 -0
  54. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/config/bybit/tick_sizes_linear.yml +0 -0
  55. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/config/bybit/tick_sizes_option.yml +0 -0
  56. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/config/bybit/tick_sizes_spot.yml +0 -0
  57. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/config/configuration.py +0 -0
  58. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/config/ib/config.yml +0 -0
  59. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/config/logging.yml +0 -0
  60. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/const/__init__.py +0 -0
  61. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/const/_zmq_routes.py +0 -0
  62. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/const/commons.py +0 -0
  63. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/data_tools/data_tool_base.py +0 -0
  64. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/data_tools/data_tool_pandas.py +0 -0
  65. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/datas/__init__.py +0 -0
  66. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/datas/data_bar.py +0 -0
  67. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/datas/data_base.py +0 -0
  68. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/datas/data_quote.py +0 -0
  69. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/datas/data_tick.py +0 -0
  70. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/datas/data_time_based.py +0 -0
  71. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/datas/timeframe.py +0 -0
  72. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/engines/__init__.py +0 -0
  73. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/engines/test_engine.py +0 -0
  74. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/engines/trade_engine.py +0 -0
  75. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/engines/train_engine.py +0 -0
  76. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/errors.py +0 -0
  77. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/exchanges/__init__.py +0 -0
  78. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/exchanges/bybit/__init__.py +0 -0
  79. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/exchanges/bybit/rest_api.py +0 -0
  80. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/exchanges/bybit/rest_api_samples/get_markets_result_inverse +0 -0
  81. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/exchanges/bybit/rest_api_samples/get_markets_result_linear +0 -0
  82. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/exchanges/bybit/rest_api_samples/get_markets_result_option +0 -0
  83. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/exchanges/bybit/rest_api_samples/get_markets_result_spot +0 -0
  84. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/exchanges/bybit/rest_api_samples/get_markets_return_inverse +0 -0
  85. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/exchanges/bybit/rest_api_samples/get_markets_return_linear +0 -0
  86. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/exchanges/bybit/rest_api_samples/get_markets_return_option +0 -0
  87. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/exchanges/bybit/rest_api_samples/get_markets_return_spot +0 -0
  88. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/exchanges/bybit/types.py +0 -0
  89. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/exchanges/bybit/ws_api.py +0 -0
  90. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/exchanges/rest_api_base.py +0 -0
  91. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/exchanges/ws_api_base.py +0 -0
  92. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/externals/ibapi/__init__.py +0 -0
  93. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/externals/ibapi/account_summary_tags.py +0 -0
  94. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/externals/ibapi/client.py +0 -0
  95. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/externals/ibapi/comm.py +0 -0
  96. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/externals/ibapi/commission_report.py +0 -0
  97. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/externals/ibapi/common.py +0 -0
  98. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/externals/ibapi/connection.py +0 -0
  99. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/externals/ibapi/contract.py +0 -0
  100. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/externals/ibapi/decoder.py +0 -0
  101. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/externals/ibapi/enum_implem.py +0 -0
  102. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/externals/ibapi/errors.py +0 -0
  103. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/externals/ibapi/execution.py +0 -0
  104. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/externals/ibapi/ibapi.pyproj +0 -0
  105. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/externals/ibapi/message.py +0 -0
  106. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/externals/ibapi/news.py +0 -0
  107. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/externals/ibapi/object_implem.py +0 -0
  108. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/externals/ibapi/order.py +0 -0
  109. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/externals/ibapi/order_condition.py +0 -0
  110. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/externals/ibapi/order_state.py +0 -0
  111. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/externals/ibapi/orderdecoder.py +0 -0
  112. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/externals/ibapi/reader.py +0 -0
  113. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/externals/ibapi/scanner.py +0 -0
  114. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/externals/ibapi/server_versions.py +0 -0
  115. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/externals/ibapi/softdollartier.py +0 -0
  116. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/externals/ibapi/tag_value.py +0 -0
  117. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/externals/ibapi/ticktype.py +0 -0
  118. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/externals/ibapi/utils.py +0 -0
  119. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/externals/ibapi/wrapper.py +0 -0
  120. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/indicators/__init__.py +0 -0
  121. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/indicators/indicator_base.py +0 -0
  122. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/indicators/ta_indicator.py +0 -0
  123. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/indicators/talib_indicator.py +0 -0
  124. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/main.py +0 -0
  125. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/managers/__init__.py +0 -0
  126. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/managers/base_manager.py +0 -0
  127. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/managers/connection_manager.py +0 -0
  128. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/managers/data_manager.py +0 -0
  129. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/managers/order_manager.py +0 -0
  130. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/managers/portfolio_manager.py +0 -0
  131. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/managers/risk_manager.py +0 -0
  132. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/managers/strategy_manager.py +0 -0
  133. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/models/__init__.py +0 -0
  134. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/models/model_backtest.py +0 -0
  135. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/models/model_meta.py +0 -0
  136. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/models/pytorch_model.py +0 -0
  137. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/models/sklearn_model.py +0 -0
  138. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/orders/__init__.py +0 -0
  139. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/orders/order_base.py +0 -0
  140. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/orders/order_crypto.py +0 -0
  141. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/orders/order_ib.py +0 -0
  142. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/orders/order_statuses.py +0 -0
  143. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/orders/order_time_in_force.py +0 -0
  144. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/plogging/filters.py +0 -0
  145. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/plogging/formatter.py +0 -0
  146. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/plogging/handlers.py +0 -0
  147. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/portfolio.py +0 -0
  148. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/positions/__init__.py +0 -0
  149. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/positions/position_base.py +0 -0
  150. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/positions/position_crypto.py +0 -0
  151. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/positions/position_ib.py +0 -0
  152. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/products/__init__.py +0 -0
  153. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/products/product_base.py +0 -0
  154. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/products/product_crypto.py +0 -0
  155. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/products/product_ib.py +0 -0
  156. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/risk_monitor.py +0 -0
  157. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/strategies/__init__.py +0 -0
  158. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/strategies/strategy_backtest.py +0 -0
  159. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/strategies/strategy_meta.py +0 -0
  160. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/utils/envs.py +0 -0
  161. {pfund-0.0.1.dev3 → pfund-0.0.1.dev5}/pfund/utils/utils.py +0 -0
  162. {pfund-0.0.1.dev3 → 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.dev3
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
@@ -13,9 +13,8 @@ Classifier: Programming Language :: Python :: 3
13
13
  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
- Requires-Dist: orjson (>=3.9.12,<4.0.0)
17
- Requires-Dist: pandas (>=2.2.0,<3.0.0)
18
- Requires-Dist: pfeed (>=0.0.1.dev3,<0.0.2)
16
+ Requires-Dist: orjson (>=3.9.14,<4.0.0)
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,34 +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
- [![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)
37
35
  [![PyPI](https://img.shields.io/pypi/v/pfund.svg)](https://pypi.org/project/pfund)
38
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/)
39
40
 
40
- 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**.
41
57
 
42
58
  PFund allows traders to:
43
59
  - perform vectorized or event-driven backtesting with
44
60
  - different resolutions of data, e.g. orderbook data, tick data, bar data etc.
45
- - different data tools, e.g. pandas, [polars](https://pola.rs/) etc.
61
+ - different data tools, e.g. pandas, [polars] etc.
46
62
  - train machine learning models using their favorite frameworks, i.e. PFund is **ML-framework agnostic**
47
63
  - tune strategy (hyper)parameters by splitting data into training sets, development sets and test sets
48
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)
49
66
 
50
- 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).
51
68
 
52
69
  Since PFund's sole purpose is for trading only, for all the data work, there is a separate library to handle that: \
53
- [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.
54
71
 
55
72
 
56
73
  <details>
@@ -77,12 +94,12 @@ Since PFund's sole purpose is for trading only, for all the data work, there is
77
94
  **_Caution: PFund is at a VERY EARLY stage, use it at your own risk._**
78
95
 
79
96
  PFund is currently under active development, the framework design will be prioritized first over
80
- stability and scalability.
97
+ stability and scalability.
81
98
 
82
99
  Please note that the available version is a *dev* version, not a *stable* one. \
83
100
  You are encouraged to play with the *dev* version, but only use it when a *stable* version is released.
84
101
 
85
- > 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.
86
103
 
87
104
 
88
105
  ## Mission
@@ -98,7 +115,7 @@ As an algo-trader, if you aim to quickly try out some trading ideas to see if th
98
115
 
99
116
  This overview already omits some intricate steps, such as data handling and API integration.
100
117
 
101
- > 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*.
102
119
 
103
120
 
104
121
  ## Core Features
@@ -109,20 +126,36 @@ This overview already omits some intricate steps, such as data handling and API
109
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
110
127
  - [x] Enables parallel data processing, e.g. Interactive Brokers and Binance each have their own process for receiving data feeds
111
128
  - [ ] Allows choosing your preferred data tool, e.g. pandas, polars, pyspark etc.
112
- - [ ] Features a modern frontend using [Mantine UI](https://ui.mantine.dev/) and TradingView's Charts library
113
-
129
+ - [ ] Features a modern frontend using [Mantine UI] and TradingView's Charts library
130
+ - [ ] Supports manual/semi-manual trading using the frontend
114
131
 
115
132
 
116
133
  ## Installation
117
- ### Using [Poetry](https://python-poetry.org) (Recommended)
134
+ > Python 3.12 is not supported until [PyTorch]supports it
135
+
136
+ ### Using [Poetry] (Recommended)
118
137
  ```bash
119
138
  poetry add pfund
139
+
140
+ # update to the latest version:
141
+ poetry update pfund
120
142
  ```
121
143
 
122
144
 
123
145
  ### Using Pip
124
146
  ```bash
125
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
126
159
  ```
127
160
 
128
161
 
@@ -138,10 +171,18 @@ class YourStrategy(pf.Strategy):
138
171
  # write your trading logic here
139
172
  pass
140
173
 
141
- engine = pf.BacktestEngine(...)
142
- strategy = engine.add_strategy(YourStrategy())
143
- strategy.add_data(...)
144
- 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
+ )
145
186
  engine.run()
146
187
  ```
147
188
 
@@ -152,9 +193,17 @@ engine.run()
152
193
  import pfund as pf
153
194
 
154
195
  engine = pf.TradeEngine(env='LIVE')
155
- strategy = engine.add_strategy(YourStrategy())
156
- strategy.add_data(...)
157
- 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
+ )
158
207
  engine.run()
159
208
  ```
160
209
 
@@ -192,28 +241,29 @@ engine.run()
192
241
  ## Model Hub
193
242
  Imagine a space where algo-traders can share their machine learning models with one another.
194
243
  Strategy and model development could be so much faster since you can build on top of an existing working model.
195
- > Model Hub is coming soon in [PFund.ai](https://pfund.ai), Stay Tuned!
244
+ > Model Hub is coming soon on [PFund.ai], Stay Tuned!
196
245
 
197
246
 
198
247
  ## Supported Trading Venues
199
- | Trading Venue | Vectorized Backtesting | Event-Driven Backtesting | Paper Trading | Live Trading |
200
- | ------------------------------- | ---------------------- | ------------------------ | ------------- | ------------ |
201
- | Bybit | 🟢 | 🟡 | 🟡 | 🟡 |
202
- | *Interactive Brokers (IB) | 🟡 | 🟡 | 🟡 | 🟡 |
203
- | Binance | 🔴 | 🔴 | 🔴 | 🔴 |
204
- | OKX | 🔴 | 🔴 | 🔴 | 🔴 |
205
- | *Alpaca | 🔴 | 🔴 | 🔴 | 🔴 |
206
- | *[Futu](https://www.futunn.com) | 🔴 | 🔴 | 🔴 | 🔴 |
207
- | 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 | 🔴 | 🔴 | 🔴 | 🔴 |
208
257
 
209
258
  🟢 = finished \
210
259
  🟡 = in progress \
211
260
  🔴 = todo \
212
- \* = 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
213
262
 
214
263
 
215
264
  ## Related Projects
216
- - [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.
217
267
 
218
268
 
219
269
  ## Disclaimer
@@ -222,4 +272,3 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
222
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.
223
273
 
224
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.
225
-
@@ -1,23 +1,43 @@
1
1
  # PFund: Algo-Trading Framework for Machine Learning, TradFi, CeFi and DeFi ready.
2
2
 
3
- [![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)
4
5
  [![PyPI](https://img.shields.io/pypi/v/pfund.svg)](https://pypi.org/project/pfund)
5
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/)
6
10
 
7
- 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**.
8
27
 
9
28
  PFund allows traders to:
10
29
  - perform vectorized or event-driven backtesting with
11
30
  - different resolutions of data, e.g. orderbook data, tick data, bar data etc.
12
- - different data tools, e.g. pandas, [polars](https://pola.rs/) etc.
31
+ - different data tools, e.g. pandas, [polars] etc.
13
32
  - train machine learning models using their favorite frameworks, i.e. PFund is **ML-framework agnostic**
14
33
  - tune strategy (hyper)parameters by splitting data into training sets, development sets and test sets
15
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)
16
36
 
17
- 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).
18
38
 
19
39
  Since PFund's sole purpose is for trading only, for all the data work, there is a separate library to handle that: \
20
- [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.
21
41
 
22
42
 
23
43
  <details>
@@ -44,12 +64,12 @@ Since PFund's sole purpose is for trading only, for all the data work, there is
44
64
  **_Caution: PFund is at a VERY EARLY stage, use it at your own risk._**
45
65
 
46
66
  PFund is currently under active development, the framework design will be prioritized first over
47
- stability and scalability.
67
+ stability and scalability.
48
68
 
49
69
  Please note that the available version is a *dev* version, not a *stable* one. \
50
70
  You are encouraged to play with the *dev* version, but only use it when a *stable* version is released.
51
71
 
52
- > 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.
53
73
 
54
74
 
55
75
  ## Mission
@@ -65,7 +85,7 @@ As an algo-trader, if you aim to quickly try out some trading ideas to see if th
65
85
 
66
86
  This overview already omits some intricate steps, such as data handling and API integration.
67
87
 
68
- > 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*.
69
89
 
70
90
 
71
91
  ## Core Features
@@ -76,20 +96,36 @@ This overview already omits some intricate steps, such as data handling and API
76
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
77
97
  - [x] Enables parallel data processing, e.g. Interactive Brokers and Binance each have their own process for receiving data feeds
78
98
  - [ ] Allows choosing your preferred data tool, e.g. pandas, polars, pyspark etc.
79
- - [ ] Features a modern frontend using [Mantine UI](https://ui.mantine.dev/) and TradingView's Charts library
80
-
99
+ - [ ] Features a modern frontend using [Mantine UI] and TradingView's Charts library
100
+ - [ ] Supports manual/semi-manual trading using the frontend
81
101
 
82
102
 
83
103
  ## Installation
84
- ### Using [Poetry](https://python-poetry.org) (Recommended)
104
+ > Python 3.12 is not supported until [PyTorch]supports it
105
+
106
+ ### Using [Poetry] (Recommended)
85
107
  ```bash
86
108
  poetry add pfund
109
+
110
+ # update to the latest version:
111
+ poetry update pfund
87
112
  ```
88
113
 
89
114
 
90
115
  ### Using Pip
91
116
  ```bash
92
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
93
129
  ```
94
130
 
95
131
 
@@ -105,10 +141,18 @@ class YourStrategy(pf.Strategy):
105
141
  # write your trading logic here
106
142
  pass
107
143
 
108
- engine = pf.BacktestEngine(...)
109
- strategy = engine.add_strategy(YourStrategy())
110
- strategy.add_data(...)
111
- 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
+ )
112
156
  engine.run()
113
157
  ```
114
158
 
@@ -119,9 +163,17 @@ engine.run()
119
163
  import pfund as pf
120
164
 
121
165
  engine = pf.TradeEngine(env='LIVE')
122
- strategy = engine.add_strategy(YourStrategy())
123
- strategy.add_data(...)
124
- 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
+ )
125
177
  engine.run()
126
178
  ```
127
179
 
@@ -159,28 +211,29 @@ engine.run()
159
211
  ## Model Hub
160
212
  Imagine a space where algo-traders can share their machine learning models with one another.
161
213
  Strategy and model development could be so much faster since you can build on top of an existing working model.
162
- > Model Hub is coming soon in [PFund.ai](https://pfund.ai), Stay Tuned!
214
+ > Model Hub is coming soon on [PFund.ai], Stay Tuned!
163
215
 
164
216
 
165
217
  ## Supported Trading Venues
166
- | Trading Venue | Vectorized Backtesting | Event-Driven Backtesting | Paper Trading | Live Trading |
167
- | ------------------------------- | ---------------------- | ------------------------ | ------------- | ------------ |
168
- | Bybit | 🟢 | 🟡 | 🟡 | 🟡 |
169
- | *Interactive Brokers (IB) | 🟡 | 🟡 | 🟡 | 🟡 |
170
- | Binance | 🔴 | 🔴 | 🔴 | 🔴 |
171
- | OKX | 🔴 | 🔴 | 🔴 | 🔴 |
172
- | *Alpaca | 🔴 | 🔴 | 🔴 | 🔴 |
173
- | *[Futu](https://www.futunn.com) | 🔴 | 🔴 | 🔴 | 🔴 |
174
- | 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 | 🔴 | 🔴 | 🔴 | 🔴 |
175
227
 
176
228
  🟢 = finished \
177
229
  🟡 = in progress \
178
230
  🔴 = todo \
179
- \* = 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
180
232
 
181
233
 
182
234
  ## Related Projects
183
- - [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.
184
237
 
185
238
 
186
239
  ## Disclaimer
@@ -188,4 +241,4 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
188
241
 
189
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.
190
243
 
191
- 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,7 +1,14 @@
1
+ import sys
2
+ from importlib.metadata import version
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')
1
7
  from pfund.config_handler import configure
2
8
  from pfund.engines import BacktestEngine, TrainEngine, TestEngine, TradeEngine
3
9
  from pfund.strategies import Strategy
4
10
  from pfund.models import Feature, Model
11
+ from pfund.utils.aliases import ALIASES
5
12
  try:
6
13
  from pfund.models import PyTorchModel
7
14
  except ImportError:
@@ -11,7 +18,6 @@ try:
11
18
  except ImportError:
12
19
  pass
13
20
  from pfund.indicators import TAIndicator, TALibIndicator
14
- from importlib.metadata import version
15
21
 
16
22
 
17
23
  __version__ = version('pfund')
@@ -19,8 +25,8 @@ __version__ = version('pfund')
19
25
 
20
26
  __all__ = (
21
27
  '__version__',
22
- 'configure',
28
+ 'configure', 'ALIASES',
23
29
  'BacktestEngine', 'TrainEngine', 'TestEngine', 'TradeEngine',
24
30
  'Strategy', 'Model', 'PyTorchModel', 'SKLearnModel',
25
31
  'Feature', 'TAIndicator', 'TALibIndicator',
26
- )
32
+ )
@@ -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):
@@ -9,15 +9,10 @@ from pfund.const.paths import USER_CONFIG_FILE_PATH
9
9
  from pfund.config_handler import ConfigHandler
10
10
 
11
11
 
12
- def load_config(config_file_path: str | Path):
13
- config_file_path = Path(config_file_path)
14
- if config_file_path.is_file():
15
- with open(config_file_path, 'r') as f:
16
- return yaml.safe_load(f) or {}
17
- return {}
18
-
19
-
20
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)
21
16
  with open(config_file_path, 'w') as f:
22
17
  yaml.dump(config.__dict__, f, default_flow_style=False)
23
18
 
@@ -48,14 +43,16 @@ def config(ctx, **kwargs):
48
43
  if kwargs.get('list'): # Check if --list was used
49
44
  del provided_options['list']
50
45
  assert not provided_options, "No options should be provided with --list"
51
- click.echo(f"PFund's config:\n{pformat(config.__dict__)}")
46
+ config_dict = config.__dict__
47
+ config_dict.update({'config_file_path': USER_CONFIG_FILE_PATH})
48
+ click.echo(f"PFund's config:\n{pformat(config_dict)}")
52
49
  return
53
50
 
54
51
  if kwargs.get('reset'): # Check if --reset was used
55
52
  del provided_options['reset']
56
53
  assert not provided_options, "No options should be provided with --reset"
57
54
  remove_config(USER_CONFIG_FILE_PATH)
58
- click.echo("PFund;s config successfully reset.")
55
+ click.echo("PFund's config successfully reset.")
59
56
  return
60
57
 
61
58
  # prints out current config if no options are provided
@@ -18,9 +18,11 @@ 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}"')
23
- load_dotenv(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')
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]
26
28
  docker_file_path = package_dir / 'docker-compose.yml'
@@ -1,9 +1,8 @@
1
1
  import click
2
2
 
3
3
  from pfund.config_handler import ConfigHandler
4
- from pfund.const.paths import USER_CONFIG_FILE_PATH
5
4
  from pfund.cli.commands.docker_compose import docker_compose
6
- from pfund.cli.commands.config import config, load_config
5
+ from pfund.cli.commands.config import config
7
6
 
8
7
 
9
8
  @click.group(context_settings={"help_option_names": ["-h", "--help"]})
@@ -12,8 +11,7 @@ from pfund.cli.commands.config import config, load_config
12
11
  def pfund_group(ctx):
13
12
  """pfund's CLI"""
14
13
  ctx.ensure_object(dict)
15
- config: dict = load_config(USER_CONFIG_FILE_PATH)
16
- ctx.obj['config'] = ConfigHandler(**config)
14
+ ctx.obj['config'] = ConfigHandler.load_config()
17
15
 
18
16
 
19
17
  pfund_group.add_command(docker_compose)
@@ -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: ...,
@@ -6,12 +6,10 @@ import logging
6
6
  from types import TracebackType
7
7
  from dataclasses import dataclass
8
8
 
9
+ import yaml
9
10
  # from rich.traceback import install
10
11
 
11
- from pfund.const.paths import PROJ_NAME, PROJ_PATH, LOG_PATH, PROJ_CONFIG_PATH, DATA_PATH
12
- # add python path so that for files like "ibapi" (official python code from IB)
13
- # can find their modules
14
- sys.path.append(f'{PROJ_PATH}/externals')
12
+ from pfund.const.paths import PROJ_NAME, LOG_PATH, PROJ_CONFIG_PATH, DATA_PATH, USER_CONFIG_FILE_PATH
15
13
 
16
14
  # install(show_locals=False) # rich will set its own sys.excepthook
17
15
  # rich_excepthook = sys.excepthook # get rich's excepthook
@@ -50,19 +48,29 @@ def import_strategies_models_features_or_indicators(path: str):
50
48
 
51
49
  @dataclass
52
50
  class ConfigHandler:
53
- data_path: str = str(DATA_PATH),
51
+ data_path: str = str(DATA_PATH)
54
52
  log_path: str = str(LOG_PATH)
55
53
  logging_config_file_path: str = f'{PROJ_CONFIG_PATH}/logging.yml'
56
54
  logging_config: dict | None = None
57
55
  use_fork_process: bool = True
58
56
  use_custom_excepthook: bool = True
59
57
 
58
+ @classmethod
59
+ def load_config(cls):
60
+ config_file_path = USER_CONFIG_FILE_PATH
61
+ if config_file_path.is_file():
62
+ with open(config_file_path, 'r') as f:
63
+ config = yaml.safe_load(f) or {}
64
+ else:
65
+ config = {}
66
+ return cls(**config)
67
+
60
68
  def __post_init__(self):
61
69
  self.logging_config = self.logging_config or {}
62
70
 
63
71
  strategy_path, model_path = f'{self.data_path}/strategies', f'{self.data_path}/models'
64
72
  feature_path, indicator_path = f'{self.data_path}/features', f'{self.data_path}/indicators'
65
- for path in (strategy_path, model_path, feature_path, indicator_path):
73
+ for path in [strategy_path, model_path, feature_path, indicator_path]:
66
74
  if not os.path.exists(path):
67
75
  os.makedirs(path)
68
76
  print(f'created {path}')
@@ -74,7 +82,7 @@ class ConfigHandler:
74
82
 
75
83
  if self.use_custom_excepthook:
76
84
  sys.excepthook = _custom_excepthook
77
-
85
+
78
86
 
79
87
  def configure(
80
88
  data_path: str = str(DATA_PATH),