roboquant 2.3.4__tar.gz → 2.4.1__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 (69) hide show
  1. {roboquant-2.3.4 → roboquant-2.4.1}/PKG-INFO +16 -32
  2. {roboquant-2.3.4 → roboquant-2.4.1}/README.md +15 -31
  3. {roboquant-2.3.4 → roboquant-2.4.1}/pyproject.toml +5 -2
  4. {roboquant-2.3.4 → roboquant-2.4.1}/roboquant/__init__.py +2 -0
  5. {roboquant-2.3.4 → roboquant-2.4.1}/roboquant/account.py +30 -74
  6. roboquant-2.4.1/roboquant/ai/__init__.py +8 -0
  7. {roboquant-2.3.4 → roboquant-2.4.1}/roboquant/ai/features.py +82 -50
  8. {roboquant-2.3.4 → roboquant-2.4.1}/roboquant/ai/rl.py +4 -4
  9. {roboquant-2.3.4 → roboquant-2.4.1}/roboquant/ai/strategies.py +3 -3
  10. {roboquant-2.3.4 → roboquant-2.4.1}/roboquant/alpaca/feed.py +2 -2
  11. {roboquant-2.3.4 → roboquant-2.4.1}/roboquant/asset.py +85 -112
  12. {roboquant-2.3.4 → roboquant-2.4.1}/roboquant/brokers/broker.py +10 -10
  13. {roboquant-2.3.4 → roboquant-2.4.1}/roboquant/brokers/simbroker.py +31 -54
  14. {roboquant-2.3.4 → roboquant-2.4.1}/roboquant/crypto/cryptobroker.py +48 -19
  15. {roboquant-2.3.4 → roboquant-2.4.1}/roboquant/crypto/cryptofeed.py +13 -17
  16. {roboquant-2.3.4 → roboquant-2.4.1}/roboquant/event.py +6 -6
  17. {roboquant-2.3.4 → roboquant-2.4.1}/roboquant/feeds/__init__.py +1 -7
  18. {roboquant-2.3.4 → roboquant-2.4.1}/roboquant/feeds/csvfeed.py +2 -2
  19. roboquant-2.4.1/roboquant/feeds/feed.py +32 -0
  20. roboquant-2.4.1/roboquant/feeds/historic.py +256 -0
  21. {roboquant-2.3.4 → roboquant-2.4.1}/roboquant/feeds/live.py +3 -3
  22. {roboquant-2.3.4 → roboquant-2.4.1}/roboquant/feeds/parquet.py +11 -9
  23. {roboquant-2.3.4 → roboquant-2.4.1}/roboquant/feeds/randomwalk.py +2 -2
  24. {roboquant-2.3.4 → roboquant-2.4.1}/roboquant/feeds/sql.py +2 -1
  25. {roboquant-2.3.4 → roboquant-2.4.1}/roboquant/feeds/yahoo.py +12 -2
  26. {roboquant-2.3.4 → roboquant-2.4.1}/roboquant/ibkr/broker.py +2 -1
  27. {roboquant-2.3.4 → roboquant-2.4.1}/roboquant/journals/__init__.py +2 -1
  28. {roboquant-2.3.4 → roboquant-2.4.1}/roboquant/journals/metric.py +11 -1
  29. {roboquant-2.3.4 → roboquant-2.4.1}/roboquant/journals/metricsjournal.py +10 -50
  30. {roboquant-2.3.4 → roboquant-2.4.1}/roboquant/journals/scorecard.py +1 -1
  31. {roboquant-2.3.4 → roboquant-2.4.1}/roboquant/journals/tensorboard.py +2 -2
  32. {roboquant-2.3.4 → roboquant-2.4.1}/roboquant/monetary.py +57 -27
  33. {roboquant-2.3.4 → roboquant-2.4.1}/roboquant/order.py +26 -66
  34. {roboquant-2.3.4 → roboquant-2.4.1}/roboquant/run.py +2 -10
  35. {roboquant-2.3.4 → roboquant-2.4.1}/roboquant/signal.py +3 -0
  36. {roboquant-2.3.4 → roboquant-2.4.1}/roboquant/strategies/buffer.py +10 -6
  37. {roboquant-2.3.4 → roboquant-2.4.1}/roboquant/strategies/multistrategy.py +2 -2
  38. {roboquant-2.3.4 → roboquant-2.4.1}/roboquant/strategies/strategy.py +1 -1
  39. {roboquant-2.3.4 → roboquant-2.4.1}/roboquant/ta/__init__.py +8 -13
  40. {roboquant-2.3.4 → roboquant-2.4.1}/roboquant/timeframe.py +23 -6
  41. roboquant-2.4.1/roboquant/timeseries.py +69 -0
  42. {roboquant-2.3.4 → roboquant-2.4.1}/roboquant/traders/flextrader.py +9 -3
  43. {roboquant-2.3.4 → roboquant-2.4.1}/roboquant/traders/trader.py +1 -1
  44. roboquant-2.3.4/roboquant/ai/__init__.py +0 -6
  45. roboquant-2.3.4/roboquant/feeds/feed.py +0 -160
  46. roboquant-2.3.4/roboquant/feeds/historic.py +0 -111
  47. {roboquant-2.3.4 → roboquant-2.4.1}/LICENSE +0 -0
  48. {roboquant-2.3.4 → roboquant-2.4.1}/roboquant/alpaca/__init__.py +0 -0
  49. {roboquant-2.3.4 → roboquant-2.4.1}/roboquant/alpaca/broker.py +0 -0
  50. {roboquant-2.3.4 → roboquant-2.4.1}/roboquant/brokers/__init__.py +0 -0
  51. {roboquant-2.3.4 → roboquant-2.4.1}/roboquant/crypto/__init__.py +0 -0
  52. {roboquant-2.3.4 → roboquant-2.4.1}/roboquant/feeds/resources/us10.parquet +0 -0
  53. {roboquant-2.3.4 → roboquant-2.4.1}/roboquant/feeds/util.py +0 -0
  54. {roboquant-2.3.4 → roboquant-2.4.1}/roboquant/ibkr/__init__.py +0 -0
  55. {roboquant-2.3.4 → roboquant-2.4.1}/roboquant/ibkr/types.py +0 -0
  56. {roboquant-2.3.4 → roboquant-2.4.1}/roboquant/journals/alphabeta.py +0 -0
  57. {roboquant-2.3.4 → roboquant-2.4.1}/roboquant/journals/basicjournal.py +0 -0
  58. {roboquant-2.3.4 → roboquant-2.4.1}/roboquant/journals/feedmetric.py +0 -0
  59. {roboquant-2.3.4 → roboquant-2.4.1}/roboquant/journals/journal.py +0 -0
  60. {roboquant-2.3.4 → roboquant-2.4.1}/roboquant/journals/marketmetric.py +0 -0
  61. {roboquant-2.3.4 → roboquant-2.4.1}/roboquant/journals/pnlmetric.py +0 -0
  62. {roboquant-2.3.4 → roboquant-2.4.1}/roboquant/journals/pricemetric.py +0 -0
  63. {roboquant-2.3.4 → roboquant-2.4.1}/roboquant/journals/runmetric.py +0 -0
  64. {roboquant-2.3.4 → roboquant-2.4.1}/roboquant/strategies/__init__.py +0 -0
  65. {roboquant-2.3.4 → roboquant-2.4.1}/roboquant/strategies/cachedstrategy.py +0 -0
  66. {roboquant-2.3.4 → roboquant-2.4.1}/roboquant/strategies/emacrossover.py +0 -0
  67. {roboquant-2.3.4 → roboquant-2.4.1}/roboquant/strategies/ibsstrategy.py +0 -0
  68. {roboquant-2.3.4 → roboquant-2.4.1}/roboquant/strategies/tastrategy.py +0 -0
  69. {roboquant-2.3.4 → roboquant-2.4.1}/roboquant/traders/__init__.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: roboquant
3
- Version: 2.3.4
3
+ Version: 2.4.1
4
4
  Summary: A fast algorithmic trading platform with support for AI based strategies
5
5
  Keywords: algorithmic,trading,machine learning,AI,investment,finance,crypto,stocks,exchange,forex
6
6
  Author: roboquant team
@@ -46,16 +46,15 @@ Description-Content-Type: text/markdown
46
46
  ![PyPI - Version](https://img.shields.io/pypi/v/roboquant?)
47
47
  ![PyPI - License](https://img.shields.io/pypi/l/roboquant?)
48
48
  ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/roboquant?)
49
- ![PyPI - Status](https://img.shields.io/pypi/status/roboquant?)
50
49
  ![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/neurallayer/roboquant.py/verify.yml)
51
50
  [![discord](https://img.shields.io/discord/954650958300856340?label=discord)](https://discord.com/channels/954650958300856340/954650958300856343)
52
51
 
53
- Roboquant is an open-source algorithmic trading platform. It is flexible, user-friendly and completely free to use. It is designed for anyone serious about algo-trading.
52
+ Roboquant is an open-source algorithmic trading platform written in Python. It is flexible, user-friendly and completely free to use. It is designed for anyone serious about algo-trading.
54
53
 
55
54
  So whether you are a beginning retail trader or an established trading firm, roboquant can help you to develop robust and fully automated trading strategies. You can find out more at [roboquant.org](https://roboquant.org).
56
55
 
57
56
  ## Usage
58
- The following code snippet shows the steps required to run a full back-test on a number of stocks.
57
+ The following code snippet shows the required steps to run a full back-test on a number of stocks.
59
58
 
60
59
  ```python
61
60
  import roboquant as rq
@@ -66,6 +65,18 @@ account = rq.run(feed, strategy)
66
65
  print(account)
67
66
  ```
68
67
 
68
+ ## Features
69
+ Below are some of the key features of *roboquant*:
70
+ - [x] fast back testing and live trading
71
+ - [x] AI/ML based strategies
72
+ - [x] market data feeds from CSV files, Yahoo Finance, Alpaca and many crypto exchanges
73
+ - [x] multi-currency trading
74
+ - [x] multi-asset trading, stocks, options, forex and crypto out of the box
75
+ - [x] larger-than-memory data feeds
76
+ - [x] TaLib based indicators and strategies
77
+ - [x] plotting of prices and metrics
78
+ - [x] modulair and extensible
79
+
69
80
  ## Install
70
81
  Roboquant can be installed like most other Python packages, using tools like `uv`, `pip` or `conda`.
71
82
  Make sure you have Python version 3.12 or higher installed.
@@ -74,7 +85,7 @@ Make sure you have Python version 3.12 or higher installed.
74
85
  python3 -m pip install --upgrade roboquant
75
86
  ```
76
87
 
77
- The core of roboquant limits the number of dependencies. But you can install roboquant including one or more of the optional dependencies if you require certain additional functionality:
88
+ The core installation of roboquant limits the number of dependencies. But you can install roboquant including one or more of the optional dependencies if you require certain additional functionality:
78
89
 
79
90
  ```shell
80
91
  # AI based strategies using PyTorch and SB3
@@ -90,30 +101,6 @@ python3 -m pip install --upgrade "roboquant[alpaca]"
90
101
  python3 -m pip install --upgrade "roboquant[crypto]"
91
102
  ```
92
103
 
93
- ## Building from source
94
- Roboquant.py uses `uv` as the main tool for handling package dependencies.
95
-
96
- ```shell
97
- uv sync --all-extras --dev
98
- ```
99
-
100
- You should now be in the virtual environment and ready to build/install roboquant:
101
-
102
- ```shell
103
- uv build
104
- uv pip install .
105
- ```
106
-
107
- Some other useful commands:
108
-
109
- ```shell
110
- # build & validate the code
111
- ./bin/verify.sh
112
-
113
- # publish, only works if UV_PUBLISH_TOKEN is set
114
- ./bin/publish.sh
115
- ```
116
-
117
104
  ## License
118
105
  Roboquant is made available under the Apache 2.0 license. You can read more about the Apache 2.0 license on this page: https://www.apache.org/licenses/LICENSE-2.0.html
119
106
 
@@ -121,6 +108,3 @@ Roboquant is made available under the Apache 2.0 license. You can read more abou
121
108
  Absolutely no warranty is implied with this product. Use at your own risk. I provide no guarantee that it will be profitable, or that it won't lose all your money very quickly or does not contain bugs.
122
109
 
123
110
  All financial trading offers the possibility of loss. Leveraged trading, may result in you losing all your money, and still owing more. Back tested results are no guarantee of future performance. I can take no responsibility for any losses caused by live trading using roboquant. Use at your own risk. I am not registered or authorised by any financial regulator.
124
-
125
- ## Kotlin version
126
- Next to this Python version of `roboquant`, there is also a Kotlin version available. Both share a similar API, just the used computer language is different. Which one to use depends very much on personal preferences, skills and usage.
@@ -4,16 +4,15 @@
4
4
  ![PyPI - Version](https://img.shields.io/pypi/v/roboquant?)
5
5
  ![PyPI - License](https://img.shields.io/pypi/l/roboquant?)
6
6
  ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/roboquant?)
7
- ![PyPI - Status](https://img.shields.io/pypi/status/roboquant?)
8
7
  ![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/neurallayer/roboquant.py/verify.yml)
9
8
  [![discord](https://img.shields.io/discord/954650958300856340?label=discord)](https://discord.com/channels/954650958300856340/954650958300856343)
10
9
 
11
- Roboquant is an open-source algorithmic trading platform. It is flexible, user-friendly and completely free to use. It is designed for anyone serious about algo-trading.
10
+ Roboquant is an open-source algorithmic trading platform written in Python. It is flexible, user-friendly and completely free to use. It is designed for anyone serious about algo-trading.
12
11
 
13
12
  So whether you are a beginning retail trader or an established trading firm, roboquant can help you to develop robust and fully automated trading strategies. You can find out more at [roboquant.org](https://roboquant.org).
14
13
 
15
14
  ## Usage
16
- The following code snippet shows the steps required to run a full back-test on a number of stocks.
15
+ The following code snippet shows the required steps to run a full back-test on a number of stocks.
17
16
 
18
17
  ```python
19
18
  import roboquant as rq
@@ -24,6 +23,18 @@ account = rq.run(feed, strategy)
24
23
  print(account)
25
24
  ```
26
25
 
26
+ ## Features
27
+ Below are some of the key features of *roboquant*:
28
+ - [x] fast back testing and live trading
29
+ - [x] AI/ML based strategies
30
+ - [x] market data feeds from CSV files, Yahoo Finance, Alpaca and many crypto exchanges
31
+ - [x] multi-currency trading
32
+ - [x] multi-asset trading, stocks, options, forex and crypto out of the box
33
+ - [x] larger-than-memory data feeds
34
+ - [x] TaLib based indicators and strategies
35
+ - [x] plotting of prices and metrics
36
+ - [x] modulair and extensible
37
+
27
38
  ## Install
28
39
  Roboquant can be installed like most other Python packages, using tools like `uv`, `pip` or `conda`.
29
40
  Make sure you have Python version 3.12 or higher installed.
@@ -32,7 +43,7 @@ Make sure you have Python version 3.12 or higher installed.
32
43
  python3 -m pip install --upgrade roboquant
33
44
  ```
34
45
 
35
- The core of roboquant limits the number of dependencies. But you can install roboquant including one or more of the optional dependencies if you require certain additional functionality:
46
+ The core installation of roboquant limits the number of dependencies. But you can install roboquant including one or more of the optional dependencies if you require certain additional functionality:
36
47
 
37
48
  ```shell
38
49
  # AI based strategies using PyTorch and SB3
@@ -48,30 +59,6 @@ python3 -m pip install --upgrade "roboquant[alpaca]"
48
59
  python3 -m pip install --upgrade "roboquant[crypto]"
49
60
  ```
50
61
 
51
- ## Building from source
52
- Roboquant.py uses `uv` as the main tool for handling package dependencies.
53
-
54
- ```shell
55
- uv sync --all-extras --dev
56
- ```
57
-
58
- You should now be in the virtual environment and ready to build/install roboquant:
59
-
60
- ```shell
61
- uv build
62
- uv pip install .
63
- ```
64
-
65
- Some other useful commands:
66
-
67
- ```shell
68
- # build & validate the code
69
- ./bin/verify.sh
70
-
71
- # publish, only works if UV_PUBLISH_TOKEN is set
72
- ./bin/publish.sh
73
- ```
74
-
75
62
  ## License
76
63
  Roboquant is made available under the Apache 2.0 license. You can read more about the Apache 2.0 license on this page: https://www.apache.org/licenses/LICENSE-2.0.html
77
64
 
@@ -79,6 +66,3 @@ Roboquant is made available under the Apache 2.0 license. You can read more abou
79
66
  Absolutely no warranty is implied with this product. Use at your own risk. I provide no guarantee that it will be profitable, or that it won't lose all your money very quickly or does not contain bugs.
80
67
 
81
68
  All financial trading offers the possibility of loss. Leveraged trading, may result in you losing all your money, and still owing more. Back tested results are no guarantee of future performance. I can take no responsibility for any losses caused by live trading using roboquant. Use at your own risk. I am not registered or authorised by any financial regulator.
82
-
83
- ## Kotlin version
84
- Next to this Python version of `roboquant`, there is also a Kotlin version available. Both share a similar API, just the used computer language is different. Which one to use depends very much on personal preferences, skills and usage.
@@ -8,6 +8,9 @@ build-backend = "uv_build"
8
8
  [tool.ruff.lint]
9
9
  select = ["E", "F", "W"]
10
10
 
11
+ [tool.ty.rules]
12
+ unused-type-ignore-comment = "ignore"
13
+
11
14
  [tool.pyright]
12
15
  typeCheckingMode = "standard"
13
16
  reportPrivateImportUsage = "none"
@@ -19,7 +22,7 @@ module-name = "roboquant"
19
22
 
20
23
  [project]
21
24
  name = "roboquant"
22
- version = "2.3.4"
25
+ version = "2.4.1"
23
26
  authors = [{ name = "roboquant team", email = "info@roboquant.org" }]
24
27
  description = "A fast algorithmic trading platform with support for AI based strategies"
25
28
  readme = "README.md"
@@ -83,5 +86,5 @@ dev = [
83
86
  "ipykernel>=7.3.0",
84
87
  "ipywidgets>=8.1.6",
85
88
  "chronos-forecasting>=2.3.1",
89
+ "ty>=0.0.62",
86
90
  ]
87
- talib = ["ta-lib==0.6.5"]
@@ -17,6 +17,7 @@ from .monetary import Amount, Wallet
17
17
  from .asset import Asset, Stock, Crypto, Forex, Option
18
18
  from .run import run
19
19
  from .timeframe import Timeframe, utcnow
20
+ from .timeseries import TimeSeries
20
21
 
21
22
  __all__ = [
22
23
  "brokers",
@@ -43,5 +44,6 @@ __all__ = [
43
44
  "Option",
44
45
  "run",
45
46
  "Timeframe",
47
+ "TimeSeries",
46
48
  "utcnow",
47
49
  ]
@@ -1,7 +1,6 @@
1
1
  from dataclasses import dataclass
2
2
  from datetime import datetime
3
3
  from decimal import Decimal
4
- from typing import Any
5
4
 
6
5
  from roboquant.asset import Asset
7
6
  from roboquant.monetary import USD, Amount, Currency, Wallet
@@ -32,7 +31,7 @@ class Trade:
32
31
  @dataclass(slots=True)
33
32
  class Position:
34
33
  """The position of an asset in the account. The position prices are denoted in the currency of the asset that
35
- is linked to this posistion. See also `Account.positions`.
34
+ is linked to this posistion. See also :meth:`roboquant.Account.positions`.
36
35
  """
37
36
 
38
37
  size: Decimal
@@ -59,17 +58,17 @@ class Position:
59
58
  """Return a zero position size with no known prices"""
60
59
  return Position(Decimal(), float("nan"), float("nan"))
61
60
 
62
-
61
+ @dataclass
63
62
  class Account:
64
63
  """Represents a trading account. The account maintains the following state during a run:
65
64
 
66
- - Available buying power for orders in the base currency of the account.
67
- - Cash available in the account.
68
- - The open positions, each denoted in the currency of the asset.
69
- - The open orders, each denoted in the currency of the asset.
70
- - The trades that have been executed, each denoted in the currency of the asset.
71
- - Calculated derived equity value of the account in the base currency of the account.
72
- - The last time the account was updated.
65
+ Attributes:
66
+ buying_power (Amount): Available buying power for orders in the base currency of the account.
67
+ cash (Wallet): The cash available in the account.
68
+ positions (Dict[Asset, Position]): the open positions, each denoted in the currency of the asset.
69
+ orders (list[Order]): the open orders, each denoted in the currency of the asset.
70
+ trades (list[Trade]): the trades that have been executed, each denoted in the currency of the asset.
71
+ last_update (datetime): The last time the account was updated.
73
72
 
74
73
  Only the `broker` updates the account and does this only during its `sync` method.
75
74
  """
@@ -212,32 +211,14 @@ class Account:
212
211
 
213
212
  def pnl(self) -> Wallet:
214
213
  """
215
- Return the total profit and loss of the account, which is the sum of realized and unrealized PnL.
214
+ Return the total profit and loss of the account, which is
215
+ the sum of realized and unrealized PnL.
216
216
 
217
217
  Returns:
218
218
  Wallet: The total profit and loss.
219
219
  """
220
220
  return self.realized_pnl() + self.unrealized_pnl()
221
221
 
222
- def required_buying_power(self, order: Order) -> Amount:
223
- """
224
- Return the amount of buying power required for a certain order. The underlying logic takes into
225
- account that a reduction in position size doesn't require buying power.
226
-
227
- Args:
228
- order (Order): The order for which to calculate the required buying power.
229
-
230
- Returns:
231
- Amount: The required buying power as an Amount.
232
- """
233
- pos_size = self.get_position_size(order.asset)
234
-
235
- # Only buying power required if the remaining order size increases the position size
236
- if abs(pos_size + order.remaining) > abs(pos_size):
237
- return order.asset.contract_amount(abs(order.remaining), order.limit)
238
-
239
- return Amount(order.asset.currency, 0.0)
240
-
241
222
  def unrealized_pnl_value(self) -> float:
242
223
  """
243
224
  Return the unrealized profit and loss value denoted in the base currency of the account.
@@ -260,45 +241,6 @@ class Account:
260
241
  pos = self.positions.get(asset)
261
242
  return pos.size if pos else Decimal()
262
243
 
263
- def get_position_list(self) -> list[dict[str, Any]]:
264
- """Return all open positions including their pnl as a list of dicts"""
265
- result: list[dict[str, Any]] = []
266
- for asset, pos in self.positions.items():
267
- result.append(
268
- {
269
- "asset class": asset.asset_class(),
270
- "symbol": asset.symbol,
271
- "currency": asset.currency,
272
- "size": pos.size,
273
- "type": "LONG" if pos.is_long else "SHORT",
274
- "avg price": pos.avg_price,
275
- "mkt price": pos.mkt_price,
276
- "value": asset.contract_value(pos.size, pos.mkt_price),
277
- "pnl": asset.contract_value(pos.size, pos.mkt_price - pos.avg_price),
278
- }
279
- )
280
- return result
281
-
282
- def get_order_list(self) -> list[dict[str, Any]]:
283
- """Return all open orders as a list of dicts"""
284
- result: list[dict[str, Any]] = []
285
- for order in self.orders:
286
- result.append(
287
- {
288
- "id": order.id,
289
- "asset class": order.asset.asset_class(),
290
- "symbol": order.asset.symbol,
291
- "currency": order.asset.currency,
292
- "size": order.size,
293
- "type": "BUY" if order.is_buy else "SELL",
294
- "value": order.value(),
295
- "fill": order.fill,
296
- "tif": order.tif,
297
- "info": str(order.info) if order.info else "-",
298
- }
299
- )
300
- return result
301
-
302
244
  def get_order(self, order_id: str) -> Order | None:
303
245
  """Return an order by its id, or None if no matching order can be found"""
304
246
  for order in self.orders:
@@ -306,7 +248,21 @@ class Account:
306
248
  return order
307
249
 
308
250
  def __repr__(self) -> str:
309
- """Condensed representation of this account."""
251
+ """Condensed representation of this account. It by default won't
252
+ display decimals for the various amounts. But you can use the float
253
+ formatting spec to influence this behavior: f"{account:{.4f}}"
254
+ """
255
+ return f"{self:,.0f}"
256
+
257
+ def __format__(self, format_spec: str) -> str:
258
+ """Return a float formatted string representation of the wallet.
259
+
260
+ Args:
261
+ format_spec (str): The format specification.
262
+
263
+ Returns:
264
+ str: The formatted string representation.
265
+ """
310
266
  p = [f"{v.size}@{k.symbol}" for k, v in self.positions.items()]
311
267
  p_str = ", ".join(p) or "none"
312
268
 
@@ -316,12 +272,12 @@ class Account:
316
272
  mkt = self.mkt_value() or Amount(self.base_currency, 0.0)
317
273
 
318
274
  result = (
319
- f"buying power : {self.buying_power}\n"
320
- f"cash : {self.cash}\n"
321
- f"equity : {self.equity()}\n"
275
+ f"buying power : {self.buying_power:{format_spec}}\n"
276
+ f"cash : {self.cash:{format_spec}}\n"
277
+ f"equity : {self.equity():{format_spec}}\n"
322
278
  f"positions : {p_str}\n"
323
279
  f"trades : {len(self.trades)}\n"
324
- f"mkt value : {mkt}\n"
280
+ f"mkt value : {mkt:{format_spec}}\n"
325
281
  f"orders : {o_str}\n"
326
282
  f"last update : {self.last_update}"
327
283
  )
@@ -0,0 +1,8 @@
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
+ This package also introduces the concept of Features, which are the building blocks for roboquant machine learning models
6
+ and can be used to extract relevant information. The ones included by default are either based on an `Event` or an `Account`.
7
+ Typically Event features are used for input data and Account features are used for reward/label/output data.
8
+ """