pfund 0.0.1.dev4__tar.gz → 0.0.1.dev6__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 (176) hide show
  1. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/PKG-INFO +88 -43
  2. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/README.md +83 -32
  3. pfund-0.0.1.dev6/pfund/CONTRIBUTING.md +16 -0
  4. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/__init__.py +6 -1
  5. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/adapter.py +1 -1
  6. pfund-0.0.1.dev6/pfund/analyzer.py +3 -0
  7. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/cli/commands/config.py +3 -0
  8. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/cli/commands/docker_compose.py +4 -2
  9. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/config/bybit/config.yml +1 -1
  10. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/config/configuration.py +0 -7
  11. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/config_handler.py +39 -10
  12. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/const/commons.py +3 -1
  13. pfund-0.0.1.dev6/pfund/const/paths.py +26 -0
  14. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/data_tools/data_tool_base.py +0 -5
  15. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/data_tools/data_tool_pandas.py +8 -0
  16. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/datas/resolution.py +1 -0
  17. pfund-0.0.1.dev6/pfund/engines/backtest_engine.py +253 -0
  18. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/engines/base_engine.py +12 -8
  19. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/engines/trade_engine.py +10 -11
  20. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/engines/train_engine.py +6 -4
  21. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/exchanges/bybit/exchange.py +10 -17
  22. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/exchanges/exchange_base.py +1 -1
  23. pfund-0.0.1.dev6/pfund/investment_profile.py +16 -0
  24. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/mixins/backtest.py +38 -10
  25. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/models/model_backtest.py +22 -11
  26. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/models/model_base.py +25 -5
  27. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/plogging/__init__.py +5 -0
  28. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/portfolio.py +1 -1
  29. pfund-0.0.1.dev6/pfund/strategies/allocation_strategy.py +10 -0
  30. pfund-0.0.1.dev6/pfund/strategies/diversification_strategy.py +13 -0
  31. pfund-0.0.1.dev6/pfund/strategies/hedging_strategy.py +10 -0
  32. pfund-0.0.1.dev6/pfund/strategies/optimization_strategy.py +13 -0
  33. pfund-0.0.1.dev6/pfund/strategies/portfolio_strategy.py +27 -0
  34. pfund-0.0.1.dev6/pfund/strategies/rebalancing_strategy.py +10 -0
  35. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/strategies/strategy_backtest.py +21 -8
  36. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/strategies/strategy_base.py +34 -13
  37. pfund-0.0.1.dev6/pfund/types/backtest.py +10 -0
  38. pfund-0.0.1.dev6/pfund/types/common_literals.py +25 -0
  39. pfund-0.0.1.dev6/pfund/types/core.py +14 -0
  40. pfund-0.0.1.dev6/pfund/universe.py +19 -0
  41. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/utils/aliases.py +5 -1
  42. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/utils/utils.py +2 -0
  43. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pyproject.toml +27 -13
  44. pfund-0.0.1.dev4/pfund/const/paths.py +0 -21
  45. pfund-0.0.1.dev4/pfund/engines/backtest_engine.py +0 -138
  46. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/LICENSE +0 -0
  47. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/accounts/__init__.py +0 -0
  48. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/accounts/account_base.py +0 -0
  49. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/accounts/account_crypto.py +0 -0
  50. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/accounts/account_ib.py +0 -0
  51. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/balances/__init__.py +0 -0
  52. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/balances/balance_base.py +0 -0
  53. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/balances/balance_crypto.py +0 -0
  54. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/balances/balance_ib.py +0 -0
  55. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/brokers/__init__.py +0 -0
  56. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/brokers/broker_backtest.py +0 -0
  57. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/brokers/broker_base.py +0 -0
  58. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/brokers/broker_crypto.py +0 -0
  59. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/brokers/broker_live.py +0 -0
  60. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/brokers/ib/__init__.py +0 -0
  61. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/brokers/ib/broker_ib.py +0 -0
  62. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/brokers/ib/ib_api.py +0 -0
  63. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/brokers/ib/ib_client.py +0 -0
  64. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/brokers/ib/ib_wrapper.py +0 -0
  65. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/cli/__init__.py +0 -0
  66. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/cli/commands/__init__.py +0 -0
  67. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/cli/main.py +0 -0
  68. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/config/bybit/lot_sizes_inverse.yml +0 -0
  69. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/config/bybit/lot_sizes_linear.yml +0 -0
  70. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/config/bybit/lot_sizes_option.yml +0 -0
  71. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/config/bybit/lot_sizes_spot.yml +0 -0
  72. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/config/bybit/pdt_matchings_inverse.yml +0 -0
  73. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/config/bybit/pdt_matchings_linear.yml +0 -0
  74. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/config/bybit/pdt_matchings_option.yml +0 -0
  75. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/config/bybit/pdt_matchings_spot.yml +0 -0
  76. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/config/bybit/tick_sizes_inverse.yml +0 -0
  77. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/config/bybit/tick_sizes_linear.yml +0 -0
  78. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/config/bybit/tick_sizes_option.yml +0 -0
  79. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/config/bybit/tick_sizes_spot.yml +0 -0
  80. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/config/ib/config.yml +0 -0
  81. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/config/logging.yml +0 -0
  82. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/const/__init__.py +0 -0
  83. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/const/_zmq_routes.py +0 -0
  84. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/datas/__init__.py +0 -0
  85. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/datas/data_bar.py +0 -0
  86. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/datas/data_base.py +0 -0
  87. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/datas/data_quote.py +0 -0
  88. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/datas/data_tick.py +0 -0
  89. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/datas/data_time_based.py +0 -0
  90. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/datas/timeframe.py +0 -0
  91. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/engines/__init__.py +0 -0
  92. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/engines/test_engine.py +0 -0
  93. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/errors.py +0 -0
  94. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/exchanges/__init__.py +0 -0
  95. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/exchanges/bybit/__init__.py +0 -0
  96. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/exchanges/bybit/rest_api.py +0 -0
  97. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/exchanges/bybit/rest_api_samples/get_markets_result_inverse +0 -0
  98. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/exchanges/bybit/rest_api_samples/get_markets_result_linear +0 -0
  99. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/exchanges/bybit/rest_api_samples/get_markets_result_option +0 -0
  100. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/exchanges/bybit/rest_api_samples/get_markets_result_spot +0 -0
  101. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/exchanges/bybit/rest_api_samples/get_markets_return_inverse +0 -0
  102. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/exchanges/bybit/rest_api_samples/get_markets_return_linear +0 -0
  103. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/exchanges/bybit/rest_api_samples/get_markets_return_option +0 -0
  104. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/exchanges/bybit/rest_api_samples/get_markets_return_spot +0 -0
  105. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/exchanges/bybit/types.py +0 -0
  106. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/exchanges/bybit/ws_api.py +0 -0
  107. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/exchanges/rest_api_base.py +0 -0
  108. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/exchanges/ws_api_base.py +0 -0
  109. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/externals/ibapi/__init__.py +0 -0
  110. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/externals/ibapi/account_summary_tags.py +0 -0
  111. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/externals/ibapi/client.py +0 -0
  112. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/externals/ibapi/comm.py +0 -0
  113. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/externals/ibapi/commission_report.py +0 -0
  114. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/externals/ibapi/common.py +0 -0
  115. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/externals/ibapi/connection.py +0 -0
  116. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/externals/ibapi/contract.py +0 -0
  117. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/externals/ibapi/decoder.py +0 -0
  118. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/externals/ibapi/enum_implem.py +0 -0
  119. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/externals/ibapi/errors.py +0 -0
  120. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/externals/ibapi/execution.py +0 -0
  121. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/externals/ibapi/ibapi.pyproj +0 -0
  122. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/externals/ibapi/message.py +0 -0
  123. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/externals/ibapi/news.py +0 -0
  124. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/externals/ibapi/object_implem.py +0 -0
  125. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/externals/ibapi/order.py +0 -0
  126. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/externals/ibapi/order_condition.py +0 -0
  127. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/externals/ibapi/order_state.py +0 -0
  128. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/externals/ibapi/orderdecoder.py +0 -0
  129. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/externals/ibapi/reader.py +0 -0
  130. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/externals/ibapi/scanner.py +0 -0
  131. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/externals/ibapi/server_versions.py +0 -0
  132. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/externals/ibapi/softdollartier.py +0 -0
  133. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/externals/ibapi/tag_value.py +0 -0
  134. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/externals/ibapi/ticktype.py +0 -0
  135. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/externals/ibapi/utils.py +0 -0
  136. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/externals/ibapi/wrapper.py +0 -0
  137. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/indicators/__init__.py +0 -0
  138. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/indicators/indicator_base.py +0 -0
  139. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/indicators/ta_indicator.py +0 -0
  140. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/indicators/talib_indicator.py +0 -0
  141. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/main.py +0 -0
  142. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/managers/__init__.py +0 -0
  143. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/managers/base_manager.py +0 -0
  144. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/managers/connection_manager.py +0 -0
  145. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/managers/data_manager.py +0 -0
  146. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/managers/order_manager.py +0 -0
  147. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/managers/portfolio_manager.py +0 -0
  148. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/managers/risk_manager.py +0 -0
  149. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/managers/strategy_manager.py +0 -0
  150. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/models/__init__.py +0 -0
  151. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/models/model_meta.py +0 -0
  152. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/models/pytorch_model.py +0 -0
  153. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/models/sklearn_model.py +0 -0
  154. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/orders/__init__.py +0 -0
  155. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/orders/order_base.py +0 -0
  156. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/orders/order_crypto.py +0 -0
  157. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/orders/order_ib.py +0 -0
  158. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/orders/order_statuses.py +0 -0
  159. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/orders/order_time_in_force.py +0 -0
  160. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/plogging/config.py +0 -0
  161. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/plogging/filters.py +0 -0
  162. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/plogging/formatter.py +0 -0
  163. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/plogging/handlers.py +0 -0
  164. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/positions/__init__.py +0 -0
  165. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/positions/position_base.py +0 -0
  166. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/positions/position_crypto.py +0 -0
  167. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/positions/position_ib.py +0 -0
  168. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/products/__init__.py +0 -0
  169. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/products/product_base.py +0 -0
  170. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/products/product_crypto.py +0 -0
  171. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/products/product_ib.py +0 -0
  172. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/risk_monitor.py +0 -0
  173. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/strategies/__init__.py +0 -0
  174. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/strategies/strategy_meta.py +0 -0
  175. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/utils/envs.py +0 -0
  176. {pfund-0.0.1.dev4 → pfund-0.0.1.dev6}/pfund/zeromq.py +0 -0
