pfund 0.0.1.dev13__tar.gz → 0.0.2.dev1__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 (238) hide show
  1. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/PKG-INFO +71 -84
  2. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/README.md +42 -66
  3. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/CONTRIBUTING.md +1 -1
  4. pfund-0.0.2.dev1/pfund/__init__.py +32 -0
  5. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/accounts/account_base.py +13 -1
  6. pfund-0.0.2.dev1/pfund/accounts/account_crypto.py +33 -0
  7. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/analyzer.py +17 -3
  8. pfund-0.0.2.dev1/pfund/backtest_history.py +210 -0
  9. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/balances/balance_base.py +8 -1
  10. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/brokers/broker_backtest.py +29 -33
  11. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/brokers/broker_base.py +12 -4
  12. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/brokers/broker_crypto.py +53 -51
  13. pfund-0.0.2.dev1/pfund/brokers/broker_defi.py +8 -0
  14. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/brokers/broker_live.py +15 -9
  15. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/brokers/ib/broker_ib.py +32 -38
  16. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/brokers/ib/ib_api.py +4 -4
  17. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/cli/commands/config.py +10 -11
  18. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/cli/commands/docker_compose.py +2 -7
  19. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/config_handler.py +66 -20
  20. pfund-0.0.2.dev1/pfund/const/__init__.py +2 -0
  21. pfund-0.0.1.dev13/pfund/const/commons.py → pfund-0.0.2.dev1/pfund/const/common.py +5 -4
  22. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/const/paths.py +1 -1
  23. pfund-0.0.2.dev1/pfund/data_tools/data_tool_base.py +61 -0
  24. pfund-0.0.2.dev1/pfund/data_tools/data_tool_pandas.py +748 -0
  25. pfund-0.0.2.dev1/pfund/data_tools/data_tool_polars.py +151 -0
  26. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/datas/data_bar.py +9 -16
  27. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/datas/data_base.py +1 -0
  28. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/datas/data_time_based.py +1 -0
  29. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/datas/resolution.py +4 -1
  30. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/datas/timeframe.py +4 -1
  31. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/engines/__init__.py +2 -2
  32. pfund-0.0.2.dev1/pfund/engines/backtest_engine.py +419 -0
  33. pfund-0.0.2.dev1/pfund/engines/base_engine.py +135 -0
  34. pfund-0.0.2.dev1/pfund/engines/sandbox_engine.py +53 -0
  35. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/engines/trade_engine.py +53 -9
  36. pfund-0.0.2.dev1/pfund/engines/train_engine.py +52 -0
  37. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/exchanges/binance/exchange.py +1 -1
  38. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/exchanges/binance/linear/exchange.py +1 -0
  39. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/exchanges/bybit/exchange.py +2 -2
  40. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/exchanges/bybit/ws_api.py +15 -15
  41. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/exchanges/exchange_base.py +18 -9
  42. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/exchanges/ws_api_base.py +1 -1
  43. pfund-0.0.2.dev1/pfund/indicators/__init__.py +3 -0
  44. pfund-0.0.2.dev1/pfund/indicators/indicator_base.py +70 -0
  45. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/indicators/ta_indicator.py +32 -15
  46. pfund-0.0.2.dev1/pfund/indicators/talib_indicator.py +77 -0
  47. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/investment_profile.py +2 -2
  48. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/managers/base_manager.py +2 -2
  49. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/managers/data_manager.py +57 -69
  50. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/managers/risk_manager.py +1 -0
  51. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/managers/strategy_manager.py +13 -8
  52. pfund-0.0.2.dev1/pfund/mixins/assets/__init__.py +4 -0
  53. pfund-0.0.2.dev1/pfund/mixins/assets/all_assets_mixin.py +25 -0
  54. pfund-0.0.2.dev1/pfund/mixins/assets/crypto_assets_mixin.py +29 -0
  55. pfund-0.0.2.dev1/pfund/mixins/assets/defi_assets_mixin.py +30 -0
  56. pfund-0.0.2.dev1/pfund/mixins/assets/tradfi_assets_mixin.py +33 -0
  57. pfund-0.0.2.dev1/pfund/mixins/backtest_mixin.py +335 -0
  58. pfund-0.0.2.dev1/pfund/mixins/trade_mixin.py +427 -0
  59. pfund-0.0.2.dev1/pfund/models/__init__.py +11 -0
  60. pfund-0.0.2.dev1/pfund/models/model_backtest.py +85 -0
  61. pfund-0.0.2.dev1/pfund/models/model_base.py +335 -0
  62. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/models/model_meta.py +11 -3
  63. pfund-0.0.2.dev1/pfund/models/pytorch_model.py +79 -0
  64. pfund-0.0.2.dev1/pfund/models/sklearn_model.py +58 -0
  65. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/orders/__init__.py +0 -1
  66. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/orders/order_base.py +15 -15
  67. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/plogging/__init__.py +4 -4
  68. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/plogging/config.py +11 -13
  69. pfund-0.0.2.dev1/pfund/portfolios/__init__.py +5 -0
  70. pfund-0.0.2.dev1/pfund/portfolios/base_portfolio.py +110 -0
  71. pfund-0.0.2.dev1/pfund/portfolios/crypto_portfolio.py +8 -0
  72. pfund-0.0.2.dev1/pfund/portfolios/defi_portfolio.py +8 -0
  73. pfund-0.0.2.dev1/pfund/portfolios/portfolio.py +69 -0
  74. pfund-0.0.2.dev1/pfund/portfolios/tradfi_portfolio.py +8 -0
  75. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/positions/position_base.py +7 -1
  76. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/positions/position_ib.py +1 -1
  77. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/products/product_base.py +1 -1
  78. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/products/product_crypto.py +6 -3
  79. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/products/product_ib.py +4 -2
  80. pfund-0.0.2.dev1/pfund/strategies/allocation_strategy.py +17 -0
  81. pfund-0.0.2.dev1/pfund/strategies/diversification_strategy.py +20 -0
  82. pfund-0.0.2.dev1/pfund/strategies/execution_strategy.py +6 -0
  83. pfund-0.0.2.dev1/pfund/strategies/hedging_strategy.py +17 -0
  84. pfund-0.0.2.dev1/pfund/strategies/optimization_strategy.py +20 -0
  85. pfund-0.0.2.dev1/pfund/strategies/portfolio_strategy.py +104 -0
  86. pfund-0.0.2.dev1/pfund/strategies/rebalancing_strategy.py +17 -0
  87. pfund-0.0.2.dev1/pfund/strategies/strategy_backtest.py +65 -0
  88. pfund-0.0.2.dev1/pfund/strategies/strategy_base.py +428 -0
  89. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/strategies/strategy_meta.py +12 -1
  90. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/types/backtest.py +2 -2
  91. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/types/common_literals.py +5 -5
  92. pfund-0.0.2.dev1/pfund/types/data_tool.py +57 -0
  93. pfund-0.0.2.dev1/pfund/universes/__init__.py +5 -0
  94. pfund-0.0.2.dev1/pfund/universes/base_universe.py +59 -0
  95. pfund-0.0.2.dev1/pfund/universes/crypto_universe.py +8 -0
  96. pfund-0.0.2.dev1/pfund/universes/defi_universe.py +8 -0
  97. pfund-0.0.2.dev1/pfund/universes/tradfi_universe.py +8 -0
  98. pfund-0.0.2.dev1/pfund/universes/universe.py +74 -0
  99. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/utils/envs.py +5 -1
  100. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/utils/utils.py +10 -12
  101. pfund-0.0.2.dev1/pfund/validations/backtest.py +39 -0
  102. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/zeromq.py +1 -4
  103. pfund-0.0.2.dev1/pyproject.toml +97 -0
  104. pfund-0.0.1.dev13/pfund/__init__.py +0 -70
  105. pfund-0.0.1.dev13/pfund/accounts/account_crypto.py +0 -20
  106. pfund-0.0.1.dev13/pfund/config/logging.yml +0 -87
  107. pfund-0.0.1.dev13/pfund/const/__init__.py +0 -2
  108. pfund-0.0.1.dev13/pfund/data_tools/data_tool_base.py +0 -43
  109. pfund-0.0.1.dev13/pfund/data_tools/data_tool_pandas.py +0 -202
  110. pfund-0.0.1.dev13/pfund/engines/backtest_engine.py +0 -272
  111. pfund-0.0.1.dev13/pfund/engines/base_engine.py +0 -95
  112. pfund-0.0.1.dev13/pfund/engines/test_engine.py +0 -13
  113. pfund-0.0.1.dev13/pfund/engines/train_engine.py +0 -25
  114. pfund-0.0.1.dev13/pfund/indicators/__init__.py +0 -3
  115. pfund-0.0.1.dev13/pfund/indicators/indicator_base.py +0 -69
  116. pfund-0.0.1.dev13/pfund/indicators/talib_indicator.py +0 -55
  117. pfund-0.0.1.dev13/pfund/mixins/backtest.py +0 -175
  118. pfund-0.0.1.dev13/pfund/models/__init__.py +0 -6
  119. pfund-0.0.1.dev13/pfund/models/model_backtest.py +0 -105
  120. pfund-0.0.1.dev13/pfund/models/model_base.py +0 -484
  121. pfund-0.0.1.dev13/pfund/models/pytorch_model.py +0 -70
  122. pfund-0.0.1.dev13/pfund/models/sklearn_model.py +0 -36
  123. pfund-0.0.1.dev13/pfund/portfolio.py +0 -8
  124. pfund-0.0.1.dev13/pfund/risk_monitor.py +0 -5
  125. pfund-0.0.1.dev13/pfund/strategies/allocation_strategy.py +0 -10
  126. pfund-0.0.1.dev13/pfund/strategies/diversification_strategy.py +0 -13
  127. pfund-0.0.1.dev13/pfund/strategies/hedging_strategy.py +0 -10
  128. pfund-0.0.1.dev13/pfund/strategies/optimization_strategy.py +0 -13
  129. pfund-0.0.1.dev13/pfund/strategies/portfolio_strategy.py +0 -27
  130. pfund-0.0.1.dev13/pfund/strategies/rebalancing_strategy.py +0 -10
  131. pfund-0.0.1.dev13/pfund/strategies/strategy_backtest.py +0 -56
  132. pfund-0.0.1.dev13/pfund/strategies/strategy_base.py +0 -599
  133. pfund-0.0.1.dev13/pfund/universe.py +0 -19
  134. pfund-0.0.1.dev13/pyproject.toml +0 -75
  135. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/LICENSE +0 -0
  136. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/accounts/__init__.py +0 -0
  137. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/accounts/account_ib.py +0 -0
  138. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/adapter.py +0 -0
  139. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/balances/__init__.py +0 -0
  140. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/balances/balance_crypto.py +0 -0
  141. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/balances/balance_ib.py +0 -0
  142. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/brokers/__init__.py +0 -0
  143. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/brokers/ib/__init__.py +0 -0
  144. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/brokers/ib/ib_client.py +0 -0
  145. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/brokers/ib/ib_wrapper.py +0 -0
  146. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/cli/__init__.py +0 -0
  147. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/cli/commands/__init__.py +0 -0
  148. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/cli/main.py +0 -0
  149. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/config/binance/linear/config.yml +0 -0
  150. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/config/binance/linear/lot_sizes_linear.yml +0 -0
  151. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/config/binance/linear/pdt_matchings_linear.yml +0 -0
  152. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/config/binance/linear/tick_sizes_linear.yml +0 -0
  153. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/config/bybit/config.yml +0 -0
  154. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/config/bybit/lot_sizes_inverse.yml +0 -0
  155. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/config/bybit/lot_sizes_linear.yml +0 -0
  156. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/config/bybit/lot_sizes_option.yml +0 -0
  157. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/config/bybit/lot_sizes_spot.yml +0 -0
  158. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/config/bybit/pdt_matchings_inverse.yml +0 -0
  159. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/config/bybit/pdt_matchings_linear.yml +0 -0
  160. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/config/bybit/pdt_matchings_option.yml +0 -0
  161. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/config/bybit/pdt_matchings_spot.yml +0 -0
  162. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/config/bybit/tick_sizes_inverse.yml +0 -0
  163. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/config/bybit/tick_sizes_linear.yml +0 -0
  164. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/config/bybit/tick_sizes_option.yml +0 -0
  165. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/config/bybit/tick_sizes_spot.yml +0 -0
  166. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/config/configuration.py +0 -0
  167. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/config/ib/config.yml +0 -0
  168. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/const/_zmq_routes.py +0 -0
  169. {pfund-0.0.1.dev13/pfund/utils → pfund-0.0.2.dev1/pfund/const}/aliases.py +0 -0
  170. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/datas/__init__.py +0 -0
  171. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/datas/data_quote.py +0 -0
  172. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/datas/data_tick.py +0 -0
  173. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/errors.py +0 -0
  174. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/exchanges/__init__.py +0 -0
  175. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/exchanges/binance/__init__.py +0 -0
  176. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/exchanges/binance/rest_api.py +0 -0
  177. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/exchanges/binance/ws_api.py +0 -0
  178. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/exchanges/bybit/__init__.py +0 -0
  179. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/exchanges/bybit/rest_api.py +0 -0
  180. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/exchanges/bybit/rest_api_samples/get_markets_result_inverse +0 -0
  181. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/exchanges/bybit/rest_api_samples/get_markets_result_linear +0 -0
  182. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/exchanges/bybit/rest_api_samples/get_markets_result_option +0 -0
  183. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/exchanges/bybit/rest_api_samples/get_markets_result_spot +0 -0
  184. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/exchanges/bybit/rest_api_samples/get_markets_return_inverse +0 -0
  185. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/exchanges/bybit/rest_api_samples/get_markets_return_linear +0 -0
  186. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/exchanges/bybit/rest_api_samples/get_markets_return_option +0 -0
  187. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/exchanges/bybit/rest_api_samples/get_markets_return_spot +0 -0
  188. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/exchanges/rest_api_base.py +0 -0
  189. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/externals/ibapi/__init__.py +0 -0
  190. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/externals/ibapi/account_summary_tags.py +0 -0
  191. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/externals/ibapi/client.py +0 -0
  192. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/externals/ibapi/comm.py +0 -0
  193. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/externals/ibapi/commission_report.py +0 -0
  194. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/externals/ibapi/common.py +0 -0
  195. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/externals/ibapi/connection.py +0 -0
  196. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/externals/ibapi/contract.py +0 -0
  197. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/externals/ibapi/decoder.py +0 -0
  198. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/externals/ibapi/enum_implem.py +0 -0
  199. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/externals/ibapi/errors.py +0 -0
  200. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/externals/ibapi/execution.py +0 -0
  201. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/externals/ibapi/ibapi.pyproj +0 -0
  202. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/externals/ibapi/message.py +0 -0
  203. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/externals/ibapi/news.py +0 -0
  204. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/externals/ibapi/object_implem.py +0 -0
  205. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/externals/ibapi/order.py +0 -0
  206. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/externals/ibapi/order_condition.py +0 -0
  207. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/externals/ibapi/order_state.py +0 -0
  208. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/externals/ibapi/orderdecoder.py +0 -0
  209. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/externals/ibapi/reader.py +0 -0
  210. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/externals/ibapi/scanner.py +0 -0
  211. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/externals/ibapi/server_versions.py +0 -0
  212. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/externals/ibapi/softdollartier.py +0 -0
  213. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/externals/ibapi/tag_value.py +0 -0
  214. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/externals/ibapi/ticktype.py +0 -0
  215. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/externals/ibapi/utils.py +0 -0
  216. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/externals/ibapi/wrapper.py +0 -0
  217. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/git_controller.py +0 -0
  218. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/main.py +0 -0
  219. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/managers/__init__.py +0 -0
  220. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/managers/connection_manager.py +0 -0
  221. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/managers/order_manager.py +0 -0
  222. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/managers/portfolio_manager.py +0 -0
  223. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/orders/order_crypto.py +0 -0
  224. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/orders/order_ib.py +0 -0
  225. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/orders/order_statuses.py +0 -0
  226. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/orders/order_time_in_force.py +0 -0
  227. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/plogging/filters.py +0 -0
  228. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/plogging/formatter.py +0 -0
  229. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/plogging/handlers.py +0 -0
  230. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/positions/__init__.py +0 -0
  231. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/positions/position_crypto.py +0 -0
  232. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/products/__init__.py +0 -0
  233. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/strategies/__init__.py +0 -0
  234. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/templates/dashboards/pfund-overview.streamlit.py +0 -0
  235. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/templates/notebooks/pfund-analytics.ipynb +0 -0
  236. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/templates/notebooks/pfund-overview.ipynb +0 -0
  237. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/types/bybit.py +0 -0
  238. {pfund-0.0.1.dev13 → pfund-0.0.2.dev1}/pfund/types/core.py +0 -0
