roboquant 2.1.3__tar.gz → 2.2.0__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 (142) hide show
  1. {roboquant-2.1.3 → roboquant-2.2.0}/.github/workflows/verify.yml +3 -0
  2. {roboquant-2.1.3 → roboquant-2.2.0}/LICENSE +1 -1
  3. {roboquant-2.1.3 → roboquant-2.2.0}/PKG-INFO +5 -5
  4. {roboquant-2.1.3 → roboquant-2.2.0}/README.md +4 -4
  5. roboquant-2.2.0/docs/DESIGN.md +85 -0
  6. {roboquant-2.1.3 → roboquant-2.2.0}/roboquant/__init__.py +2 -3
  7. roboquant-2.2.0/roboquant/ai/__init__.py +6 -0
  8. {roboquant-2.1.3/roboquant/ml → roboquant-2.2.0/roboquant/ai}/features.py +1 -1
  9. {roboquant-2.1.3/roboquant/ml → roboquant-2.2.0/roboquant/ai}/rl.py +2 -2
  10. {roboquant-2.1.3/roboquant/ml → roboquant-2.2.0/roboquant/ai}/strategies.py +1 -1
  11. {roboquant-2.1.3 → roboquant-2.2.0}/roboquant/brokers/broker.py +2 -2
  12. roboquant-2.2.0/roboquant/crypto/__init__.py +3 -0
  13. {roboquant-2.1.3 → roboquant-2.2.0}/tests/integration/test_ccxt.py +1 -1
  14. {roboquant-2.1.3 → roboquant-2.2.0}/tests/samples/crypto_backtest.py +1 -1
  15. {roboquant-2.1.3 → roboquant-2.2.0}/tests/samples/sb3_strategy.py +2 -2
  16. {roboquant-2.1.3 → roboquant-2.2.0}/tests/samples/sb3_strategy_quotes.py +2 -2
  17. {roboquant-2.1.3 → roboquant-2.2.0}/tests/samples/talib_feature.py +1 -1
  18. {roboquant-2.1.3 → roboquant-2.2.0}/tests/samples/talib_strategy.py +0 -1
  19. {roboquant-2.1.3 → roboquant-2.2.0}/tests/samples/torch_lstm.py +2 -2
  20. {roboquant-2.1.3 → roboquant-2.2.0}/tests/samples/torch_transformer.py +2 -2
  21. {roboquant-2.1.3 → roboquant-2.2.0}/tests/unit/test_features.py +1 -1
  22. {roboquant-2.1.3 → roboquant-2.2.0}/tests/unit/test_rnn.py +2 -2
  23. roboquant-2.1.3/docs/DESIGN.md +0 -0
  24. roboquant-2.1.3/tests/unit/__init__.py +0 -0
  25. {roboquant-2.1.3 → roboquant-2.2.0}/.gitignore +0 -0
  26. {roboquant-2.1.3 → roboquant-2.2.0}/.vscode/settings.json +0 -0
  27. {roboquant-2.1.3 → roboquant-2.2.0}/.zed/settings.json +0 -0
  28. {roboquant-2.1.3 → roboquant-2.2.0}/.zed/tasks.json +0 -0
  29. {roboquant-2.1.3 → roboquant-2.2.0}/bin/local_install.sh +0 -0
  30. {roboquant-2.1.3 → roboquant-2.2.0}/bin/publish.sh +0 -0
  31. {roboquant-2.1.3 → roboquant-2.2.0}/bin/verify.sh +0 -0
  32. {roboquant-2.1.3 → roboquant-2.2.0}/docs/roboquant_header.png +0 -0
  33. {roboquant-2.1.3 → roboquant-2.2.0}/pyproject.toml +0 -0
  34. {roboquant-2.1.3 → roboquant-2.2.0}/roboquant/account.py +0 -0
  35. {roboquant-2.1.3 → roboquant-2.2.0}/roboquant/alpaca/__init__.py +0 -0
  36. {roboquant-2.1.3 → roboquant-2.2.0}/roboquant/alpaca/broker.py +0 -0
  37. {roboquant-2.1.3 → roboquant-2.2.0}/roboquant/alpaca/feed.py +0 -0
  38. {roboquant-2.1.3 → roboquant-2.2.0}/roboquant/asset.py +0 -0
  39. {roboquant-2.1.3 → roboquant-2.2.0}/roboquant/brokers/__init__.py +0 -0
  40. {roboquant-2.1.3 → roboquant-2.2.0}/roboquant/brokers/simbroker.py +0 -0
  41. {roboquant-2.1.3/roboquant/brokers → roboquant-2.2.0/roboquant/crypto}/cryptobroker.py +0 -0
  42. {roboquant-2.1.3/roboquant/feeds → roboquant-2.2.0/roboquant/crypto}/cryptofeed.py +0 -0
  43. {roboquant-2.1.3 → roboquant-2.2.0}/roboquant/event.py +0 -0
  44. {roboquant-2.1.3 → roboquant-2.2.0}/roboquant/feeds/__init__.py +0 -0
  45. {roboquant-2.1.3 → roboquant-2.2.0}/roboquant/feeds/csvfeed.py +0 -0
  46. {roboquant-2.1.3 → roboquant-2.2.0}/roboquant/feeds/feed.py +0 -0
  47. {roboquant-2.1.3 → roboquant-2.2.0}/roboquant/feeds/historic.py +0 -0
  48. {roboquant-2.1.3 → roboquant-2.2.0}/roboquant/feeds/live.py +0 -0
  49. {roboquant-2.1.3 → roboquant-2.2.0}/roboquant/feeds/parquet.py +0 -0
  50. {roboquant-2.1.3 → roboquant-2.2.0}/roboquant/feeds/randomwalk.py +0 -0
  51. {roboquant-2.1.3 → roboquant-2.2.0}/roboquant/feeds/resources/us10.parquet +0 -0
  52. {roboquant-2.1.3 → roboquant-2.2.0}/roboquant/feeds/sql.py +0 -0
  53. {roboquant-2.1.3 → roboquant-2.2.0}/roboquant/feeds/util.py +0 -0
  54. {roboquant-2.1.3 → roboquant-2.2.0}/roboquant/feeds/yahoo.py +0 -0
  55. {roboquant-2.1.3 → roboquant-2.2.0}/roboquant/ibkr/__init__.py +0 -0
  56. {roboquant-2.1.3 → roboquant-2.2.0}/roboquant/ibkr/broker.py +0 -0
  57. {roboquant-2.1.3 → roboquant-2.2.0}/roboquant/ibkr/types.py +0 -0
  58. {roboquant-2.1.3 → roboquant-2.2.0}/roboquant/journals/__init__.py +0 -0
  59. {roboquant-2.1.3 → roboquant-2.2.0}/roboquant/journals/alphabeta.py +0 -0
  60. {roboquant-2.1.3 → roboquant-2.2.0}/roboquant/journals/basicjournal.py +0 -0
  61. {roboquant-2.1.3 → roboquant-2.2.0}/roboquant/journals/feedmetric.py +0 -0
  62. {roboquant-2.1.3 → roboquant-2.2.0}/roboquant/journals/journal.py +0 -0
  63. {roboquant-2.1.3 → roboquant-2.2.0}/roboquant/journals/marketmetric.py +0 -0
  64. {roboquant-2.1.3 → roboquant-2.2.0}/roboquant/journals/metric.py +0 -0
  65. {roboquant-2.1.3 → roboquant-2.2.0}/roboquant/journals/metricsjournal.py +0 -0
  66. {roboquant-2.1.3 → roboquant-2.2.0}/roboquant/journals/pnlmetric.py +0 -0
  67. {roboquant-2.1.3 → roboquant-2.2.0}/roboquant/journals/pricemetric.py +0 -0
  68. {roboquant-2.1.3 → roboquant-2.2.0}/roboquant/journals/runmetric.py +0 -0
  69. {roboquant-2.1.3 → roboquant-2.2.0}/roboquant/journals/scorecard.py +0 -0
  70. {roboquant-2.1.3 → roboquant-2.2.0}/roboquant/journals/tensorboard.py +0 -0
  71. {roboquant-2.1.3 → roboquant-2.2.0}/roboquant/monetary.py +0 -0
  72. {roboquant-2.1.3 → roboquant-2.2.0}/roboquant/order.py +0 -0
  73. {roboquant-2.1.3 → roboquant-2.2.0}/roboquant/run.py +0 -0
  74. {roboquant-2.1.3 → roboquant-2.2.0}/roboquant/signal.py +0 -0
  75. {roboquant-2.1.3 → roboquant-2.2.0}/roboquant/strategies/__init__.py +0 -0
  76. {roboquant-2.1.3 → roboquant-2.2.0}/roboquant/strategies/buffer.py +0 -0
  77. {roboquant-2.1.3 → roboquant-2.2.0}/roboquant/strategies/cachedstrategy.py +0 -0
  78. {roboquant-2.1.3 → roboquant-2.2.0}/roboquant/strategies/emacrossover.py +0 -0
  79. {roboquant-2.1.3 → roboquant-2.2.0}/roboquant/strategies/ibsstrategy.py +0 -0
  80. {roboquant-2.1.3 → roboquant-2.2.0}/roboquant/strategies/multistrategy.py +0 -0
  81. {roboquant-2.1.3 → roboquant-2.2.0}/roboquant/strategies/strategy.py +0 -0
  82. {roboquant-2.1.3 → roboquant-2.2.0}/roboquant/strategies/tastrategy.py +0 -0
  83. {roboquant-2.1.3 → roboquant-2.2.0}/roboquant/ta/__init__.py +0 -0
  84. {roboquant-2.1.3 → roboquant-2.2.0}/roboquant/timeframe.py +0 -0
  85. {roboquant-2.1.3 → roboquant-2.2.0}/roboquant/traders/__init__.py +0 -0
  86. {roboquant-2.1.3 → roboquant-2.2.0}/roboquant/traders/flextrader.py +0 -0
  87. {roboquant-2.1.3 → roboquant-2.2.0}/roboquant/traders/trader.py +0 -0
  88. {roboquant-2.1.3/roboquant/ml → roboquant-2.2.0/tests}/__init__.py +0 -0
  89. {roboquant-2.1.3 → roboquant-2.2.0}/tests/common.py +0 -0
  90. {roboquant-2.1.3 → roboquant-2.2.0}/tests/data/stooq/5_min/ibm.us.txt +0 -0
  91. {roboquant-2.1.3 → roboquant-2.2.0}/tests/data/stooq/daily/ibm.us.txt +0 -0
  92. {roboquant-2.1.3 → roboquant-2.2.0}/tests/data/yahoo/AAPL.csv +0 -0
  93. {roboquant-2.1.3 → roboquant-2.2.0}/tests/data/yahoo/AMZN.csv +0 -0
  94. {roboquant-2.1.3 → roboquant-2.2.0}/tests/data/yahoo/META.csv +0 -0
  95. {roboquant-2.1.3 → roboquant-2.2.0}/tests/data/yahoo/TSLA.csv +0 -0
  96. {roboquant-2.1.3/tests → roboquant-2.2.0/tests/integration}/__init__.py +0 -0
  97. {roboquant-2.1.3 → roboquant-2.2.0}/tests/integration/test_alpaca.py +0 -0
  98. {roboquant-2.1.3 → roboquant-2.2.0}/tests/integration/test_ibkr.py +0 -0
  99. {roboquant-2.1.3 → roboquant-2.2.0}/tests/integration/test_yahoo.py +0 -0
  100. {roboquant-2.1.3/tests/integration → roboquant-2.2.0/tests/performance}/__init__.py +0 -0
  101. {roboquant-2.1.3 → roboquant-2.2.0}/tests/performance/test_bigfeed.py +0 -0
  102. {roboquant-2.1.3 → roboquant-2.2.0}/tests/performance/test_delay.py +0 -0
  103. {roboquant-2.1.3 → roboquant-2.2.0}/tests/performance/test_profiling.py +0 -0
  104. {roboquant-2.1.3/tests/performance → roboquant-2.2.0/tests/samples}/__init__.py +0 -0
  105. {roboquant-2.1.3 → roboquant-2.2.0}/tests/samples/alpaca_forwardtest_bars.py +0 -0
  106. {roboquant-2.1.3 → roboquant-2.2.0}/tests/samples/alpaca_forwardtest_trades.py +0 -0
  107. {roboquant-2.1.3 → roboquant-2.2.0}/tests/samples/alpaca_live_feed.py +0 -0
  108. {roboquant-2.1.3 → roboquant-2.2.0}/tests/samples/alpaca_papertrade.py +0 -0
  109. {roboquant-2.1.3 → roboquant-2.2.0}/tests/samples/alpaca_record.py +0 -0
  110. {roboquant-2.1.3 → roboquant-2.2.0}/tests/samples/charts.py +0 -0
  111. {roboquant-2.1.3 → roboquant-2.2.0}/tests/samples/chronos_prediction.py +0 -0
  112. {roboquant-2.1.3 → roboquant-2.2.0}/tests/samples/extra_logging.py +0 -0
  113. {roboquant-2.1.3 → roboquant-2.2.0}/tests/samples/ibkr_close_positions.py +0 -0
  114. {roboquant-2.1.3 → roboquant-2.2.0}/tests/samples/monetary.py +0 -0
  115. {roboquant-2.1.3 → roboquant-2.2.0}/tests/samples/pandas_dataframe.py +0 -0
  116. {roboquant-2.1.3 → roboquant-2.2.0}/tests/samples/parquet_csv.py +0 -0
  117. {roboquant-2.1.3 → roboquant-2.2.0}/tests/samples/parquet_csv_large.py +0 -0
  118. {roboquant-2.1.3 → roboquant-2.2.0}/tests/samples/parquet_yahoo.py +0 -0
  119. {roboquant-2.1.3 → roboquant-2.2.0}/tests/samples/tensorboard_metrics.py +0 -0
  120. {roboquant-2.1.3 → roboquant-2.2.0}/tests/samples/yahoo_backtest.py +0 -0
  121. {roboquant-2.1.3 → roboquant-2.2.0}/tests/samples/yahoo_walkforward.py +0 -0
  122. {roboquant-2.1.3 → roboquant-2.2.0}/tests/samples/yahoo_walkforward_multiprocess.py +0 -0
  123. {roboquant-2.1.3/tests/samples → roboquant-2.2.0/tests/unit}/__init__.py +0 -0
  124. {roboquant-2.1.3 → roboquant-2.2.0}/tests/unit/test_account.py +0 -0
  125. {roboquant-2.1.3 → roboquant-2.2.0}/tests/unit/test_asset.py +0 -0
  126. {roboquant-2.1.3 → roboquant-2.2.0}/tests/unit/test_buffer.py +0 -0
  127. {roboquant-2.1.3 → roboquant-2.2.0}/tests/unit/test_csvfeed.py +0 -0
  128. {roboquant-2.1.3 → roboquant-2.2.0}/tests/unit/test_feedutil.py +0 -0
  129. {roboquant-2.1.3 → roboquant-2.2.0}/tests/unit/test_journal.py +0 -0
  130. {roboquant-2.1.3 → roboquant-2.2.0}/tests/unit/test_monetary.py +0 -0
  131. {roboquant-2.1.3 → roboquant-2.2.0}/tests/unit/test_order.py +0 -0
  132. {roboquant-2.1.3 → roboquant-2.2.0}/tests/unit/test_parquetfeed.py +0 -0
  133. {roboquant-2.1.3 → roboquant-2.2.0}/tests/unit/test_randomwalk.py +0 -0
  134. {roboquant-2.1.3 → roboquant-2.2.0}/tests/unit/test_run.py +0 -0
  135. {roboquant-2.1.3 → roboquant-2.2.0}/tests/unit/test_signal.py +0 -0
  136. {roboquant-2.1.3 → roboquant-2.2.0}/tests/unit/test_simbroker.py +0 -0
  137. {roboquant-2.1.3 → roboquant-2.2.0}/tests/unit/test_sqlfeed.py +0 -0
  138. {roboquant-2.1.3 → roboquant-2.2.0}/tests/unit/test_strategy.py +0 -0
  139. {roboquant-2.1.3 → roboquant-2.2.0}/tests/unit/test_tastrategy.py +0 -0
  140. {roboquant-2.1.3 → roboquant-2.2.0}/tests/unit/test_tensorboard.py +0 -0
  141. {roboquant-2.1.3 → roboquant-2.2.0}/tests/unit/test_timeframe.py +0 -0
  142. {roboquant-2.1.3 → roboquant-2.2.0}/uv.lock +0 -0