@@ -1,57 +1,71 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pfund
3
- Version: 0.0.1.dev4
3
+ Version: 0.0.1.dev6
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
7
7
  Keywords: trading,algo-trading,stocks,cryptos,cryptocurrencies,TradFi,CeFi,DeFi,portfolio management,investment,backtesting,machine learning
8
8
  Author: Stephen Yau
9
9
  Author-email: softwareentrepreneer+pfund@gmail.com
10
- Requires-Python: >=3.10,<3.12
10
+ Requires-Python: >=3.10,<3.13
11
11
  Classifier: License :: OSI Approved :: Apache Software License
12
12
  Classifier: Programming Language :: Python :: 3
13
13
  Classifier: Programming Language :: Python :: 3.10
14
14
  Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
15
16
  Requires-Dist: click (>=8.1.7,<9.0.0)
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: gitpython (>=3.1.43,<4.0.0)
18
+ Requires-Dist: pfeed (>=0.0.1.dev5,<0.0.2)
19
19
  Requires-Dist: platformdirs (>=4.2.0,<5.0.0)
20
- Requires-Dist: psutil (>=5.9.8,<6.0.0)
21
20
  Requires-Dist: python-telegram-bot (>=20.7,<21.0)
22
21
  Requires-Dist: pyyaml (>=6.0.1,<7.0.0)
23
- Requires-Dist: pyzmq (>=25.1.2,<26.0.0)
24
22
  Requires-Dist: rich (>=13.7.0,<14.0.0)
25
23
  Requires-Dist: schedule (>=1.2.1,<2.0.0)
26
- Requires-Dist: scikit-learn (>=1.4.0,<2.0.0)
27
- Requires-Dist: ta (>=0.11.0,<0.12.0)
28
- Requires-Dist: torch (>=2.1.2,<3.0.0)
29
24
  Requires-Dist: websocket-client (>=1.7.0,<2.0.0)
30
- Project-URL: Documentation, https://pfund.ai/docs
25
+ Project-URL: Documentation, https://pfund-docs.pfund.ai
31
26
  Project-URL: Repository, https://github.com/PFund-Software-Ltd/pfund
32
27
  Description-Content-Type: text/markdown
33
28
 
34
29
  # PFund: Algo-Trading Framework for Machine Learning, TradFi, CeFi and DeFi ready.
35
30
 
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/)
31
+ ![GitHub stars](https://img.shields.io/github/stars/PFund-Software-Ltd/pfund?style=social)
32
+ ![PyPI downloads](https://img.shields.io/pypi/dm/pfund)
38
33
  [![PyPI](https://img.shields.io/pypi/v/pfund.svg)](https://pypi.org/project/pfund)
39
34
  ![PyPI - Support Python Versions](https://img.shields.io/pypi/pyversions/pfund)
35
+ [![Jupyter Book Badge](https://raw.githubusercontent.com/PFund-Software-Ltd/pfund/main/docs/images/jupyterbook.svg
36
+ )](https://jupyterbook.org)
37
+ [![Poetry](https://img.shields.io/endpoint?url=https://python-poetry.org/badge/v0.json)](https://python-poetry.org/)
40
38
 
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**.
39
+ [TradFi]: https://www.techopedia.com/definition/traditional-finance-tradfi
40
+ [CeFi]: https://www.techopedia.com/definition/centralized-finance-cefi
41
+ [DeFi]: https://www.coinbase.com/learn/crypto-basics/what-is-defi
42
+ [pytrade.org]: https://pytrade.org
43
+ [dYdX]: https://dydx.exchange
44
+ [polars]: https://pola.rs/
45
+ [PFund.ai]: https://pfund.ai
46
+ [PFeed]: https://github.com/PFund-Software-Ltd/pfeed
47
+ [Bybit]: https://bybit.com/
48
+ [PyTorch]: https://pytorch.org/
49
+ [Poetry]: https://python-poetry.org
50
+ [Futu]: https://www.futunn.com
51
+ [FirstRate Data]: https://firstratedata.com
52
+ [Mantine UI]: https://ui.mantine.dev/
53
+
54
+ 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
55
 
43
56
  PFund allows traders to:
44
57
  - perform vectorized or event-driven backtesting with
45
58
  - 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.
59
+ - different data tools, e.g. pandas, [polars] etc.
47
60
  - train machine learning models using their favorite frameworks, i.e. PFund is **ML-framework agnostic**
48
61
  - tune strategy (hyper)parameters by splitting data into training sets, development sets and test sets
49
62
  - go from backtesting to live trading by just changing **ONE line of code!!**
63
+ - execute trades manually/semi-manually via a trading app (frontend+backend)
50
64
 
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).
65
+ It is created to enable trading for [PFund.ai] - a trading platform that bridges algo-trading and manual trading using AI (LLM).
52
66
 
53
67
  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.
68
+ [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
69
 
56
70
 
57
71
  <details>
@@ -78,12 +92,12 @@ Since PFund's sole purpose is for trading only, for all the data work, there is
78
92
  **_Caution: PFund is at a VERY EARLY stage, use it at your own risk._**
79
93
 
80
94
  PFund is currently under active development, the framework design will be prioritized first over
81
- stability and scalability.
95
+ stability and scalability.
82
96
 
83
97
  Please note that the available version is a *dev* version, not a *stable* one. \
84
98
  You are encouraged to play with the *dev* version, but only use it when a *stable* version is released.
85
99
 
86
- > PFund for the time being **_only supports vectorized backtesting_** using [Bybit](https://bybit.com/) and Yahoo Finance data for testing purpose.
100
+ > PFund for the time being **_only supports vectorized backtesting_** using [Bybit] and Yahoo Finance data for testing purpose.
87
101
 
88
102
 
89
103
  ## Mission
@@ -99,7 +113,7 @@ As an algo-trader, if you aim to quickly try out some trading ideas to see if th
99
113
 
100
114
  This overview already omits some intricate steps, such as data handling and API integration.
101
115
 
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*.
116
+ > 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
117
 
104
118
 
105
119
  ## Core Features
@@ -110,20 +124,35 @@ This overview already omits some intricate steps, such as data handling and API
110
124
  - [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
125
  - [x] Enables parallel data processing, e.g. Interactive Brokers and Binance each have their own process for receiving data feeds
112
126
  - [ ] 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
-
127
+ - [ ] Features a modern frontend using [Mantine UI] and TradingView's Charts library
128
+ - [ ] Supports manual/semi-manual trading using the frontend
115
129
 
116
130
 
117
131
  ## Installation
118
- ### Using [Poetry](https://python-poetry.org) (Recommended)
132
+
133
+ ### Using [Poetry] (Recommended)
119
134
  ```bash
120
135
  poetry add pfund
136
+
137
+ # update to the latest version:
138
+ poetry update pfund
121
139
  ```
122
140
 
123
141
 
124
142
  ### Using Pip
125
143
  ```bash
126
144
  pip install pfund
145
+
146
+ # install the latest version:
147
+ pip install -U pfund
148
+ ```
149
+
150
+
151
+ ### Checking your installation
152
+ ```bash
153
+ $ pfund --version
154
+
155
+ pfund, version 0.0.1.dev4
127
156
  ```
128
157
 
129
158
 
@@ -139,10 +168,18 @@ class YourStrategy(pf.Strategy):
139
168
  # write your trading logic here
140
169
  pass
141
170
 
142
- engine = pf.BacktestEngine(...)
143
- strategy = engine.add_strategy(YourStrategy())
144
- strategy.add_data(...)
145
- strategy.add_model(...)
171
+
172
+ engine = pf.BacktestEngine(mode='vectorized')
173
+ strategy = engine.add_strategy(YourStrategy(), name='your_strategy')
174
+ strategy.add_data(
175
+ 'IB', 'AAPL', 'USD', 'STK', resolutions=['1d'],
176
+ backtest={
177
+ # NOTE: since IB does not provide any historical data for backtesting purpose, use data from 'YAHOO_FINANCE'
178
+ 'data_source': 'YAHOO_FINANCE',
179
+ 'start_date': '2024-01-01',
180
+ 'end_date': '2024-02-01',
181
+ }
182
+ )
146
183
  engine.run()
147
184
  ```
148
185
 
@@ -153,9 +190,17 @@ engine.run()
153
190
  import pfund as pf
154
191
 
155
192
  engine = pf.TradeEngine(env='LIVE')
156
- strategy = engine.add_strategy(YourStrategy())
157
- strategy.add_data(...)
158
- strategy.add_model(...)
193
+ strategy = engine.add_strategy(YourStrategy(), name='your_strategy')
194
+ strategy.add_data(
195
+ 'IB', 'AAPL', 'USD', 'STK', resolutions=['1d'],
196
+ # for convenience, you can keep the kwarg `backtest`, `TradeEngine` will ignore it
197
+ backtest={
198
+ # NOTE: since IB does not provide any historical data for backtesting purpose, use data from 'YAHOO_FINANCE'
199
+ 'data_source': 'YAHOO_FINANCE',
200
+ 'start_date': '2024-01-01',
201
+ 'end_date': '2024-02-01',
202
+ }
203
+ )
159
204
  engine.run()
160
205
  ```
161
206
 
@@ -193,28 +238,29 @@ engine.run()
193
238
  ## Model Hub
194
239
  Imagine a space where algo-traders can share their machine learning models with one another.
195
240
  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!
241
+ > Model Hub is coming soon on [PFund.ai], Stay Tuned!
197
242
 
198
243
 
199
244
  ## 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 | 🔴 | 🔴 | 🔴 | 🔴 |
245
+ | Trading Venue | Vectorized Backtesting | Event-Driven Backtesting | Paper Trading | Live Trading |
246
+ | ------------------------- | ---------------------- | ------------------------ | ------------- | ------------ |
247
+ | Bybit | 🟢 | 🟡 | 🟡 | 🟡 |
248
+ | *Interactive Brokers (IB) | 🟡 | 🟡 | 🟡 | 🟡 |
249
+ | Binance | 🔴 | 🔴 | 🔴 | 🔴 |
250
+ | OKX | 🔴 | 🔴 | 🔴 | 🔴 |
251
+ | *Alpaca | 🔴 | 🔴 | 🔴 | 🔴 |
252
+ | *[Futu] | 🔴 | 🔴 | 🔴 | 🔴 |
253
+ | dYdX | 🔴 | 🔴 | 🔴 | 🔴 |
209
254
 
210
255
  🟢 = finished \
211
256
  🟡 = in progress \
212
257
  🔴 = todo \
213
- \* = use a **_separate data source_** (e.g. [FirstRate Data](https://firstratedata.com)) for backtesting
258
+ \* = use a **_separate data source_** (e.g. [FirstRate Data]) for backtesting
214
259
 
215
260
 
216
261
  ## 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.
262
+ - [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.
263
+ - [PyTrade.org] - A curated list of Python libraries and resources for algorithmic trading.
218
264
 
219
265
 
220
266
  ## Disclaimer
@@ -223,4 +269,3 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
223
269
  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
270
 
225
271
  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,35 @@ 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
+
105
+ ### Using [Poetry] (Recommended)
86
106
  ```bash
87
107
  poetry add pfund
108
+
109
+ # update to the latest version:
110
+ poetry update pfund
88
111
  ```
89
112
 
90
113
 
91
114
  ### Using Pip
92
115
  ```bash
93
116
  pip install pfund
117
+
118
+ # install the latest version:
119
+ pip install -U pfund
120
+ ```
121
+
122
+
123
+ ### Checking your installation
124
+ ```bash
125
+ $ pfund --version
126
+
127
+ pfund, version 0.0.1.dev4
94
128
  ```
95
129
 
96
130
 
@@ -106,10 +140,18 @@ class YourStrategy(pf.Strategy):
106
140
  # write your trading logic here
107
141
  pass
108
142
 
109
- engine = pf.BacktestEngine(...)
110
- strategy = engine.add_strategy(YourStrategy())
111
- strategy.add_data(...)
112
- strategy.add_model(...)
143
+
144
+ engine = pf.BacktestEngine(mode='vectorized')
145
+ strategy = engine.add_strategy(YourStrategy(), name='your_strategy')
146
+ strategy.add_data(
147
+ 'IB', 'AAPL', 'USD', 'STK', resolutions=['1d'],
148
+ backtest={
149
+ # NOTE: since IB does not provide any historical data for backtesting purpose, use data from 'YAHOO_FINANCE'
150
+ 'data_source': 'YAHOO_FINANCE',
151
+ 'start_date': '2024-01-01',
152
+ 'end_date': '2024-02-01',
153
+ }
154
+ )
113
155
  engine.run()
114
156
  ```
115
157
 
@@ -120,9 +162,17 @@ engine.run()
120
162
  import pfund as pf
121
163
 
122
164
  engine = pf.TradeEngine(env='LIVE')
123
- strategy = engine.add_strategy(YourStrategy())
124
- strategy.add_data(...)
125
- strategy.add_model(...)
165
+ strategy = engine.add_strategy(YourStrategy(), name='your_strategy')
166
+ strategy.add_data(
167
+ 'IB', 'AAPL', 'USD', 'STK', resolutions=['1d'],
168
+ # for convenience, you can keep the kwarg `backtest`, `TradeEngine` will ignore it
169
+ backtest={
170
+ # NOTE: since IB does not provide any historical data for backtesting purpose, use data from 'YAHOO_FINANCE'
171
+ 'data_source': 'YAHOO_FINANCE',
172
+ 'start_date': '2024-01-01',
173
+ 'end_date': '2024-02-01',
174
+ }
175
+ )
126
176
  engine.run()
127
177
  ```
128
178
 
@@ -160,28 +210,29 @@ engine.run()
160
210
  ## Model Hub
161
211
  Imagine a space where algo-traders can share their machine learning models with one another.
162
212
  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!
213
+ > Model Hub is coming soon on [PFund.ai], Stay Tuned!
164
214
 
165
215
 
166
216
  ## 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 | 🔴 | 🔴 | 🔴 | 🔴 |
217
+ | Trading Venue | Vectorized Backtesting | Event-Driven Backtesting | Paper Trading | Live Trading |
218
+ | ------------------------- | ---------------------- | ------------------------ | ------------- | ------------ |
219
+ | Bybit | 🟢 | 🟡 | 🟡 | 🟡 |
220
+ | *Interactive Brokers (IB) | 🟡 | 🟡 | 🟡 | 🟡 |
221
+ | Binance | 🔴 | 🔴 | 🔴 | 🔴 |
222
+ | OKX | 🔴 | 🔴 | 🔴 | 🔴 |
223
+ | *Alpaca | 🔴 | 🔴 | 🔴 | 🔴 |
224
+ | *[Futu] | 🔴 | 🔴 | 🔴 | 🔴 |
225
+ | dYdX | 🔴 | 🔴 | 🔴 | 🔴 |
176
226
 
177
227
  🟢 = finished \
178
228
  🟡 = in progress \
179
229
  🔴 = todo \
180
- \* = use a **_separate data source_** (e.g. [FirstRate Data](https://firstratedata.com)) for backtesting
230
+ \* = use a **_separate data source_** (e.g. [FirstRate Data]) for backtesting
181
231
 
182
232
 
183
233
  ## 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.
234
+ - [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
+ - [PyTrade.org] - A curated list of Python libraries and resources for algorithmic trading.
185
236
 
186
237
 
187
238
  ## Disclaimer
@@ -189,4 +240,4 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
189
240
 
190
241
  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
242
 
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.
243
+ 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):
@@ -0,0 +1,3 @@
1
+ class Analyzer:
2
+ def __init__(self):
3
+ pass
@@ -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: ...,
@@ -6,9 +6,6 @@ from pfund.const.paths import PROJ_CONFIG_PATH
6
6
  from pfund.utils.utils import short_path
7
7
 
8
8
 
9
- has_printed = False
10
-
11
-
12
9
  class Configuration:
13
10
  def __init__(self, config_dir, config_name):
14
11
  self.config_dir = config_dir.lower()
@@ -24,16 +21,12 @@ class Configuration:
24
21
  return self.config_dir
25
22
 
26
23
  def read_config(self, config_name):
27
- global has_printed
28
24
  file_path = f'{self.config_path}/{config_name}.yml'
29
25
  # short_file_path = short_path(file_path)
30
26
  if not os.path.exists(file_path):
31
27
  print(f'cannot find config {file_path}')
32
28
  else:
33
29
  with open(file_path, 'r') as f:
34
- if not has_printed:
35
- has_printed = True
36
- print(f'loaded config {file_path}')
37
30
  return list(yaml.safe_load_all(f))
38
31
 
39
32
  def write_config(self, config_name, content):
@@ -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
 
@@ -28,11 +25,12 @@ def _custom_excepthook(exception_class: type[BaseException], exception: BaseExce
28
25
  logging.getLogger(PROJ_NAME).exception('Uncaught exception:')
29
26
 
30
27
 
31
- def import_strategies_models_features_or_indicators(path: str):
28
+ def dynamic_import(path: str):
32
29
  for item in os.listdir(path):
33
30
  item_path = os.path.join(path, item)
34
31
  if os.path.isdir(item_path) and '__pycache__' not in item_path:
35
- for type_ in ['strategies', 'models', 'features', 'indicators']:
32
+ for type_ in ['strategies', 'models', 'features', 'indicators',
33
+ 'backtests', 'notebooks', 'spreadsheets', 'dashboards']:
36
34
  if type_ in path:
37
35
  break
38
36
  else:
@@ -68,17 +66,48 @@ class ConfigHandler:
68
66
  config = {}
69
67
  return cls(**config)
70
68
 
69
+ @property
70
+ def strategy_path(self):
71
+ return f'{self.data_path}/hub/strategies'
72
+
73
+ @property
74
+ def model_path(self):
75
+ return f'{self.data_path}/hub/models'
76
+
77
+ @property
78
+ def feature_path(self):
79
+ return f'{self.data_path}/hub/features'
80
+
81
+ @property
82
+ def indicator_path(self):
83
+ return f'{self.data_path}/hub/indicators'
84
+
85
+ @property
86
+ def backtest_path(self):
87
+ return f'{self.data_path}/backtests'
88
+
89
+ @property
90
+ def notebook_path(self):
91
+ return f'{self.data_path}/templates/notebooks'
92
+
93
+ @property
94
+ def spreadsheet_path(self):
95
+ return f'{self.data_path}/templates/spreadsheets'
96
+
97
+ @property
98
+ def dashboard_path(self):
99
+ return f'{self.data_path}/templates/dashboards'
100
+
71
101
  def __post_init__(self):
72
102
  self.logging_config = self.logging_config or {}
73
103
 
74
- strategy_path, model_path = f'{self.data_path}/strategies', f'{self.data_path}/models'
75
- feature_path, indicator_path = f'{self.data_path}/features', f'{self.data_path}/indicators'
76
- for path in [strategy_path, model_path, feature_path, indicator_path]:
104
+ for path in [self.strategy_path, self.model_path, self.feature_path, self.indicator_path,
105
+ self.backtest_path, self.notebook_path, self.spreadsheet_path, self.dashboard_path]:
77
106
  if not os.path.exists(path):
78
107
  os.makedirs(path)
79
108
  print(f'created {path}')
80
109
  sys.path.append(path)
81
- import_strategies_models_features_or_indicators(path)
110
+ dynamic_import(path)
82
111
 
83
112
  if self.use_fork_process and sys.platform != 'win32':
84
113
  multiprocessing.set_start_method('fork', force=True)