@@ -1,54 +1,67 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pfund
3
- Version: 0.0.1.dev13
3
+ Version: 0.0.2.dev1
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.13
10
+ Requires-Python: >=3.10,<4.0
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
15
  Classifier: Programming Language :: Python :: 3.12
16
- Provides-Extra: analytics
16
+ Provides-Extra: all
17
17
  Provides-Extra: data
18
+ Provides-Extra: fe
18
19
  Provides-Extra: ml
20
+ Provides-Extra: stats
21
+ Provides-Extra: train
19
22
  Requires-Dist: click (>=8.1.7,<9.0.0)
23
+ Requires-Dist: duckdb (>=1.0.0,<2.0.0)
24
+ Requires-Dist: feast (>=0.40.1,<0.41.0) ; extra == "fe" or extra == "all"
20
25
  Requires-Dist: gitpython (>=3.1.43,<4.0.0)
21
- Requires-Dist: mlflow (>=2.11.3,<3.0.0) ; extra == "ml"
22
- Requires-Dist: orjson (>=3.9.14,<4.0.0) ; extra == "data"
23
- Requires-Dist: papermill (>=2.5.0,<3.0.0) ; extra == "analytics"
24
- Requires-Dist: pfeed[boost,data,df] (>=0.0.1.dev11,<0.0.2) ; extra == "data"
25
- Requires-Dist: pfolio[bayesian,data,portfolio,temporary] (>=0.0.1.dev4,<0.0.2) ; extra == "analytics"
26
- Requires-Dist: platformdirs (>=4.2.0,<5.0.0)
26
+ Requires-Dist: ipython (>=8.23.0,<9.0.0)
27
+ Requires-Dist: mlflow (>=2.16.1,<3.0.0) ; extra == "ml" or extra == "all"
28
+ Requires-Dist: optuna (>=4.0.0,<5.0.0) ; extra == "train" or extra == "all"
29
+ Requires-Dist: orjson (>=3.10.1,<4.0.0)
30
+ Requires-Dist: papermill (>=2.6.0,<3.0.0) ; extra == "stats" or extra == "all"
31
+ Requires-Dist: pfeed[all] (>=0.0.2.dev1,<0.0.3) ; extra == "data" or extra == "all"
32
+ Requires-Dist: pfolio (>=0.0.1.dev4,<0.0.2) ; extra == "stats" or extra == "train" or extra == "all"
33
+ Requires-Dist: platformdirs (>=4.3.6,<5.0.0)
27
34
  Requires-Dist: python-dotenv (>=1.0.1,<2.0.0)