@@ -8,6 +8,9 @@ on:
8
8
  pull_request:
9
9
  branches: [ "main" ]
10
10
 
11
+ env:
12
+ PYRIGHT_PYTHON_FORCE_VERSION: latest
13
+
11
14
  jobs:
12
15
  verify:
13
16
 
@@ -186,7 +186,7 @@
186
186
  same "printed page" as the copyright notice for easier
187
187
  identification within third-party archives.
188
188
 
189
- Copyright 2024, 2025 Neural Layer
189
+ Copyright 2024, 2025, 2026 Neural Layer
190
190
 
191
191
  Licensed under the Apache License, Version 2.0 (the "License");
192
192
  you may not use this file except in compliance with the License.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: roboquant
3
- Version: 2.1.3
3
+ Version: 2.2.0
4
4
  Summary: A fast algorithmic trading platform with support for AI based strategies
5
5
  Project-URL: Homepage, https://roboquant.org
6
6
  Project-URL: Repository, https://github.com/neurallayer/roboquant.py.git
@@ -43,10 +43,10 @@ Description-Content-Type: text/markdown
43
43
 
44
44
  # ![roboquant logo](https://github.com/neurallayer/roboquant.py/raw/main/docs/roboquant_header.png)
45
45
 
46
- ![PyPI - Version](https://img.shields.io/pypi/v/roboquant)
47
- ![PyPI - License](https://img.shields.io/pypi/l/roboquant)
48
- ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/roboquant)
49
- ![PyPI - Status](https://img.shields.io/pypi/status/roboquant)
46
+ ![PyPI - Version](https://img.shields.io/pypi/v/roboquant?)
47
+ ![PyPI - License](https://img.shields.io/pypi/l/roboquant?)
48
+ ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/roboquant?)
49
+ ![PyPI - Status](https://img.shields.io/pypi/status/roboquant?)
50
50
  ![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/neurallayer/roboquant.py/verify.yml)
51
51
  [![discord](https://img.shields.io/discord/954650958300856340?label=discord)](https://discord.com/channels/954650958300856340/954650958300856343)
52
52
 
@@ -1,10 +1,10 @@
1
1
 
2
2
  # ![roboquant logo](https://github.com/neurallayer/roboquant.py/raw/main/docs/roboquant_header.png)
3
3
 
4
- ![PyPI - Version](https://img.shields.io/pypi/v/roboquant)
5
- ![PyPI - License](https://img.shields.io/pypi/l/roboquant)
6
- ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/roboquant)
7
- ![PyPI - Status](https://img.shields.io/pypi/status/roboquant)
4
+ ![PyPI - Version](https://img.shields.io/pypi/v/roboquant?)
5
+ ![PyPI - License](https://img.shields.io/pypi/l/roboquant?)
6
+ ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/roboquant?)
7
+ ![PyPI - Status](https://img.shields.io/pypi/status/roboquant?)
8
8
  ![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/neurallayer/roboquant.py/verify.yml)
9
9
  [![discord](https://img.shields.io/discord/954650958300856340?label=discord)](https://discord.com/channels/954650958300856340/954650958300856343)
10
10
 
@@ -0,0 +1,85 @@
1
+ # Design Principles
2
+
3
+ ## Modular Pipeline Architecture
4
+
5
+ The library is built around a clean separation of five orthogonal concerns:
6
+
7
+ | Component | Responsibility | Has access to Account? |
8
+ |-----------|---------------|----------------------|
9
+ | **Feed** | Provides market data events | No |
10
+ | **Strategy** | Generates trading signals from events | No |
11
+ | **Trader** | Converts signals into orders (risk/sizing) | Yes |
12
+ | **Broker** | Executes orders, maintains account state | Yes (owns Account) |
13
+ | **Journal** | Logs/tracks every step (read-only) | Read-only snapshot |
14
+
15
+ Each component is an abstract base class with pluggable implementations, making every part of the pipeline independently swappable.
16
+
17
+ ## The Run Loop
18
+
19
+ The core of the system is the `roboquant.run()` function, which connects all components in a streaming event loop:
20
+
21
+ ```
22
+ for each event in feed.play(timeframe):
23
+ 1. broker.sync(event) — update account, execute fills
24
+ 2. strategy.create_signals(event) — generate signals from market data
25
+ 3. trader.create_orders(signals, ...) — apply risk rules, produce orders
26
+ 4. broker.place_orders(orders) — submit orders to the broker
27
+ 5. journal.track(event, account, ...) — record metrics (optional)
28
+ ```
29
+
30
+ ### Step-by-step
31
+
32
+ 1. **`broker.sync(event)`** — Updates the account with the latest market data. Open orders from previous steps are tested against prices and executed if conditions are met. No look-ahead bias: orders placed at time `t` only execute at time `t+1`.
33
+
34
+ 2. **`strategy.create_signals(event)`** — The strategy examines the event's price data and returns a list of `Signal` objects. Each signal has an asset, a rating (typically -1.0 to 1.0), and a type (`ENTRY`, `EXIT`, or `ENTRY_EXIT`). Strategies are **pure decision-makers** — they know nothing about cash, positions, or risk.
35
+
36
+ 3. **`trader.create_orders(signals, event, account)`** — The trader applies risk management rules (position sizing, shorting constraints, order limits) and converts signals into concrete `Order` objects. Unlike strategies, traders **have full access to the Account** (cash, positions, buying power).
37
+
38
+ 4. **`broker.place_orders(orders)`** — New orders are submitted to the broker. In `SimBroker`, they are stored and evaluated for execution when the next event arrives.
39
+
40
+ 5. **`journal.track(...)`** — Optional logging and metrics collection. Journals are passive observers that never modify state.
41
+
42
+ ## Minimal Backtest
43
+
44
+ ```python
45
+ import roboquant as rq
46
+
47
+ feed = rq.feeds.YahooFeed("JPM", "IBM", start_date="2015-01-01")
48
+ account = rq.run(feed, rq.strategies.EMACrossover())
49
+ print(account)
50
+ ```
51
+
52
+ This works because `run()` provides sensible defaults: `SimBroker` (USD 1M deposit, 0% slippage) and `FlexTrader` (conservative position sizing).
53
+
54
+ ## Custom Backtest
55
+
56
+ ```python
57
+ feed = rq.feeds.YahooFeed("AAPL", "MSFT", start_date="2020-01-01")
58
+ strategy = rq.strategies.EMACrossover()
59
+ trader = rq.traders.FlexTrader(max_order_perc=0.1, shorting=True)
60
+ broker = rq.brokers.SimBroker(deposit=500_000)
61
+ journal = rq.journals.MetricsJournal()
62
+
63
+ account = rq.run(feed, strategy, trader=trader, broker=broker, journal=journal)
64
+ print(account)
65
+ print(journal.metrics())
66
+ ```
67
+
68
+ ## Strategy/Trader Separation
69
+
70
+ This is the most important design choice in the library:
71
+
72
+ - **Strategies** produce signals from market data only. They implement `create_signals(event) -> list[Signal]` and have no access to account state. This keeps them pure, testable, and reusable across any trader configuration.
73
+ - **Traders** implement `create_orders(signals, event, account) -> list[Order]` and are responsible for risk management, position sizing, and order construction. They know nothing about indicators or market data beyond what is in the signal.
74
+
75
+ Example: The same `EMACrossover` strategy can be used with a conservative trader (2% max order) in backtesting and a different trader (20% max order, shorting enabled) in live trading — without changing a line of strategy code.
76
+
77
+ ## Key Principles
78
+
79
+ - **Event-driven streaming** — Everything is built around `Event` objects produced lazily by feeds, supporting both backtesting and live trading with the same pipeline.
80
+ - **Broker owns the Account** — The Account is never modified directly by user code; it is always the broker's canonical view returned by `sync()`.
81
+ - **Default-everywhere** — `roboquant.run(feed, strategy)` works out of the box with sensible defaults, making the simplest case a one-liner.
82
+ - **Immutable core types** — `Asset`, `Signal`, and `Event` are immutable; `Order` uses `cancel()`/`modify()` returning new objects.
83
+ - **Strategy composition** — `MultiStrategy` combines multiple strategies with configurable conflict resolution (`first`, `last`, `mean`, `none`).
84
+ - **Pluggable pricing** — Price type strings (`"OPEN"`, `"CLOSE"`, `"HIGH"`, `"LOW"`, `"DEFAULT"`) allow strategies and traders to choose which price to use for evaluation.
85
+ - **Multi-currency** — Built-in support via `Amount`, `Wallet`, and pluggable `CurrencyConverter` (ECB, static, one-to-one).
@@ -3,7 +3,7 @@ The `roboquant` package contains the `run` method and a number of shared classes
3
3
  like `Account`, `Asset` and `Event`.
4
4
  """
5
5
 
6
- __version__ = "2.1.3"
6
+ __version__ = "2.2.0"
7
7
 
8
8
  import logging
9
9
 
@@ -12,7 +12,7 @@ from roboquant import feeds
12
12
  from roboquant import journals
13
13
  from roboquant import strategies
14
14
  from roboquant import traders
15
- from roboquant import ml
15
+
16
16
  from .account import Account, Position
17
17
  from .event import Event, PriceItem, Bar, TradePrice, Quote
18
18
  from .signal import Signal, SignalType
@@ -31,7 +31,6 @@ __all__ = [
31
31
  "journals",
32
32
  "strategies",
33
33
  "traders",
34
- "ml",
35
34
  "Account",
36
35
  "Position",
37
36
  "Event",
@@ -0,0 +1,6 @@
1
+ """roboquant.ai package.
2
+ Provides a number of AI related classes and methods to support the development of AI based trading strategies.
3
+ It relies on Stable Baselines3 for reinforcement learning and PyTorch for deep learning.
4
+
5
+ The package provides also several features to support the development of AI based trading strategies.
6
+ """
@@ -18,7 +18,7 @@ FloatArray = NDArray[np.float32]
18
18
  class Feature(Generic[T]):
19
19
  """Base class for different types of features.
20
20
  The ones included by default are either based either an `Event` or an `Account`.
21
- Typically Event features are used for input and Account features are used for label/output."""
21
+ Typically Event features are used for input and Account features are used for reward/label/output."""
22
22
 
23
23
  @abstractmethod
24
24
  def calc(self, value: T) -> FloatArray:
@@ -15,7 +15,7 @@ from roboquant.brokers.simbroker import SimBroker
15
15
  from roboquant.event import Event
16
16
  from roboquant.feeds.feed import Feed
17
17
  from roboquant.journals.journal import Journal
18
- from roboquant.ml.features import Feature
18
+ from roboquant.ai.features import Feature
19
19
  from roboquant.signal import Signal
20
20
  from roboquant.strategies.strategy import Strategy
21
21
  from roboquant.timeframe import Timeframe
@@ -23,7 +23,7 @@ from roboquant.traders.flextrader import FlexTrader
23
23
  from roboquant.traders.trader import Trader
24
24
 
25
25
 
26
- register(id="roboquant/StrategyEnv-v0", entry_point="roboquant.ml.envs:StrategyEnv")
26
+ register(id="roboquant/StrategyEnv-v0", entry_point="roboquant.ai.envs:StrategyEnv")
27
27
  logger = logging.getLogger(__name__)
28
28
 
29
29
 
@@ -11,7 +11,7 @@ from torch.utils.data import DataLoader, Dataset
11
11
 
12
12
  from roboquant.asset import Asset
13
13
  from roboquant.event import Event
14
- from roboquant.ml.features import Feature, NormalizeFeature
14
+ from roboquant.ai.features import Feature, NormalizeFeature
15
15
  from roboquant.signal import Signal
16
16
  from roboquant.strategies.strategy import Strategy
17
17
 
@@ -148,11 +148,11 @@ class LiveBroker(Broker):
148
148
  """
149
149
  order = Order(
150
150
  asset=asset,
151
- size=-Decimal(size), # Negative size for sell orders
151
+ size=-Decimal(size), # Negative size for sell orders
152
152
  limit=float(limit),
153
153
  tif=tif,
154
154
  )
155
- order.fill = - Decimal(fill)
155
+ order.fill = - Decimal(fill) # Negative fill for sell orders
156
156
  order.id = str(id)
157
157
  return order
158
158
 
@@ -0,0 +1,3 @@
1
+ from roboquant.crypto import CryptoFeed, CryptoBroker
2
+
3
+ __all__ = ["CryptoFeed", "CryptoBroker"]
@@ -3,7 +3,7 @@ import ccxt
3
3
  from datetime import datetime
4
4
 
5
5
  from roboquant.asset import Crypto
6
- from roboquant.feeds.cryptofeed import CryptoFeed
6
+ from roboquant.crypto.cryptofeed import CryptoFeed
7
7
  from tests.common import run_price_item_feed
8
8
 
9
9
 
@@ -4,7 +4,7 @@
4
4
  # %%
5
5
  import ccxt
6
6
  import roboquant as rq
7
- from roboquant.feeds.cryptofeed import CryptoFeed
7
+ from roboquant.crypto.cryptofeed import CryptoFeed
8
8
 
9
9
  # %%
10
10
  exchange = ccxt.binance()
@@ -3,8 +3,8 @@ from sb3_contrib import RecurrentPPO
3
3
  from sb3_contrib.common.recurrent.policies import RecurrentActorCriticPolicy
4
4
  from roboquant import run
5
5
  from roboquant.feeds.yahoo import YahooFeed
6
- from roboquant.ml.features import BarFeature, EquityFeature, CombinedFeature, SMAFeature, PriceFeature
7
- from roboquant.ml.rl import TradingEnv, SB3PolicyStrategy
6
+ from roboquant.ai.features import BarFeature, EquityFeature, CombinedFeature, SMAFeature, PriceFeature
7
+ from roboquant.ai.rl import TradingEnv, SB3PolicyStrategy
8
8
 
9
9
  # %%
10
10
  symbols = ["IBM", "JPM", "MSFT", "BA"]
@@ -4,8 +4,8 @@ from sb3_contrib import RecurrentPPO
4
4
  from roboquant import run
5
5
  from roboquant.alpaca.feed import AlpacaHistoricStockFeed
6
6
  from roboquant.asset import Stock
7
- from roboquant.ml.features import EquityFeature, QuoteFeature
8
- from roboquant.ml.rl import TradingEnv, SB3PolicyStrategy
7
+ from roboquant.ai.features import EquityFeature, QuoteFeature
8
+ from roboquant.ai.rl import TradingEnv, SB3PolicyStrategy
9
9
  from roboquant.timeframe import Timeframe
10
10
  from dotenv import load_dotenv
11
11
 
@@ -3,7 +3,7 @@
3
3
  import roboquant.ta as ta
4
4
  import roboquant as rq
5
5
  from roboquant.asset import Asset
6
- from roboquant.ml.features import TaFeature
6
+ from roboquant.ai.features import TaFeature
7
7
  from roboquant.strategies.buffer import OHLCVBuffer
8
8
 
9
9
  # %%
@@ -3,7 +3,6 @@
3
3
  # from the TaLib library. The strategy combines the Relative Strength Index (RSI) and Bollinger Bands
4
4
 
5
5
  # %%
6
- # Make sure ta-lib 0.6.4 or higher is installed before running this sample
7
6
  import roboquant.ta as ta
8
7
  import roboquant as rq
9
8
  from roboquant.strategies import OHLCVBuffer, TaStrategy
@@ -6,8 +6,8 @@ import torch.nn.functional as F
6
6
  import roboquant as rq
7
7
  from roboquant.asset import Stock
8
8
  from roboquant.journals.basicjournal import BasicJournal
9
- from roboquant.ml.features import BarFeature, CombinedFeature, MaxReturnFeature, PriceFeature, SMAFeature
10
- from roboquant.ml.strategies import TimeSeriesStrategy, logger
9
+ from roboquant.ai.features import BarFeature, CombinedFeature, MaxReturnFeature, PriceFeature, SMAFeature
10
+ from roboquant.ai.strategies import TimeSeriesStrategy, logger
11
11
 
12
12
 
13
13
  # %%
@@ -6,8 +6,8 @@ from torch import nn
6
6
  import roboquant as rq
7
7
  from roboquant.asset import Stock
8
8
  from roboquant.journals.basicjournal import BasicJournal
9
- from roboquant.ml.features import BarFeature, CombinedFeature, MaxReturnFeature, PriceFeature, SMAFeature, DayOfMonthFeature
10
- from roboquant.ml.strategies import TimeSeriesStrategy, logger
9
+ from roboquant.ai.features import BarFeature, CombinedFeature, MaxReturnFeature, PriceFeature, SMAFeature, DayOfMonthFeature
10
+ from roboquant.ai.strategies import TimeSeriesStrategy, logger
11
11
 
12
12
 
13
13
  # %%
@@ -4,7 +4,7 @@ import unittest
4
4
  import numpy as np
5
5
  from roboquant.event import Event
6
6
 
7
- from roboquant.ml.features import (
7
+ from roboquant.ai.features import (
8
8
  CacheFeature,
9
9
  CombinedFeature,
10
10
  NormalizeFeature,
@@ -6,8 +6,8 @@ import numpy as np
6
6
 
7
7
  import roboquant as rq
8
8
  from roboquant.asset import Stock
9
- from roboquant.ml.features import BarFeature, CombinedFeature, PriceFeature, SMAFeature
10
- from roboquant.ml.strategies import TimeSeriesStrategy, SequenceDataset
9
+ from roboquant.ai.features import BarFeature, CombinedFeature, PriceFeature, SMAFeature
10
+ from roboquant.ai.strategies import TimeSeriesStrategy, SequenceDataset
11
11
  from tests.common import get_feed
12
12
 
13
13
 
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes