Skip to content

Commit

Permalink
Refine value object docs
Browse files Browse the repository at this point in the history
  • Loading branch information
cjdsellers committed Sep 14, 2022
1 parent 4665da7 commit be76cad
Show file tree
Hide file tree
Showing 5 changed files with 566 additions and 107 deletions.
3 changes: 2 additions & 1 deletion RELEASES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# NautilusTrader 1.154.0 Beta

Released on September 13th 2022 (UTC).
Released on September 14th 2022 (UTC).

### Breaking Changes
- Changed `ExecEngineConfig` `allow_cash_positions` default to `True` (more typical use case)
Expand All @@ -16,6 +16,7 @@ Released on September 13th 2022 (UTC).

### Fixes
- Fixed limit order `IOC` and `FOK` behaviour, thanks @limx0 for identifying
- Fixed FTX `CryptoFuture` instrument parsing, thanks @limx0
- Fixed missing imports in data catalog example notebook, thanks @gaugau3000
- Fixed order update behaviour, affected orders:
- `LIMIT_IF_TOUCHED`
Expand Down
8 changes: 4 additions & 4 deletions nautilus_core/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion nautilus_trader/model/currency.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,14 @@ cdef class Currency:
Represents a medium of exchange in a specified denomination with a fixed
decimal precision.
Handles up to 9 decimals of precision.
Parameters
----------
code : str
The currency code.
precision : uint8
The currency decimal precision. Must be in range [0, 9].
The currency decimal precision.
iso4217 : uint16
The currency ISO 4217 code.
name : str
Expand Down
24 changes: 16 additions & 8 deletions nautilus_trader/model/objects.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ cdef class Quantity:
containing decimal places for non-share quantity asset classes (securities
denominated in fractional units).
Handles up to 9 decimals of precision.
- ``QUANTITY_MAX`` = 18_446_744_073
- ``QUANTITY_MIN`` = 0
Expand All @@ -81,14 +83,14 @@ cdef class Quantity:
The value of the quantity.
precision : uint8
The precision for the quantity. Use a precision of 0 for whole numbers
(no fractional units). Must be in range [0, 9].
(no fractional units).
Raises
------
ValueError
If `value` is negative (< 0).
ValueError
If `value` is greater than 18_446_744_073.
ValueError
If `value` is negative (< 0).
ValueError
If `precision` is greater than 9.
OverflowError
Expand Down Expand Up @@ -369,6 +371,8 @@ cdef class Quantity:
"""
Return a quantity parsed from the given string.

Handles up to 9 decimals of precision.

Parameters
----------
value : str
Expand Down Expand Up @@ -459,6 +463,8 @@ cdef class Price:
have negative values. For example, prices for options instruments can be
negative under certain conditions.
Handles up to 9 decimals of precision.
- ``PRICE_MAX`` = 9_223_372_036
- ``PRICE_MIN`` = -9_223_372_036
Expand All @@ -468,14 +474,14 @@ cdef class Price:
The value of the price.
precision : uint8
The precision for the price. Use a precision of 0 for whole numbers
(no fractional units). Must be in range [0, 9].
(no fractional units).
Raises
------
ValueError
If `value` is less than -9_223_372_036.
ValueError
If `value` is greater than 9_223_372_036.
ValueError
If `value` is less than -9_223_372_036.
ValueError
If `precision` is greater than 9.
OverflowError
Expand Down Expand Up @@ -722,6 +728,8 @@ cdef class Price:
"""
Return a price parsed from the given string.

Handles up to 9 decimals of precision.

Parameters
----------
value : str
Expand Down Expand Up @@ -808,10 +816,10 @@ cdef class Money:
Raises
------
ValueError
If `value` is less than -9_223_372_036.
ValueError
If `value` is greater than 9_223_372_036.
ValueError
If `value` is less than -9_223_372_036.
"""

def __init__(self, value, Currency currency not None):
Expand Down
Loading

0 comments on commit be76cad

Please sign in to comment.