28
- Requires-Dist: python-telegram-bot (>=20.7,<21.0)
35
+ Requires-Dist: python-telegram-bot (>=21.5,<22.0)
29
36
  Requires-Dist: pyyaml (>=6.0.1,<7.0.0)
30
- Requires-Dist: pyzmq (>=25.1.2,<26.0.0) ; extra == "data"
37
+ Requires-Dist: pyzmq (>=26.2.0,<27.0.0) ; extra == "data" or extra == "all"
38
+ Requires-Dist: redis[hiredis] (>=5.1.1,<6.0.0) ; extra == "data" or extra == "all"
31
39
  Requires-Dist: requests (>=2.31.0,<3.0.0)
32
- Requires-Dist: rich (>=13.7.0,<14.0.0)
33
- Requires-Dist: schedule (>=1.2.1,<2.0.0)
34
- Requires-Dist: scikit-learn (>=1.4.0,<2.0.0) ; extra == "ml"
35
- Requires-Dist: ta (>=0.11.0,<0.12.0) ; extra == "ml"
36
- Requires-Dist: torch (>=2.1.2,<3.0.0) ; extra == "ml"
40
+ Requires-Dist: rich (>=13.7.1,<14.0.0)
41
+ Requires-Dist: schedule (>=1.2.2,<2.0.0)
42
+ Requires-Dist: scikit-learn (>=1.5.2,<2.0.0) ; extra == "ml" or extra == "all"
43
+ Requires-Dist: streamlit (>=1.39.0,<2.0.0) ; extra == "train" or extra == "all"
44
+ Requires-Dist: ta (>=0.11.0,<0.12.0) ; extra == "fe" or extra == "all"
45
+ Requires-Dist: torch (>=2.4.1,<3.0.0) ; extra == "ml" or extra == "all"
37
46
  Requires-Dist: tqdm (>=4.66.2,<5.0.0)
38
- Requires-Dist: voila (>=0.5.6,<0.6.0) ; extra == "analytics"
39
- Requires-Dist: websocket-client (>=1.7.0,<2.0.0)
47
+ Requires-Dist: trogon (>=0.6.0,<0.7.0)
48
+ Requires-Dist: tsfresh (>=0.20.3,<0.21.0) ; extra == "fe" or extra == "all"
49
+ Requires-Dist: voila (>=0.5.7,<0.6.0) ; extra == "stats" or extra == "all"
50
+ Requires-Dist: websocket-client (>=1.8.0,<2.0.0)
40
51
  Project-URL: Documentation, https://pfund-docs.pfund.ai
41
52
  Project-URL: Repository, https://github.com/PFund-Software-Ltd/pfund
42
53
  Description-Content-Type: text/markdown
43
54
 
44
- # PFund: Algo-Trading Framework for Machine Learning, TradFi, CeFi and DeFi ready.
55
+ # PFund: A Complete Algo-Trading Framework powered by Machine Learning and Data Engineering, TradFi, CeFi and DeFi ready.
45
56
 
57
+ [![Twitter Follow](https://img.shields.io/twitter/follow/pfund_ai?style=social)](https://x.com/pfund_ai)
46
58
  ![GitHub stars](https://img.shields.io/github/stars/PFund-Software-Ltd/pfund?style=social)
47
59
  ![PyPI downloads](https://img.shields.io/pypi/dm/pfund)
48
60
  [![PyPI](https://img.shields.io/pypi/v/pfund.svg)](https://pypi.org/project/pfund)
49
61
  ![PyPI - Support Python Versions](https://img.shields.io/pypi/pyversions/pfund)
50
- [![Jupyter Book Badge](https://raw.githubusercontent.com/PFund-Software-Ltd/pfund/main/docs/images/jupyterbook.svg
51
- )](https://jupyterbook.org)
62
+ <!-- [![Jupyter Book Badge](https://raw.githubusercontent.com/PFund-Software-Ltd/pfund/main/docs/images/jupyterbook.svg
63
+ )](https://jupyterbook.org) -->
64
+ [![marimo](https://marimo.io/shield.svg)](https://marimo.io)
52
65
  [![Poetry](https://img.shields.io/endpoint?url=https://python-poetry.org/badge/v0.json)](https://python-poetry.org/)
53
66
 
54
67
  [TradFi]: https://www.techopedia.com/definition/traditional-finance-tradfi
@@ -66,36 +79,42 @@ Description-Content-Type: text/markdown
66
79
  [FirstRate Data]: https://firstratedata.com
67
80
  [Mantine UI]: https://ui.mantine.dev/
68
81
 
69
- 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**.
82
+ ## Problem
83
+ Machine learning (**AI**) and data engineering (**Big Data**) fields are advancing every year, but everyday traders are **not able to enjoy the benefits** of these improvements, leading to a **widening gap** between retail traders and professional traders.
70
84
 
71
- PFund allows traders to:
72
- - perform vectorized or event-driven backtesting with
73
- - different resolutions of data, e.g. orderbook data, tick data, bar data etc.
74
- - different data tools, e.g. pandas, [polars] etc.
75
- - train machine learning models using their favorite frameworks, i.e. PFund is **ML-framework agnostic**
76
- - tune strategy (hyper)parameters by splitting data into training sets, development sets and test sets
77
- - go from backtesting to live trading by just changing **ONE line of code!!**
78
- - execute trades manually/semi-manually via a trading app (frontend+backend)
85
+ ## Solution
86
+ A modern algo-trading framework is needed to **bridge the gap** between algo-trading, machine learning and data engineering, empowering retail traders with state-of-the-art machine learning models and data engineering tools so that traders only need to focus on strategy research and the framework takes care of the rest.
79
87
 
80
- It is created to enable trading for [PFund.ai] - a trading platform that bridges algo-trading and manual trading using AI (LLM).
88
+ ---
89
+ PFund (/piː fʌnd/), which stands for "**Personal Fund**", is an **algo-trading framework** designed for using **machine learning** models natively 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**.
81
90
 
82
- Since PFund's sole purpose is for trading only, for all the data work, there is a separate library to handle that: \
91
+ ## Core Features
92
+ - [x] Supports vectorized and event-driven backtesting with different resolutions of data, e.g. tick data, second data and minute data etc.
93
+ - [x] Allows choosing your preferred data tool, e.g. pandas, polars, pyspark etc.
94
+ - [x] Supports machine learning models, features, technical analysis indicators
95
+ - [x] Trains machine learning models using your favorite frameworks, i.e. PFund is **ML-framework agnostic**
96
+ - [x] Offers **LEGO-style** strategy and model building, allowing strategies to add other strategies, models to add other models
97
+ - [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
98
+ - [x] Enables parallel data processing, e.g. Interactive Brokers and Binance each have their own process for receiving data feeds
99
+ - [x] Switches from backtesting to live trading by just changing **ONE line of code!!**
100
+ - [ ] Features a modern frontend using [Mantine UI] and TradingView's Charts library
101
+ - [ ] Supports manual/semi-manual trading via a trading app
102
+
103
+ > As PFund is for trading only, for all the data workloads, there is a separate library to handle that:\
83
104
  [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.
84
105
 
106
+ ---
85
107
 
86
108
  <details>
87
109
  <summary>Table of Contents</summary>
88
110
 
89
- - [Project Status](#project-status)
90
- - [Mission](#mission)
91
- - [Core Features](#core-features)
92
111
  - [Installation](#installation)
93
112
  - [Quick Start](#quick-start)
94
113
  - [Backtesting](#backtesting)
95
114
  - [Live Trading](#live-trading)
96
115
  - [Parameter Training / Hyperparameter Tuning](#parameter-training--hyperparameter-tuning)
97
116
  - [Building LEGO-Style Strategy and Model](#building-lego-style-strategy-and-model)
98
- - [Model Hub](#model-hub)
117
+ - [PFund Hub](#pfund-hub)
99
118
  - [Supported Trading Venues](#supported-trading-venues)
100
119
  - [Related Projects](#related-projects)
101
120
  - [Disclaimer](#disclaimer)
@@ -103,57 +122,23 @@ Since PFund's sole purpose is for trading only, for all the data work, there is
103
122
  </details>
104
123
 
105
124
 
106
- ## Project Status
107
- **_Caution: PFund is at a VERY EARLY stage, use it at your own risk._**
108
-
109
- PFund is currently under active development, the framework design will be prioritized first over
110
- stability and scalability.
111
-
112
- Please note that the available version is a *dev* version, not a *stable* one. \
113
- You are encouraged to play with the *dev* version, but only use it when a *stable* version is released.
114
-
115
- > PFund for the time being **_only supports vectorized backtesting_** using [Bybit] and Yahoo Finance data for testing purpose.
116
-
117
-
118
- ## Mission
119
- As an algo-trader, if you aim to quickly try out some trading ideas to see if they work, and if they do, deploy them for live traidng, it is actually not a trivial task since it involves multiple stages:
120
- - Ideation
121
- - Strategy development
122
- - Backtesting
123
- - Model development (if using machine learning)
124
- - Model training (if using machine learning)
125
- - Parameter training / hyperparameter tuning
126
- - Strategy deployment
127
- - Portfolio monitoring
128
-
129
- This overview already omits some intricate steps, such as data handling and API integration.
130
-
131
- > 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*.
132
-
133
-
134
- ## Core Features
135
- - [x] Easily switch environments with just one line of code, transitioning from backtesting to live trading
136
- - [x] Supports machine learning models, features, technical analysis indicators
137
- - [x] Both Strategy() and Model() are treated as first-class citizens
138
- - [x] Offers LEGO-style strategy and model building, allowing strategies to add other strategies, models to add other models
139
- - [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
140
- - [x] Enables parallel data processing, e.g. Interactive Brokers and Binance each have their own process for receiving data feeds
141
- - [ ] Allows choosing your preferred data tool, e.g. pandas, polars, pyspark etc.
142
- - [ ] Features a modern frontend using [Mantine UI] and TradingView's Charts library
143
- - [ ] Supports manual/semi-manual trading using the frontend
144
-
145
-
146
125
  ## Installation
147
126
 
148
127
  ### Using [Poetry] (Recommended)
149
128
  ```bash
150
- # [RECOMMENDED]: trading + backtest
151
- poetry add "pfund[data]"
129
+ # [RECOMMENDED]: Trading + Backtesting + Machine Learning + Feature Engineering (e.g. feast, tsfresh, ta) + Analytics
130
+ poetry add "pfund[all]"
131
+
132
+ # [Trading + Backtesting + Machine Learning + Feature Engineering]:
133
+ poetry add "pfund[data,ml,fe]"
152
134
 
153
- # [Machine Learning]: trading + backtest + machine learning/technical analysis
135
+ # [Trading + Backtesting + Machine Learning]:
154
136
  poetry add "pfund[data,ml]"
155
137
 
156
- # only trading
138
+ # [Trading + Backtesting]:
139
+ poetry add "pfund[data]"
140
+
141
+ # [Trading only]:
157
142
  poetry add pfund
158
143
 
159
144
  # update to the latest version:
@@ -162,7 +147,8 @@ poetry update pfund
162
147
 
163
148
  ### Using Pip
164
149
  ```bash
165
- pip install pfund
150
+ # same as above, you can choose to install "pfund[all]", "pfund[data,ml,fe]", "pfund[data,ml]", "pfund[data]" or "pfund"
151
+ pip install "pfund[all]"
166
152
 
167
153
  # install the latest version:
168
154
  pip install -U pfund
@@ -253,12 +239,13 @@ engine.run()
253
239
  ```
254
240
 
255
241
 
256
- ## Model Hub
257
- Imagine a space where algo-traders can share their machine learning models with one another.
242
+ ## PFund Hub
243
+ Imagine a space where algo-traders can share their trading strategies and machine learning models with one another.
258
244
  Strategy and model development could be so much faster since you can build on top of an existing working model.
259
- > Model Hub is coming soon on [PFund.ai], Stay Tuned!
260
245
 
261
246
 
247
+ ---
248
+
262
249
  ## Supported Trading Venues
263
250
  | Trading Venue | Vectorized Backtesting | Event-Driven Backtesting | Paper Trading | Live Trading |
264
251
  | ------------------------- | ---------------------- | ------------------------ | ------------- | ------------ |
@@ -1,11 +1,13 @@
1
- # PFund: Algo-Trading Framework for Machine Learning, TradFi, CeFi and DeFi ready.
1
+ # PFund: A Complete Algo-Trading Framework powered by Machine Learning and Data Engineering, TradFi, CeFi and DeFi ready.
2
2
 
3
+ [![Twitter Follow](https://img.shields.io/twitter/follow/pfund_ai?style=social)](https://x.com/pfund_ai)
3
4
  ![GitHub stars](https://img.shields.io/github/stars/PFund-Software-Ltd/pfund?style=social)
4
5
  ![PyPI downloads](https://img.shields.io/pypi/dm/pfund)
5
6
  [![PyPI](https://img.shields.io/pypi/v/pfund.svg)](https://pypi.org/project/pfund)
6
7
  ![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)
8
+ <!-- [![Jupyter Book Badge](https://raw.githubusercontent.com/PFund-Software-Ltd/pfund/main/docs/images/jupyterbook.svg
9
+ )](https://jupyterbook.org) -->
10
+ [![marimo](https://marimo.io/shield.svg)](https://marimo.io)
9
11
  [![Poetry](https://img.shields.io/endpoint?url=https://python-poetry.org/badge/v0.json)](https://python-poetry.org/)
10
12
 
11
13
  [TradFi]: https://www.techopedia.com/definition/traditional-finance-tradfi
@@ -23,36 +25,42 @@
23
25
  [FirstRate Data]: https://firstratedata.com
24
26
  [Mantine UI]: https://ui.mantine.dev/
25
27
 
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**.
28
+ ## Problem
29
+ Machine learning (**AI**) and data engineering (**Big Data**) fields are advancing every year, but everyday traders are **not able to enjoy the benefits** of these improvements, leading to a **widening gap** between retail traders and professional traders.
27
30
 
28
- PFund allows traders to:
29
- - perform vectorized or event-driven backtesting with
30
- - different resolutions of data, e.g. orderbook data, tick data, bar data etc.
31
- - different data tools, e.g. pandas, [polars] etc.
32
- - train machine learning models using their favorite frameworks, i.e. PFund is **ML-framework agnostic**
33
- - tune strategy (hyper)parameters by splitting data into training sets, development sets and test sets
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)
31
+ ## Solution
32
+ A modern algo-trading framework is needed to **bridge the gap** between algo-trading, machine learning and data engineering, empowering retail traders with state-of-the-art machine learning models and data engineering tools so that traders only need to focus on strategy research and the framework takes care of the rest.
36
33
 
37
- It is created to enable trading for [PFund.ai] - a trading platform that bridges algo-trading and manual trading using AI (LLM).
34
+ ---
35
+ PFund (/piː fʌnd/), which stands for "**Personal Fund**", is an **algo-trading framework** designed for using **machine learning** models natively 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**.
38
36
 
39
- Since PFund's sole purpose is for trading only, for all the data work, there is a separate library to handle that: \
37
+ ## Core Features
38
+ - [x] Supports vectorized and event-driven backtesting with different resolutions of data, e.g. tick data, second data and minute data etc.
39
+ - [x] Allows choosing your preferred data tool, e.g. pandas, polars, pyspark etc.
40
+ - [x] Supports machine learning models, features, technical analysis indicators
41
+ - [x] Trains machine learning models using your favorite frameworks, i.e. PFund is **ML-framework agnostic**
42
+ - [x] Offers **LEGO-style** strategy and model building, allowing strategies to add other strategies, models to add other models
43
+ - [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
44
+ - [x] Enables parallel data processing, e.g. Interactive Brokers and Binance each have their own process for receiving data feeds
45
+ - [x] Switches from backtesting to live trading by just changing **ONE line of code!!**
46
+ - [ ] Features a modern frontend using [Mantine UI] and TradingView's Charts library
47
+ - [ ] Supports manual/semi-manual trading via a trading app
48
+
49
+ > As PFund is for trading only, for all the data workloads, there is a separate library to handle that:\
40
50
  [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.
41
51
 
52
+ ---
42
53
 
43
54
  <details>
44
55
  <summary>Table of Contents</summary>
45
56
 
46
- - [Project Status](#project-status)
47
- - [Mission](#mission)
48
- - [Core Features](#core-features)
49
57
  - [Installation](#installation)
50
58
  - [Quick Start](#quick-start)
51
59
  - [Backtesting](#backtesting)
52
60
  - [Live Trading](#live-trading)
53
61
  - [Parameter Training / Hyperparameter Tuning](#parameter-training--hyperparameter-tuning)
54
62
  - [Building LEGO-Style Strategy and Model](#building-lego-style-strategy-and-model)
55
- - [Model Hub](#model-hub)
63
+ - [PFund Hub](#pfund-hub)
56
64
  - [Supported Trading Venues](#supported-trading-venues)
57
65
  - [Related Projects](#related-projects)
58
66
  - [Disclaimer](#disclaimer)
@@ -60,57 +68,23 @@ Since PFund's sole purpose is for trading only, for all the data work, there is
60
68
  </details>
61
69
 
62
70
 
63
- ## Project Status
64
- **_Caution: PFund is at a VERY EARLY stage, use it at your own risk._**
65
-
66
- PFund is currently under active development, the framework design will be prioritized first over
67
- stability and scalability.
68
-
69
- Please note that the available version is a *dev* version, not a *stable* one. \
70
- You are encouraged to play with the *dev* version, but only use it when a *stable* version is released.
71
-
72
- > PFund for the time being **_only supports vectorized backtesting_** using [Bybit] and Yahoo Finance data for testing purpose.
73
-
74
-
75
- ## Mission
76
- As an algo-trader, if you aim to quickly try out some trading ideas to see if they work, and if they do, deploy them for live traidng, it is actually not a trivial task since it involves multiple stages:
77
- - Ideation
78
- - Strategy development
79
- - Backtesting
80
- - Model development (if using machine learning)
81
- - Model training (if using machine learning)
82
- - Parameter training / hyperparameter tuning
83
- - Strategy deployment
84
- - Portfolio monitoring
85
-
86
- This overview already omits some intricate steps, such as data handling and API integration.
87
-
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*.
89
-
90
-
91
- ## Core Features
92
- - [x] Easily switch environments with just one line of code, transitioning from backtesting to live trading
93
- - [x] Supports machine learning models, features, technical analysis indicators
94
- - [x] Both Strategy() and Model() are treated as first-class citizens
95
- - [x] Offers LEGO-style strategy and model building, allowing strategies to add other strategies, models to add other models
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
97
- - [x] Enables parallel data processing, e.g. Interactive Brokers and Binance each have their own process for receiving data feeds
98
- - [ ] Allows choosing your preferred data tool, e.g. pandas, polars, pyspark etc.
99
- - [ ] Features a modern frontend using [Mantine UI] and TradingView's Charts library
100
- - [ ] Supports manual/semi-manual trading using the frontend
101
-
102
-
103
71
  ## Installation
104
72
 
105
73
  ### Using [Poetry] (Recommended)
106
74
  ```bash
107
- # [RECOMMENDED]: trading + backtest
108
- poetry add "pfund[data]"
75
+ # [RECOMMENDED]: Trading + Backtesting + Machine Learning + Feature Engineering (e.g. feast, tsfresh, ta) + Analytics
76
+ poetry add "pfund[all]"
77
+
78
+ # [Trading + Backtesting + Machine Learning + Feature Engineering]:
79
+ poetry add "pfund[data,ml,fe]"
109
80
 
110
- # [Machine Learning]: trading + backtest + machine learning/technical analysis
81
+ # [Trading + Backtesting + Machine Learning]:
111
82
  poetry add "pfund[data,ml]"
112
83
 
113
- # only trading
84
+ # [Trading + Backtesting]:
85
+ poetry add "pfund[data]"
86
+
87
+ # [Trading only]:
114
88
  poetry add pfund
115
89
 
116
90
  # update to the latest version:
@@ -119,7 +93,8 @@ poetry update pfund
119
93
 
120
94
  ### Using Pip
121
95
  ```bash
122
- pip install pfund
96
+ # same as above, you can choose to install "pfund[all]", "pfund[data,ml,fe]", "pfund[data,ml]", "pfund[data]" or "pfund"
97
+ pip install "pfund[all]"
123
98
 
124
99
  # install the latest version:
125
100
  pip install -U pfund
@@ -210,12 +185,13 @@ engine.run()
210
185
  ```
211
186
 
212
187
 
213
- ## Model Hub
214
- Imagine a space where algo-traders can share their machine learning models with one another.
188
+ ## PFund Hub
189
+ Imagine a space where algo-traders can share their trading strategies and machine learning models with one another.
215
190
  Strategy and model development could be so much faster since you can build on top of an existing working model.
216
- > Model Hub is coming soon on [PFund.ai], Stay Tuned!
217
191
 
218
192
 
193
+ ---
194
+
219
195
  ## Supported Trading Venues
220
196
  | Trading Venue | Vectorized Backtesting | Event-Driven Backtesting | Paper Trading | Live Trading |
221
197
  | ------------------------- | ---------------------- | ------------------------ | ------------- | ------------ |
@@ -3,7 +3,7 @@
3
3
  git clone git@github.com:PFund-Software-Ltd/pfund.git
4
4
  cd pfund
5
5
  git submodule update --init --recursive
6
- poetry install --all-extras
6
+ poetry install --with dev,test,doc --all-extras
7
7
  ```
8
8
 
9
9
  ## Pull updates
@@ -0,0 +1,32 @@
1
+ import sys
2
+ from importlib.metadata import version
3
+
4
+ from pfund.config_handler import configure
5
+ from pfund.const.aliases import ALIASES as aliases
6
+ from pfund.const.paths import PROJ_PATH
7
+ # add python path so that for files like "ibapi" (official python code from IB) can find their modules
8
+ sys.path.append(f'{PROJ_PATH}/externals')
9
+ from pfund.engines import BacktestEngine, TradeEngine, TrainEngine, SandboxEngine
10
+ from pfund.strategies import Strategy
11
+ from pfund.models import Model, Feature, PytorchModel, SklearnModel
12
+ from pfund.indicators import Indicator, TalibIndicator, TaIndicator
13
+
14
+
15
+ __version__ = version('pfund')
16
+ __all__ = (
17
+ '__version__',
18
+ 'configure',
19
+ 'aliases',
20
+ 'BacktestEngine',
21
+ 'TradeEngine',
22
+ 'TrainEngine',
23
+ 'SandboxEngine',
24
+ 'Strategy',
25
+ 'Model',
26
+ 'Feature',
27
+ 'PytorchModel',
28
+ 'SklearnModel',
29
+ 'Indicator',
30
+ 'TalibIndicator',
31
+ 'TaIndicator',
32
+ )
@@ -20,4 +20,16 @@ class BaseAccount:
20
20
  return f'Broker={self.bkr}|Account={self.name}|Strategy={self.strat}'
21
21
 
22
22
  def __repr__(self):
23
- return f'{self.bkr}-{self.name}'
23
+ return f'{self.bkr}-{self.name}'
24
+
25
+ def __eq__(self, other):
26
+ if not isinstance(other, BaseAccount):
27
+ return NotImplemented # Allow other types to define equality with BaseProduct
28
+ return (
29
+ self.env == other.env
30
+ and self.bkr == other.bkr
31
+ and self.name == other.name
32
+ )
33
+
34
+ def __hash__(self):
35
+ return hash((self.env, self.bkr, self.name))
@@ -0,0 +1,33 @@
1
+ from pfund.accounts.account_base import BaseAccount
2
+ from pfund.const.common import SUPPORTED_BYBIT_ACCOUNT_TYPES
3
+
4
+
5
+ class CryptoAccount(BaseAccount):
6
+ def __init__(self, env, exch, key='', secret='', acc='', **kwargs):
7
+ self.exch = exch.upper()
8
+ if self.exch == 'BYBIT':
9
+ assert 'account_type' in kwargs and kwargs['account_type'].upper() in SUPPORTED_BYBIT_ACCOUNT_TYPES, \
10
+ f"kwarg 'account_type' must be provided for exchange {self.exch}, {SUPPORTED_BYBIT_ACCOUNT_TYPES=}"
11
+ super().__init__(env, 'CRYPTO', acc=acc, key=key, secret=secret, **kwargs)
12
+ if self.env in ['PAPER', 'LIVE']:
13
+ assert key, f'API `key` must be provided for {self.env} trading environment'
14
+ assert secret, f'API `secret` must be provided for {self.env} trading environment'
15
+
16
+ def __str__(self):
17
+ return f'Broker={self.bkr}|Exchange={self.exch}|Account={self.name}|Strategy={self.strat}'
18
+
19
+ def __repr__(self):
20
+ return f'{self.bkr}-{self.exch}-{self.name}'
21
+
22
+ def __eq__(self, other):
23
+ if not isinstance(other, CryptoAccount):
24
+ return NotImplemented # Allow other types to define equality with BaseProduct
25
+ return (
26
+ self.env == other.env
27
+ and self.bkr == other.bkr
28
+ and self.exch == other.exch
29
+ and self.name == other.name
30
+ )
31
+
32
+ def __hash__(self):
33
+ return hash((self.env, self.bkr, self.exch, self.name))
@@ -1,6 +1,7 @@
1
1
  from __future__ import annotations
2
2
 
3
3
  import os
4
+ import json
4
5
  from pathlib import Path
5
6
 
6
7
  from typing import TYPE_CHECKING
@@ -23,9 +24,22 @@ class Analyzer:
23
24
  spreadsheet_path = Path(config.spreadsheet_path)
24
25
  dashboard_path = Path(config.dashboard_path)
25
26
 
26
- def __init__(self, data: dict | None=None):
27
- self.data = data or {}
27
+ def __init__(self, data: dict | None=None, backtest_name=''):
28
+ self._data = data or {}
29
+ if backtest_name:
30
+ self._data = self._load_backtest_history(backtest_name)
31
+ if data:
32
+ print('Warning: backtest_name is provided, but data is also provided, data will be ignored')
28
33
 
34
+ def _load_backtest_history(self, backtest_name: str) -> dict:
35
+ if '.json' not in backtest_name:
36
+ backtest_name += '.json'
37
+ file_path = os.path.join(self.config.backtest_path, backtest_name)
38
+ backtest_history = {}
39
+ with open(file_path, 'r') as f:
40
+ backtest_history = json.load(f)
41
+ return backtest_history
42
+
29
43
  @staticmethod
30
44
  def _is_file(template: str) -> bool:
31
45
  if '\\' in template or '/' in template:
@@ -126,7 +140,7 @@ class Analyzer:
126
140
  nb_output_file_paths = []
127
141
  if isinstance(notebooks, str):
128
142
  notebooks = [notebooks]
129
- data = data or self.data
143
+ data = data or self._data
130
144
  if not data:
131
145
  raise ValueError("No data passed in or stored in the Analyzer instance, please pass in the data to be analyzed.")
132
146