diff --git a/nightly/.doctrees/api_reference/accounting.doctree b/nightly/.doctrees/api_reference/accounting.doctree index e536694eb537..96a34aead08e 100644 Binary files a/nightly/.doctrees/api_reference/accounting.doctree and b/nightly/.doctrees/api_reference/accounting.doctree differ diff --git a/nightly/.doctrees/api_reference/adapters/betfair.doctree b/nightly/.doctrees/api_reference/adapters/betfair.doctree index d803bf49bd67..7cf5e3bd30b3 100644 Binary files a/nightly/.doctrees/api_reference/adapters/betfair.doctree and b/nightly/.doctrees/api_reference/adapters/betfair.doctree differ diff --git a/nightly/.doctrees/api_reference/adapters/binance.doctree b/nightly/.doctrees/api_reference/adapters/binance.doctree index e7ffde0b05c3..4e8fb2e0ca16 100644 Binary files a/nightly/.doctrees/api_reference/adapters/binance.doctree and b/nightly/.doctrees/api_reference/adapters/binance.doctree differ diff --git a/nightly/.doctrees/api_reference/adapters/interactive_brokers.doctree b/nightly/.doctrees/api_reference/adapters/interactive_brokers.doctree index 6ab180cfa256..1e97031314aa 100644 Binary files a/nightly/.doctrees/api_reference/adapters/interactive_brokers.doctree and b/nightly/.doctrees/api_reference/adapters/interactive_brokers.doctree differ diff --git a/nightly/.doctrees/api_reference/analysis.doctree b/nightly/.doctrees/api_reference/analysis.doctree index 49ea29da5962..d0affbd11474 100644 Binary files a/nightly/.doctrees/api_reference/analysis.doctree and b/nightly/.doctrees/api_reference/analysis.doctree differ diff --git a/nightly/.doctrees/api_reference/backtest.doctree b/nightly/.doctrees/api_reference/backtest.doctree index 6082e57474e2..907c01485d49 100644 Binary files a/nightly/.doctrees/api_reference/backtest.doctree and b/nightly/.doctrees/api_reference/backtest.doctree differ diff --git a/nightly/.doctrees/api_reference/cache.doctree b/nightly/.doctrees/api_reference/cache.doctree index 2a5895baa4a5..8ca46cbb08cd 100644 Binary files a/nightly/.doctrees/api_reference/cache.doctree and b/nightly/.doctrees/api_reference/cache.doctree differ diff --git a/nightly/.doctrees/api_reference/common.doctree b/nightly/.doctrees/api_reference/common.doctree index b014e69639bb..af0658cd9381 100644 Binary files a/nightly/.doctrees/api_reference/common.doctree and b/nightly/.doctrees/api_reference/common.doctree differ diff --git a/nightly/.doctrees/api_reference/core.doctree b/nightly/.doctrees/api_reference/core.doctree index d16effe9d441..e3f894746601 100644 Binary files a/nightly/.doctrees/api_reference/core.doctree and b/nightly/.doctrees/api_reference/core.doctree differ diff --git a/nightly/.doctrees/api_reference/data.doctree b/nightly/.doctrees/api_reference/data.doctree index ec69aba44555..d9bcb5f6f37a 100644 Binary files a/nightly/.doctrees/api_reference/data.doctree and b/nightly/.doctrees/api_reference/data.doctree differ diff --git a/nightly/.doctrees/api_reference/execution.doctree b/nightly/.doctrees/api_reference/execution.doctree index 6bbc8af957ce..7debd1779327 100644 Binary files a/nightly/.doctrees/api_reference/execution.doctree and b/nightly/.doctrees/api_reference/execution.doctree differ diff --git a/nightly/.doctrees/api_reference/indicators.doctree b/nightly/.doctrees/api_reference/indicators.doctree index e1ad34c796d7..4001f5aaef56 100644 Binary files a/nightly/.doctrees/api_reference/indicators.doctree and b/nightly/.doctrees/api_reference/indicators.doctree differ diff --git a/nightly/.doctrees/api_reference/live.doctree b/nightly/.doctrees/api_reference/live.doctree index 913c122efa83..d6ea3f020bc9 100644 Binary files a/nightly/.doctrees/api_reference/live.doctree and b/nightly/.doctrees/api_reference/live.doctree differ diff --git a/nightly/.doctrees/api_reference/model/book.doctree b/nightly/.doctrees/api_reference/model/book.doctree index fe49675f3f1d..28f963f90e5d 100644 Binary files a/nightly/.doctrees/api_reference/model/book.doctree and b/nightly/.doctrees/api_reference/model/book.doctree differ diff --git a/nightly/.doctrees/api_reference/model/data.doctree b/nightly/.doctrees/api_reference/model/data.doctree index d5a40a8b8592..acf8e54ad01a 100644 Binary files a/nightly/.doctrees/api_reference/model/data.doctree and b/nightly/.doctrees/api_reference/model/data.doctree differ diff --git a/nightly/.doctrees/api_reference/model/events.doctree b/nightly/.doctrees/api_reference/model/events.doctree index 8852cc7bfe4e..271ec5c13e23 100644 Binary files a/nightly/.doctrees/api_reference/model/events.doctree and b/nightly/.doctrees/api_reference/model/events.doctree differ diff --git a/nightly/.doctrees/api_reference/model/identifiers.doctree b/nightly/.doctrees/api_reference/model/identifiers.doctree index 719d7aa9c2ef..2a4a8cb4ac84 100644 Binary files a/nightly/.doctrees/api_reference/model/identifiers.doctree and b/nightly/.doctrees/api_reference/model/identifiers.doctree differ diff --git a/nightly/.doctrees/api_reference/model/instruments.doctree b/nightly/.doctrees/api_reference/model/instruments.doctree index 7a0ad52615c1..3332f5bca370 100644 Binary files a/nightly/.doctrees/api_reference/model/instruments.doctree and b/nightly/.doctrees/api_reference/model/instruments.doctree differ diff --git a/nightly/.doctrees/api_reference/model/objects.doctree b/nightly/.doctrees/api_reference/model/objects.doctree index 5a4bfb1851b3..1316ec6571f3 100644 Binary files a/nightly/.doctrees/api_reference/model/objects.doctree and b/nightly/.doctrees/api_reference/model/objects.doctree differ diff --git a/nightly/.doctrees/api_reference/model/orders.doctree b/nightly/.doctrees/api_reference/model/orders.doctree index 54ed66c5d74f..93d1927910bf 100644 Binary files a/nightly/.doctrees/api_reference/model/orders.doctree and b/nightly/.doctrees/api_reference/model/orders.doctree differ diff --git a/nightly/.doctrees/api_reference/model/position.doctree b/nightly/.doctrees/api_reference/model/position.doctree index 60735dc1a785..ce2eee0d41bc 100644 Binary files a/nightly/.doctrees/api_reference/model/position.doctree and b/nightly/.doctrees/api_reference/model/position.doctree differ diff --git a/nightly/.doctrees/api_reference/model/tick_scheme.doctree b/nightly/.doctrees/api_reference/model/tick_scheme.doctree index 724e4aeea8c3..3d81c416a7a8 100644 Binary files a/nightly/.doctrees/api_reference/model/tick_scheme.doctree and b/nightly/.doctrees/api_reference/model/tick_scheme.doctree differ diff --git a/nightly/.doctrees/api_reference/persistence.doctree b/nightly/.doctrees/api_reference/persistence.doctree index a0cfb137c599..3b7a69166359 100644 Binary files a/nightly/.doctrees/api_reference/persistence.doctree and b/nightly/.doctrees/api_reference/persistence.doctree differ diff --git a/nightly/.doctrees/api_reference/portfolio.doctree b/nightly/.doctrees/api_reference/portfolio.doctree index 9297bd1b9b98..4e7fed24e1a3 100644 Binary files a/nightly/.doctrees/api_reference/portfolio.doctree and b/nightly/.doctrees/api_reference/portfolio.doctree differ diff --git a/nightly/.doctrees/api_reference/risk.doctree b/nightly/.doctrees/api_reference/risk.doctree index bbf5b14dd923..cb12bf4a979e 100644 Binary files a/nightly/.doctrees/api_reference/risk.doctree and b/nightly/.doctrees/api_reference/risk.doctree differ diff --git a/nightly/.doctrees/api_reference/serialization.doctree b/nightly/.doctrees/api_reference/serialization.doctree index 9e15f765acc3..d8f671d6d8ec 100644 Binary files a/nightly/.doctrees/api_reference/serialization.doctree and b/nightly/.doctrees/api_reference/serialization.doctree differ diff --git a/nightly/.doctrees/api_reference/system.doctree b/nightly/.doctrees/api_reference/system.doctree index a19a6429d033..70b3dac91e97 100644 Binary files a/nightly/.doctrees/api_reference/system.doctree and b/nightly/.doctrees/api_reference/system.doctree differ diff --git a/nightly/.doctrees/api_reference/trading.doctree b/nightly/.doctrees/api_reference/trading.doctree index 0e166183a998..a22f973cab98 100644 Binary files a/nightly/.doctrees/api_reference/trading.doctree and b/nightly/.doctrees/api_reference/trading.doctree differ diff --git a/nightly/.doctrees/concepts/data.doctree b/nightly/.doctrees/concepts/data.doctree index f579c1cee8c1..61f681ea9825 100644 Binary files a/nightly/.doctrees/concepts/data.doctree and b/nightly/.doctrees/concepts/data.doctree differ diff --git a/nightly/.doctrees/environment.pickle b/nightly/.doctrees/environment.pickle index d3bff20a0b2f..a61fd51d4c41 100644 Binary files a/nightly/.doctrees/environment.pickle and b/nightly/.doctrees/environment.pickle differ diff --git a/nightly/.doctrees/integrations/databento.doctree b/nightly/.doctrees/integrations/databento.doctree index 26c32d9a4011..c0c1a26c464d 100644 Binary files a/nightly/.doctrees/integrations/databento.doctree and b/nightly/.doctrees/integrations/databento.doctree differ diff --git a/nightly/.doctrees/integrations/index.doctree b/nightly/.doctrees/integrations/index.doctree index e23689862916..30216c7c10a1 100644 Binary files a/nightly/.doctrees/integrations/index.doctree and b/nightly/.doctrees/integrations/index.doctree differ diff --git a/nightly/_sources/concepts/data.md.txt b/nightly/_sources/concepts/data.md.txt index bbb85470848a..9964a606c860 100644 --- a/nightly/_sources/concepts/data.md.txt +++ b/nightly/_sources/concepts/data.md.txt @@ -41,7 +41,7 @@ To achieve this, two main components are necessary: ### Data loaders Data loader components are typically specific for the raw source/format and per integration. For instance, Binance order book data is stored in its raw CSV file form with -an entirely different format to [Databento Binary Encoding (DBN)](https://docs.databento.com/knowledge-base/new-users/dbn-encoding/getting-started-with-dbn) files. +an entirely different format to [Databento Binary Encoding (DBN)](https://databento.com/docs/knowledge-base/new-users/dbn-encoding/getting-started-with-dbn) files. ### Data wranglers diff --git a/nightly/_sources/integrations/databento.md.txt b/nightly/_sources/integrations/databento.md.txt index a43710e16e73..ad10aa049e5b 100644 --- a/nightly/_sources/integrations/databento.md.txt +++ b/nightly/_sources/integrations/databento.md.txt @@ -1,10 +1,10 @@ # Databento ```{warning} -We are currently working on this integration guide - consider it incomplete for now. +We are currently working on this integration guide. ``` -NautilusTrader provides an adapter for integrating with the Databento API and [Databento Binary Encoding (DBN)](https://docs.databento.com/knowledge-base/new-users/dbn-encoding) format data. +NautilusTrader provides an adapter for integrating with the Databento API and [Databento Binary Encoding (DBN)](https://databento.com/docs/knowledge-base/new-users/dbn-encoding) format data. As Databento is purely a market data provider, there is no execution client provided - although a sandbox environment with simulated execution could still be set up. It's also possible to match Databento data with Interactive Brokers execution, or to calculate traditional asset class signals for crypto trading. @@ -17,7 +17,7 @@ The capabilities of this adapter include: [Databento](https://databento.com/signup) currently offers 125 USD in free data credits (historical data only) for new account sign-ups. With careful requests, this is more than enough for testing and evaluation purposes. -It's recommended you make use of the [/metadata.get_cost](https://docs.databento.com/api-reference-historical/metadata/metadata-get-cost) endpoint. +It's recommended you make use of the [/metadata.get_cost](https://databento.com/docs/api-reference-historical/metadata/metadata-get-cost) endpoint. ``` ## Overview @@ -44,13 +44,13 @@ and won't need to necessarily work with these lower level components directly. ## Databento documentation -Databento provides extensive documentation for users which can be found in the [Databento knowledge base](https://docs.databento.com/knowledge-base/new-users). -It's recommended you also refer to the Databento documentation in conjunction with this Nautilus integration guide. +Databento provides extensive documentation for users which can be found in the [Databento knowledge base](https://databento.com/docs/knowledge-base/new-users). +It's recommended you also refer to this Databento documentation in conjunction with this NautilusTrader integration guide. ## Databento Binary Encoding (DBN) Databento Binary Encoding (DBN) is an extremely fast message encoding and storage format for normalized market data. -The [DBN specification](https://docs.databento.com/knowledge-base/new-users/dbn-encoding) includes a simple, self-describing metadata header and a fixed set of struct definitions, +The [DBN specification](https://databento.com/docs/knowledge-base/new-users/dbn-encoding) includes a simple, self-describing metadata header and a fixed set of struct definitions, which enforce a standardized way to normalize market data. The integration provides a decoder which can convert DBN format data to Nautilus objects. @@ -91,7 +91,7 @@ The Nautilus decoder will use the Databento `raw_symbol` for the Nautilus `symbo from the Databento instrument definition message for the Nautilus `venue`. Databento datasets are identified with a *dataset code* which is not the same -as a venue identifier. You can read more about Databento dataset naming conventions [here](https://docs.databento.com/api-reference-historical/basics/datasets). +as a venue identifier. You can read more about Databento dataset naming conventions [here](https://databento.com/docs/api-reference-historical/basics/datasets). Of particular note is for CME Globex MDP 3.0 data (`GLBX.MDP3` dataset code), the following exchanges are all grouped under the `GLBX` venue. These mappings can be determined from the @@ -105,7 +105,7 @@ instruments `exchange` field: - `XNYM` - **New York Mercantile Exchange (NYMEX)** ```{note} -Other venue MICs can be found in the `venue` field of responses from the [metadata.list_publishers](https://docs.databento.com/api-reference-historical/metadata/metadata-list-publishers?historical=http&live=python) endpoint. +Other venue MICs can be found in the `venue` field of responses from the [metadata.list_publishers](https://databento.com/docs/api-reference-historical/metadata/metadata-list-publishers?historical=http&live=python) endpoint. ``` ## Timestamps @@ -127,8 +127,8 @@ When decoding and normalizing Databento to Nautilus we generally assign the Data ```{note} See the following Databento docs for further information: -- [Databento standards and conventions - timestamps](https://docs.databento.com/knowledge-base/new-users/standards-conventions/timestamps) -- [Databento timestamping guide](https://docs.databento.com/knowledge-base/data-integrity/timestamping/timestamps-on-databento-and-how-to-use-them) +- [Databento standards and conventions - timestamps](https://databento.com/docs/knowledge-base/new-users/standards-conventions/timestamps) +- [Databento timestamping guide](https://databento.com/docs/knowledge-base/data-integrity/timestamping/timestamps-on-databento-and-how-to-use-them) ``` ## Data types @@ -136,6 +136,10 @@ See the following Databento docs for further information: The following section discusses Databento schema -> Nautilus data type equivalence and considerations. +```{note} +See the Databento [list of fields by schema guide](https://databento.com/docs/knowledge-base/new-users/fields-by-schema). +``` + ### Instrument definitions Databento provides a single schema to cover all instrument classes, these are @@ -143,17 +147,17 @@ decoded to the appropriate Nautilus `Instrument` types. The following Databento instrument classes are supported by NautilusTrader: -| Databento instrument class | Nautilus instrument type | -|----------------------------|------------------------------| -| STOCK | `Equity` | -| FUTURE | `FuturesContract` | -| CALL | `OptionsContract` | -| PUT | `OptionsContract` | -| FUTURESPREAD | `FuturesSpread` | -| OPTIONSPREAD | `OptionsSpread` | -| MIXEDSPREAD | `OptionsSpread` | -| FXSPOT | `CurrencyPair` | -| BOND | Not yet available | +| Databento instrument class | Code | Nautilus instrument type | +|----------------------------|------|------------------------------| +| Stock | `K` | `Equity` | +| Future | `F` | `FuturesContract` | +| Call | `C` | `OptionsContract` | +| Put | `P` | `OptionsContract` | +| Future spread | `S` | `FuturesSpread` | +| Option spread | `T` | `OptionsSpread` | +| Mixed spread | `M` | `OptionsSpread` | +| FX spot | `X` | `CurrencyPair` | +| Bond | `B` | Not yet available | ### MBO (market by order) @@ -171,9 +175,9 @@ object, which occurs during the replay startup sequence. ### MBP-1 (market by price, top-of-book) -This schema represents the top-of-book only. Like with MBO messages, some +This schema represents the top-of-book only (quotes *and* trades). Like with MBO messages, some messages carry trade information, and so when decoding MBP-1 messages Nautilus -will produce a `QuoteTick` and also a `TradeTick` if the message is a trade. +will produce a `QuoteTick` and *also* a `TradeTick` if the message is a trade. ### OHLCV (bar aggregates) @@ -183,9 +187,9 @@ The Nautilus decoder will normalize the `ts_event` timestamps to the **close** o ### Imbalance & Statistics -The Databento `imbalance` and `statistics` schemas cannot be represented as a built-in Nautilus data types +The Databento `imbalance` and `statistics` schemas cannot be represented as a built-in Nautilus data types, and so they have specific types defined in Rust `DatabentoImbalance` and `DatabentoStatistics`. -Python bindings are provided via pyo3 (Rust) and so the types behaves a little differently to a built-in Nautilus +Python bindings are provided via pyo3 (Rust) so the types behave a little differently to a built-in Nautilus data types, where all attributes are pyo3 provided objects and not directly compatible with certain methods which may expect a Cython provided type. There are pyo3 -> legacy Cython object conversion methods available, which can be found in the API reference. @@ -244,7 +248,7 @@ the Nautilus Parquet data from disk, which achieves extremely high through-put ( than converting DBN -> Nautilus on the fly for every backtest run). ```{note} -Performance benchmarks are under development. +Performance benchmarks are currently under development. ``` ## Loading DBN data diff --git a/nightly/_sources/integrations/index.md.txt b/nightly/_sources/integrations/index.md.txt index 6609b559f6af..1861de65b06f 100644 --- a/nightly/_sources/integrations/index.md.txt +++ b/nightly/_sources/integrations/index.md.txt @@ -26,12 +26,12 @@ running strategies which are able to access larger capital allocations. | Name | ID | Type | Status | Docs | | :-------------------------------------------------------- | :-------------------- | :---------------------- | :------------------------------------------------------ | :------------------------------------------------------------------ | -| [Betfair](https://betfair.com) | `BETFAIR` | Sports Betting Exchange | ![status](https://img.shields.io/badge/beta-yellow) | [Guide](https://docs.nautilustrader.io/integrations/betfair.html) | +| [Betfair](https://betfair.com) | `BETFAIR` | Sports Betting Exchange | ![status](https://img.shields.io/badge/stable-green) | [Guide](https://docs.nautilustrader.io/integrations/betfair.html) | | [Binance](https://binance.com) | `BINANCE` | Crypto Exchange (CEX) | ![status](https://img.shields.io/badge/stable-green) | [Guide](https://docs.nautilustrader.io/integrations/binance.html) | | [Binance US](https://binance.us) | `BINANCE` | Crypto Exchange (CEX) | ![status](https://img.shields.io/badge/stable-green) | [Guide](https://docs.nautilustrader.io/integrations/binance.html) | | [Binance Futures](https://www.binance.com/en/futures) | `BINANCE` | Crypto Exchange (CEX) | ![status](https://img.shields.io/badge/stable-green) | [Guide](https://docs.nautilustrader.io/integrations/binance.html) | | [Bybit](https://www.bybit.com) | `BYBIT` | Crypto Exchange (CEX) | ![status](https://img.shields.io/badge/building-orange) | | -| [Databento](https://databento.com) | `DATABENTO` | Data provider | ![status](https://img.shields.io/badge/beta-yellow) | [Guide](https://docs.nautilustrader.io/integrations/databento.html) | +| [Databento](https://databento.com) | `DATABENTO` | Data Provider | ![status](https://img.shields.io/badge/beta-yellow) | [Guide](https://docs.nautilustrader.io/integrations/databento.html) | | [Interactive Brokers](https://www.interactivebrokers.com) | `INTERACTIVE_BROKERS` | Brokerage (multi-venue) | ![status](https://img.shields.io/badge/stable-green) | [Guide](https://docs.nautilustrader.io/integrations/ib.html) | ## Implementation goals diff --git a/nightly/api_reference/adapters/interactive_brokers.html b/nightly/api_reference/adapters/interactive_brokers.html index b610ca85534e..9da8d8969eb6 100644 --- a/nightly/api_reference/adapters/interactive_brokers.html +++ b/nightly/api_reference/adapters/interactive_brokers.html @@ -12080,7 +12080,7 @@

at - 0x7ad1685cf350> + 0x79e85661b090> = diff --git a/nightly/api_reference/common.html b/nightly/api_reference/common.html index 53f5dee0cff4..7cf06317e2db 100644 --- a/nightly/api_reference/common.html +++ b/nightly/api_reference/common.html @@ -2272,6 +2272,15 @@ +
  • + + + + LogGuard + + + +
  • @@ -20035,6 +20044,44 @@

    +
    +
    + + + class + + + + + + + LogGuard + + + + ¶ + +
    +
    +

    + Bases: + + + object + + +

    +

    + Provides a + + LogGuard + + which serves as a token to signal the initialization +of the logging system. It also ensures that the global logger is flushed +of any buffered records when the instance is destroyed. +

    +
    +
    @@ -26476,9 +26523,11 @@

    - - void - + + + LogGuard + + @@ -26498,7 +26547,15 @@

    This function should only be called once per process, at the beginning of the application -run. +run. Subsequent calls will raise a + + RuntimeError + + , as there can only be one + + LogGuard + + per initialized system.

    @@ -26760,6 +26817,33 @@

  • +
    + Returns + + : + +
    +
    +

    + + LogGuard + +

    +
    +
    + Raises + + : + +
    +
    +

    + + RuntimeError + + – If the logging system has already been initialized. +

    +
    diff --git a/nightly/concepts/data.html b/nightly/concepts/data.html index 4ce3e9d641a9..16ccb75b7ff5 100644 --- a/nightly/concepts/data.html +++ b/nightly/concepts/data.html @@ -1057,7 +1057,7 @@

    Data loader components are typically specific for the raw source/format and per integration. For instance, Binance order book data is stored in its raw CSV file form with an entirely different format to - + Databento Binary Encoding (DBN) files. diff --git a/nightly/core/help.html b/nightly/core/help.html index 362d8c629340..ad2e550e2650 100644 --- a/nightly/core/help.html +++ b/nightly/core/help.html @@ -1,2 +1,2 @@ -Help

    +Help

    Rustdoc help

    Back
    \ No newline at end of file diff --git a/nightly/core/index.html b/nightly/core/index.html index 4422279169ba..a7f6a835a54e 100644 --- a/nightly/core/index.html +++ b/nightly/core/index.html @@ -1,2 +1,2 @@ -Index of crates +Index of crates
    \ No newline at end of file diff --git a/nightly/core/nautilus_accounting/account/base/index.html b/nightly/core/nautilus_accounting/account/base/index.html index 885d3b47efd9..35221fcd43bd 100644 --- a/nightly/core/nautilus_accounting/account/base/index.html +++ b/nightly/core/nautilus_accounting/account/base/index.html @@ -1,2 +1,2 @@ -nautilus_accounting::account::base - Rust -
    \ No newline at end of file +nautilus_accounting::account::base - Rust +
    \ No newline at end of file diff --git a/nightly/core/nautilus_accounting/account/base/struct.BaseAccount.html b/nightly/core/nautilus_accounting/account/base/struct.BaseAccount.html index 55e379e04928..3068d1475072 100644 --- a/nightly/core/nautilus_accounting/account/base/struct.BaseAccount.html +++ b/nightly/core/nautilus_accounting/account/base/struct.BaseAccount.html @@ -1,5 +1,5 @@ -BaseAccount in nautilus_accounting::account::base - Rust -
    pub struct BaseAccount {
    +BaseAccount in nautilus_accounting::account::base - Rust
    +    
    pub struct BaseAccount {
         pub id: AccountId,
         pub account_type: AccountType,
         pub base_currency: Option<Currency>,
    @@ -8,27 +8,27 @@
         pub commissions: HashMap<Currency, f64>,
         pub balances: HashMap<Currency, AccountBalance>,
         pub balances_starting: HashMap<Currency, Money>,
    -}

    Fields§

    §id: AccountId§account_type: AccountType§base_currency: Option<Currency>§calculate_account_state: bool§events: Vec<AccountState>§commissions: HashMap<Currency, f64>§balances: HashMap<Currency, AccountBalance>§balances_starting: HashMap<Currency, Money>

    Implementations§

    source§

    impl BaseAccount

    source

    pub fn new(event: AccountState, calculate_account_state: bool) -> Result<Self>

    source

    pub fn base_balance_total(&self, currency: Option<Currency>) -> Option<Money>

    source

    pub fn base_balances_total(&self) -> HashMap<Currency, Money>

    source

    pub fn base_balance_free(&self, currency: Option<Currency>) -> Option<Money>

    source

    pub fn base_balances_free(&self) -> HashMap<Currency, Money>

    source

    pub fn base_balance_locked(&self, currency: Option<Currency>) -> Option<Money>

    source

    pub fn base_balances_locked(&self) -> HashMap<Currency, Money>

    source

    pub fn base_last_event(&self) -> Option<AccountState>

    source

    pub fn update_balances(&mut self, balances: Vec<AccountBalance>)

    source

    pub fn base_apply(&mut self, event: AccountState)

    source

    pub fn base_calculate_balance_locked<T: Instrument>( +}

    Fields§

    §id: AccountId§account_type: AccountType§base_currency: Option<Currency>§calculate_account_state: bool§events: Vec<AccountState>§commissions: HashMap<Currency, f64>§balances: HashMap<Currency, AccountBalance>§balances_starting: HashMap<Currency, Money>

    Implementations§

    source§

    impl BaseAccount

    source

    pub fn new(event: AccountState, calculate_account_state: bool) -> Result<Self>

    source

    pub fn base_balance_total(&self, currency: Option<Currency>) -> Option<Money>

    source

    pub fn base_balances_total(&self) -> HashMap<Currency, Money>

    source

    pub fn base_balance_free(&self, currency: Option<Currency>) -> Option<Money>

    source

    pub fn base_balances_free(&self) -> HashMap<Currency, Money>

    source

    pub fn base_balance_locked(&self, currency: Option<Currency>) -> Option<Money>

    source

    pub fn base_balances_locked(&self) -> HashMap<Currency, Money>

    source

    pub fn base_last_event(&self) -> Option<AccountState>

    source

    pub fn update_balances(&mut self, balances: Vec<AccountBalance>)

    source

    pub fn base_apply(&mut self, event: AccountState)

    source

    pub fn base_calculate_balance_locked<T: Instrument>( &mut self, instrument: T, side: OrderSide, quantity: Quantity, price: Price, use_quote_for_inverse: Option<bool> -) -> Result<Money>

    source

    pub fn base_calculate_pnls<T: Instrument>( +) -> Result<Money>

    source

    pub fn base_calculate_pnls<T: Instrument>( &self, instrument: T, fill: OrderFilled, position: Option<Position> -) -> Result<Vec<Money>>

    source

    pub fn base_calculate_commission<T: Instrument>( +) -> Result<Vec<Money>>

    source

    pub fn base_calculate_commission<T: Instrument>( &self, instrument: T, last_qty: Quantity, last_px: Price, liquidity_side: LiquiditySide, use_quote_for_inverse: Option<bool> -) -> Result<Money>

    Trait Implementations§

    source§

    impl Debug for BaseAccount

    source§

    fn fmt(&self, f: &mut Formatter<'_>) -> Result

    Formats the value using the given formatter. Read more
    source§

    impl IntoPy<Py<PyAny>> for BaseAccount

    source§

    fn into_py(self, py: Python<'_>) -> PyObject

    Performs the conversion.
    source§

    impl PyClass for BaseAccount

    §

    type Frozen = False

    Whether the pyclass is frozen. Read more
    source§

    impl PyClassImpl for BaseAccount

    source§

    const IS_BASETYPE: bool = false

    #[pyclass(subclass)]
    source§

    const IS_SUBCLASS: bool = false

    #[pyclass(extends=…)]
    source§

    const IS_MAPPING: bool = false

    #[pyclass(mapping)]
    source§

    const IS_SEQUENCE: bool = false

    #[pyclass(sequence)]
    §

    type BaseType = PyAny

    Base class
    §

    type ThreadChecker = SendablePyClass<BaseAccount>

    This handles following two situations: Read more
    §

    type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild

    Immutable or mutable
    §

    type Dict = PyClassDummySlot

    Specify this class has #[pyclass(dict)] or not.
    §

    type WeakRef = PyClassDummySlot

    Specify this class has #[pyclass(weakref)] or not.
    §

    type BaseNativeType = PyAny

    The closest native ancestor. This is PyAny by default, and when you declare -#[pyclass(extends=PyDict)], it’s PyDict.
    source§

    fn items_iter() -> PyClassItemsIter

    source§

    fn doc(py: Python<'_>) -> PyResult<&'static CStr>

    Rendered class doc
    source§

    fn lazy_type_object() -> &'static LazyTypeObject<Self>

    §

    fn dict_offset() -> Option<isize>

    §

    fn weaklist_offset() -> Option<isize>

    source§

    impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a BaseAccount

    §

    type Holder = Option<PyRef<'py, BaseAccount>>

    source§

    fn extract(obj: &'py PyAny, holder: &'a mut Self::Holder) -> PyResult<Self>

    source§

    impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a mut BaseAccount

    §

    type Holder = Option<PyRefMut<'py, BaseAccount>>

    source§

    fn extract(obj: &'py PyAny, holder: &'a mut Self::Holder) -> PyResult<Self>

    source§

    impl PyTypeInfo for BaseAccount

    §

    type AsRefTarget = PyCell<BaseAccount>

    Utility type to make Py::as_ref work.
    source§

    const NAME: &'static str = "BaseAccount"

    Class name.
    source§

    const MODULE: Option<&'static str> = _

    Module name, if any.
    source§

    fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject

    Returns the PyTypeObject instance for this type.
    §

    fn type_object(py: Python<'_>) -> &PyType

    Returns the safe abstraction over the type object.
    §

    fn is_type_of(object: &PyAny) -> bool

    Checks if object is an instance of this type or a subclass of this type.
    §

    fn is_exact_type_of(object: &PyAny) -> bool

    Checks if object is an instance of this type.

    Auto Trait Implementations§

    Blanket Implementations§

    source§

    impl<T> Any for T
    where +) -> Result<Money>

    Trait Implementations§

    source§

    impl Debug for BaseAccount

    source§

    fn fmt(&self, f: &mut Formatter<'_>) -> Result

    Formats the value using the given formatter. Read more
    source§

    impl IntoPy<Py<PyAny>> for BaseAccount

    source§

    fn into_py(self, py: Python<'_>) -> PyObject

    Performs the conversion.
    source§

    impl PyClass for BaseAccount

    §

    type Frozen = False

    Whether the pyclass is frozen. Read more
    source§

    impl PyClassImpl for BaseAccount

    source§

    const IS_BASETYPE: bool = false

    #[pyclass(subclass)]
    source§

    const IS_SUBCLASS: bool = false

    #[pyclass(extends=…)]
    source§

    const IS_MAPPING: bool = false

    #[pyclass(mapping)]
    source§

    const IS_SEQUENCE: bool = false

    #[pyclass(sequence)]
    §

    type BaseType = PyAny

    Base class
    §

    type ThreadChecker = SendablePyClass<BaseAccount>

    This handles following two situations: Read more
    §

    type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild

    Immutable or mutable
    §

    type Dict = PyClassDummySlot

    Specify this class has #[pyclass(dict)] or not.
    §

    type WeakRef = PyClassDummySlot

    Specify this class has #[pyclass(weakref)] or not.
    §

    type BaseNativeType = PyAny

    The closest native ancestor. This is PyAny by default, and when you declare +#[pyclass(extends=PyDict)], it’s PyDict.
    source§

    fn items_iter() -> PyClassItemsIter

    source§

    fn doc(py: Python<'_>) -> PyResult<&'static CStr>

    Rendered class doc
    source§

    fn lazy_type_object() -> &'static LazyTypeObject<Self>

    §

    fn dict_offset() -> Option<isize>

    §

    fn weaklist_offset() -> Option<isize>

    source§

    impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a BaseAccount

    §

    type Holder = Option<PyRef<'py, BaseAccount>>

    source§

    fn extract(obj: &'py PyAny, holder: &'a mut Self::Holder) -> PyResult<Self>

    source§

    impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a mut BaseAccount

    §

    type Holder = Option<PyRefMut<'py, BaseAccount>>

    source§

    fn extract(obj: &'py PyAny, holder: &'a mut Self::Holder) -> PyResult<Self>

    source§

    impl PyTypeInfo for BaseAccount

    §

    type AsRefTarget = PyCell<BaseAccount>

    Utility type to make Py::as_ref work.
    source§

    const NAME: &'static str = "BaseAccount"

    Class name.
    source§

    const MODULE: Option<&'static str> = _

    Module name, if any.
    source§

    fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject

    Returns the PyTypeObject instance for this type.
    §

    fn type_object(py: Python<'_>) -> &PyType

    Returns the safe abstraction over the type object.
    §

    fn is_type_of(object: &PyAny) -> bool

    Checks if object is an instance of this type or a subclass of this type.
    §

    fn is_exact_type_of(object: &PyAny) -> bool

    Checks if object is an instance of this type.

    Auto Trait Implementations§

    Blanket Implementations§

    source§

    impl<T> Any for T
    where T: 'static + ?Sized,

    source§

    fn type_id(&self) -> TypeId

    Gets the TypeId of self. Read more
    source§

    impl<T> Borrow<T> for T
    where T: ?Sized,

    source§

    fn borrow(&self) -> &T

    Immutably borrows from an owned value. Read more
    source§

    impl<T> BorrowMut<T> for T
    where T: ?Sized,

    source§

    fn borrow_mut(&mut self) -> &mut T

    Mutably borrows from an owned value. Read more
    source§

    impl<T> From<T> for T

    source§

    fn from(t: T) -> T

    Returns the argument unchanged.

    diff --git a/nightly/core/nautilus_accounting/account/cash/index.html b/nightly/core/nautilus_accounting/account/cash/index.html index 70eb33694c4a..3758715afc1b 100644 --- a/nightly/core/nautilus_accounting/account/cash/index.html +++ b/nightly/core/nautilus_accounting/account/cash/index.html @@ -1,2 +1,2 @@ -nautilus_accounting::account::cash - Rust -
    \ No newline at end of file +nautilus_accounting::account::cash - Rust +
    \ No newline at end of file diff --git a/nightly/core/nautilus_accounting/account/cash/struct.CashAccount.html b/nightly/core/nautilus_accounting/account/cash/struct.CashAccount.html index 1952d1945b3e..f91089b4dea9 100644 --- a/nightly/core/nautilus_accounting/account/cash/struct.CashAccount.html +++ b/nightly/core/nautilus_accounting/account/cash/struct.CashAccount.html @@ -1,51 +1,51 @@ -CashAccount in nautilus_accounting::account::cash - Rust -
    pub struct CashAccount {
    +CashAccount in nautilus_accounting::account::cash - Rust
    +    
    pub struct CashAccount {
         pub base: BaseAccount,
    -}

    Fields§

    §base: BaseAccount

    Implementations§

    source§

    impl CashAccount

    source

    pub fn new(event: AccountState, calculate_account_state: bool) -> Result<Self>

    source

    pub fn is_cash_account(&self) -> bool

    source

    pub fn is_margin_account(&self) -> bool

    source

    pub fn is_unleveraged(&self) -> bool

    source§

    impl CashAccount

    source

    pub fn py_new( +}

    Fields§

    §base: BaseAccount

    Implementations§

    source§

    impl CashAccount

    source

    pub fn new(event: AccountState, calculate_account_state: bool) -> Result<Self>

    source

    pub fn is_cash_account(&self) -> bool

    source

    pub fn is_margin_account(&self) -> bool

    source

    pub fn is_unleveraged(&self) -> bool

    source§

    impl CashAccount

    source

    pub fn py_new( event: AccountState, calculate_account_state: bool -) -> PyResult<Self>

    Methods from Deref<Target = BaseAccount>§

    source

    pub fn base_balance_total(&self, currency: Option<Currency>) -> Option<Money>

    source

    pub fn base_balances_total(&self) -> HashMap<Currency, Money>

    source

    pub fn base_balance_free(&self, currency: Option<Currency>) -> Option<Money>

    source

    pub fn base_balances_free(&self) -> HashMap<Currency, Money>

    source

    pub fn base_balance_locked(&self, currency: Option<Currency>) -> Option<Money>

    source

    pub fn base_balances_locked(&self) -> HashMap<Currency, Money>

    source

    pub fn base_last_event(&self) -> Option<AccountState>

    source

    pub fn update_balances(&mut self, balances: Vec<AccountBalance>)

    source

    pub fn base_apply(&mut self, event: AccountState)

    source

    pub fn base_calculate_balance_locked<T: Instrument>( +) -> PyResult<Self>

    Methods from Deref<Target = BaseAccount>§

    source

    pub fn base_balance_total(&self, currency: Option<Currency>) -> Option<Money>

    source

    pub fn base_balances_total(&self) -> HashMap<Currency, Money>

    source

    pub fn base_balance_free(&self, currency: Option<Currency>) -> Option<Money>

    source

    pub fn base_balances_free(&self) -> HashMap<Currency, Money>

    source

    pub fn base_balance_locked(&self, currency: Option<Currency>) -> Option<Money>

    source

    pub fn base_balances_locked(&self) -> HashMap<Currency, Money>

    source

    pub fn base_last_event(&self) -> Option<AccountState>

    source

    pub fn update_balances(&mut self, balances: Vec<AccountBalance>)

    source

    pub fn base_apply(&mut self, event: AccountState)

    source

    pub fn base_calculate_balance_locked<T: Instrument>( &mut self, instrument: T, side: OrderSide, quantity: Quantity, price: Price, use_quote_for_inverse: Option<bool> -) -> Result<Money>

    source

    pub fn base_calculate_pnls<T: Instrument>( +) -> Result<Money>

    source

    pub fn base_calculate_pnls<T: Instrument>( &self, instrument: T, fill: OrderFilled, position: Option<Position> -) -> Result<Vec<Money>>

    source

    pub fn base_calculate_commission<T: Instrument>( +) -> Result<Vec<Money>>

    source

    pub fn base_calculate_commission<T: Instrument>( &self, instrument: T, last_qty: Quantity, last_px: Price, liquidity_side: LiquiditySide, use_quote_for_inverse: Option<bool> -) -> Result<Money>

    Trait Implementations§

    source§

    impl Account for CashAccount

    source§

    fn balance_total(&self, currency: Option<Currency>) -> Option<Money>

    source§

    fn balances_total(&self) -> HashMap<Currency, Money>

    source§

    fn balance_free(&self, currency: Option<Currency>) -> Option<Money>

    source§

    fn balances_free(&self) -> HashMap<Currency, Money>

    source§

    fn balance_locked(&self, currency: Option<Currency>) -> Option<Money>

    source§

    fn balances_locked(&self) -> HashMap<Currency, Money>

    source§

    fn last_event(&self) -> Option<AccountState>

    source§

    fn events(&self) -> Vec<AccountState>

    source§

    fn event_count(&self) -> usize

    source§

    fn currencies(&self) -> Vec<Currency>

    source§

    fn starting_balances(&self) -> HashMap<Currency, Money>

    source§

    fn balances(&self) -> HashMap<Currency, AccountBalance>

    source§

    fn apply(&mut self, event: AccountState)

    source§

    fn calculate_balance_locked<T: Instrument>( +) -> Result<Money>

    Trait Implementations§

    source§

    impl Account for CashAccount

    source§

    fn balance_total(&self, currency: Option<Currency>) -> Option<Money>

    source§

    fn balances_total(&self) -> HashMap<Currency, Money>

    source§

    fn balance_free(&self, currency: Option<Currency>) -> Option<Money>

    source§

    fn balances_free(&self) -> HashMap<Currency, Money>

    source§

    fn balance_locked(&self, currency: Option<Currency>) -> Option<Money>

    source§

    fn balances_locked(&self) -> HashMap<Currency, Money>

    source§

    fn last_event(&self) -> Option<AccountState>

    source§

    fn events(&self) -> Vec<AccountState>

    source§

    fn event_count(&self) -> usize

    source§

    fn currencies(&self) -> Vec<Currency>

    source§

    fn starting_balances(&self) -> HashMap<Currency, Money>

    source§

    fn balances(&self) -> HashMap<Currency, AccountBalance>

    source§

    fn apply(&mut self, event: AccountState)

    source§

    fn calculate_balance_locked<T: Instrument>( &mut self, instrument: T, side: OrderSide, quantity: Quantity, price: Price, use_quote_for_inverse: Option<bool> -) -> Result<Money>

    source§

    fn calculate_pnls<T: Instrument>( +) -> Result<Money>

    source§

    fn calculate_pnls<T: Instrument>( &self, instrument: T, fill: OrderFilled, position: Option<Position> -) -> Result<Vec<Money>>

    source§

    fn calculate_commission<T: Instrument>( +) -> Result<Vec<Money>>

    source§

    fn calculate_commission<T: Instrument>( &self, instrument: T, last_qty: Quantity, last_px: Price, liquidity_side: LiquiditySide, use_quote_for_inverse: Option<bool> -) -> Result<Money>

    source§

    impl Debug for CashAccount

    source§

    fn fmt(&self, f: &mut Formatter<'_>) -> Result

    Formats the value using the given formatter. Read more
    source§

    impl Deref for CashAccount

    §

    type Target = BaseAccount

    The resulting type after dereferencing.
    source§

    fn deref(&self) -> &Self::Target

    Dereferences the value.
    source§

    impl DerefMut for CashAccount

    source§

    fn deref_mut(&mut self) -> &mut Self::Target

    Mutably dereferences the value.
    source§

    impl Display for CashAccount

    source§

    fn fmt(&self, f: &mut Formatter<'_>) -> Result

    Formats the value using the given formatter. Read more
    source§

    impl IntoPy<Py<PyAny>> for CashAccount

    source§

    fn into_py(self, py: Python<'_>) -> PyObject

    Performs the conversion.
    source§

    impl PartialEq for CashAccount

    source§

    fn eq(&self, other: &Self) -> bool

    This method tests for self and other values to be equal, and is used +) -> Result<Money>

    source§

    impl Debug for CashAccount

    source§

    fn fmt(&self, f: &mut Formatter<'_>) -> Result

    Formats the value using the given formatter. Read more
    source§

    impl Deref for CashAccount

    §

    type Target = BaseAccount

    The resulting type after dereferencing.
    source§

    fn deref(&self) -> &Self::Target

    Dereferences the value.
    source§

    impl DerefMut for CashAccount

    source§

    fn deref_mut(&mut self) -> &mut Self::Target

    Mutably dereferences the value.
    source§

    impl Display for CashAccount

    source§

    fn fmt(&self, f: &mut Formatter<'_>) -> Result

    Formats the value using the given formatter. Read more
    source§

    impl IntoPy<Py<PyAny>> for CashAccount

    source§

    fn into_py(self, py: Python<'_>) -> PyObject

    Performs the conversion.
    source§

    impl PartialEq for CashAccount

    source§

    fn eq(&self, other: &Self) -> bool

    This method tests for self and other values to be equal, and is used by ==.
    1.0.0 · source§

    fn ne(&self, other: &Rhs) -> bool

    This method tests for !=. The default implementation is almost always -sufficient, and should not be overridden without very good reason.
    source§

    impl PyClass for CashAccount

    §

    type Frozen = False

    Whether the pyclass is frozen. Read more
    source§

    impl PyClassImpl for CashAccount

    source§

    const IS_BASETYPE: bool = false

    #[pyclass(subclass)]
    source§

    const IS_SUBCLASS: bool = false

    #[pyclass(extends=…)]
    source§

    const IS_MAPPING: bool = false

    #[pyclass(mapping)]
    source§

    const IS_SEQUENCE: bool = false

    #[pyclass(sequence)]
    §

    type BaseType = PyAny

    Base class
    §

    type ThreadChecker = SendablePyClass<CashAccount>

    This handles following two situations: Read more
    §

    type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild

    Immutable or mutable
    §

    type Dict = PyClassDummySlot

    Specify this class has #[pyclass(dict)] or not.
    §

    type WeakRef = PyClassDummySlot

    Specify this class has #[pyclass(weakref)] or not.
    §

    type BaseNativeType = PyAny

    The closest native ancestor. This is PyAny by default, and when you declare -#[pyclass(extends=PyDict)], it’s PyDict.
    source§

    fn items_iter() -> PyClassItemsIter

    source§

    fn doc(py: Python<'_>) -> PyResult<&'static CStr>

    Rendered class doc
    source§

    fn lazy_type_object() -> &'static LazyTypeObject<Self>

    §

    fn dict_offset() -> Option<isize>

    §

    fn weaklist_offset() -> Option<isize>

    source§

    impl PyClassNewTextSignature<CashAccount> for PyClassImplCollector<CashAccount>

    source§

    fn new_text_signature(self) -> Option<&'static str>

    source§

    impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a CashAccount

    §

    type Holder = Option<PyRef<'py, CashAccount>>

    source§

    fn extract(obj: &'py PyAny, holder: &'a mut Self::Holder) -> PyResult<Self>

    source§

    impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a mut CashAccount

    §

    type Holder = Option<PyRefMut<'py, CashAccount>>

    source§

    fn extract(obj: &'py PyAny, holder: &'a mut Self::Holder) -> PyResult<Self>

    source§

    impl PyMethods<CashAccount> for PyClassImplCollector<CashAccount>

    source§

    fn py_methods(self) -> &'static PyClassItems

    source§

    impl PyTypeInfo for CashAccount

    §

    type AsRefTarget = PyCell<CashAccount>

    Utility type to make Py::as_ref work.
    source§

    const NAME: &'static str = "CashAccount"

    Class name.
    source§

    const MODULE: Option<&'static str> = _

    Module name, if any.
    source§

    fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject

    Returns the PyTypeObject instance for this type.
    §

    fn type_object(py: Python<'_>) -> &PyType

    Returns the safe abstraction over the type object.
    §

    fn is_type_of(object: &PyAny) -> bool

    Checks if object is an instance of this type or a subclass of this type.
    §

    fn is_exact_type_of(object: &PyAny) -> bool

    Checks if object is an instance of this type.
    source§

    impl Eq for CashAccount

    Auto Trait Implementations§

    Blanket Implementations§

    source§

    impl<T> Any for T
    where +sufficient, and should not be overridden without very good reason.

    source§

    impl PyClass for CashAccount

    §

    type Frozen = False

    Whether the pyclass is frozen. Read more
    source§

    impl PyClassImpl for CashAccount

    source§

    const IS_BASETYPE: bool = false

    #[pyclass(subclass)]
    source§

    const IS_SUBCLASS: bool = false

    #[pyclass(extends=…)]
    source§

    const IS_MAPPING: bool = false

    #[pyclass(mapping)]
    source§

    const IS_SEQUENCE: bool = false

    #[pyclass(sequence)]
    §

    type BaseType = PyAny

    Base class
    §

    type ThreadChecker = SendablePyClass<CashAccount>

    This handles following two situations: Read more
    §

    type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild

    Immutable or mutable
    §

    type Dict = PyClassDummySlot

    Specify this class has #[pyclass(dict)] or not.
    §

    type WeakRef = PyClassDummySlot

    Specify this class has #[pyclass(weakref)] or not.
    §

    type BaseNativeType = PyAny

    The closest native ancestor. This is PyAny by default, and when you declare +#[pyclass(extends=PyDict)], it’s PyDict.
    source§

    fn items_iter() -> PyClassItemsIter

    source§

    fn doc(py: Python<'_>) -> PyResult<&'static CStr>

    Rendered class doc
    source§

    fn lazy_type_object() -> &'static LazyTypeObject<Self>

    §

    fn dict_offset() -> Option<isize>

    §

    fn weaklist_offset() -> Option<isize>

    source§

    impl PyClassNewTextSignature<CashAccount> for PyClassImplCollector<CashAccount>

    source§

    fn new_text_signature(self) -> Option<&'static str>

    source§

    impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a CashAccount

    §

    type Holder = Option<PyRef<'py, CashAccount>>

    source§

    fn extract(obj: &'py PyAny, holder: &'a mut Self::Holder) -> PyResult<Self>

    source§

    impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a mut CashAccount

    §

    type Holder = Option<PyRefMut<'py, CashAccount>>

    source§

    fn extract(obj: &'py PyAny, holder: &'a mut Self::Holder) -> PyResult<Self>

    source§

    impl PyMethods<CashAccount> for PyClassImplCollector<CashAccount>

    source§

    fn py_methods(self) -> &'static PyClassItems

    source§

    impl PyTypeInfo for CashAccount

    §

    type AsRefTarget = PyCell<CashAccount>

    Utility type to make Py::as_ref work.
    source§

    const NAME: &'static str = "CashAccount"

    Class name.
    source§

    const MODULE: Option<&'static str> = _

    Module name, if any.
    source§

    fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject

    Returns the PyTypeObject instance for this type.
    §

    fn type_object(py: Python<'_>) -> &PyType

    Returns the safe abstraction over the type object.
    §

    fn is_type_of(object: &PyAny) -> bool

    Checks if object is an instance of this type or a subclass of this type.
    §

    fn is_exact_type_of(object: &PyAny) -> bool

    Checks if object is an instance of this type.
    source§

    impl Eq for CashAccount

    Auto Trait Implementations§

    Blanket Implementations§

    source§

    impl<T> Any for T
    where T: 'static + ?Sized,

    source§

    fn type_id(&self) -> TypeId

    Gets the TypeId of self. Read more
    source§

    impl<T> Borrow<T> for T
    where T: ?Sized,

    source§

    fn borrow(&self) -> &T

    Immutably borrows from an owned value. Read more
    source§

    impl<T> BorrowMut<T> for T
    where T: ?Sized,

    source§

    fn borrow_mut(&mut self) -> &mut T

    Mutably borrows from an owned value. Read more
    §

    impl<Q, K> Equivalent<K> for Q
    where diff --git a/nightly/core/nautilus_accounting/account/index.html b/nightly/core/nautilus_accounting/account/index.html index 5ecaf73c7af9..13c32ffb9b47 100644 --- a/nightly/core/nautilus_accounting/account/index.html +++ b/nightly/core/nautilus_accounting/account/index.html @@ -1,2 +1,2 @@ -nautilus_accounting::account - Rust -
    \ No newline at end of file +nautilus_accounting::account - Rust +
    \ No newline at end of file diff --git a/nightly/core/nautilus_accounting/account/margin/index.html b/nightly/core/nautilus_accounting/account/margin/index.html index d46c1e76ffd1..72b0a4bb3910 100644 --- a/nightly/core/nautilus_accounting/account/margin/index.html +++ b/nightly/core/nautilus_accounting/account/margin/index.html @@ -1,2 +1,2 @@ -nautilus_accounting::account::margin - Rust -
    \ No newline at end of file +nautilus_accounting::account::margin - Rust +
    \ No newline at end of file diff --git a/nightly/core/nautilus_accounting/account/margin/struct.MarginAccount.html b/nightly/core/nautilus_accounting/account/margin/struct.MarginAccount.html index e3fae98edc5e..c32f50086718 100644 --- a/nightly/core/nautilus_accounting/account/margin/struct.MarginAccount.html +++ b/nightly/core/nautilus_accounting/account/margin/struct.MarginAccount.html @@ -1,30 +1,30 @@ -MarginAccount in nautilus_accounting::account::margin - Rust -
    pub struct MarginAccount {
    +MarginAccount in nautilus_accounting::account::margin - Rust
    +    
    pub struct MarginAccount {
         pub base: BaseAccount,
         pub leverages: HashMap<InstrumentId, f64>,
         pub margins: HashMap<InstrumentId, MarginBalance>,
         pub default_leverage: f64,
    -}

    Fields§

    §base: BaseAccount§leverages: HashMap<InstrumentId, f64>§margins: HashMap<InstrumentId, MarginBalance>§default_leverage: f64

    Implementations§

    source§

    impl MarginAccount

    source

    pub fn new(event: AccountState, calculate_account_state: bool) -> Result<Self>

    source

    pub fn set_default_leverage(&mut self, leverage: f64)

    source

    pub fn set_leverage(&mut self, instrument_id: InstrumentId, leverage: f64)

    source

    pub fn get_leverage(&self, instrument_id: &InstrumentId) -> f64

    source

    pub fn is_unleveraged(&self, instrument_id: InstrumentId) -> bool

    source

    pub fn is_cash_account(&self) -> bool

    source

    pub fn is_margin_account(&self) -> bool

    source

    pub fn initial_margins(&self) -> HashMap<InstrumentId, Money>

    source

    pub fn maintenance_margins(&self) -> HashMap<InstrumentId, Money>

    source

    pub fn update_initial_margin( +}

    Fields§

    §base: BaseAccount§leverages: HashMap<InstrumentId, f64>§margins: HashMap<InstrumentId, MarginBalance>§default_leverage: f64

    Implementations§

    source§

    impl MarginAccount

    source

    pub fn new(event: AccountState, calculate_account_state: bool) -> Result<Self>

    source

    pub fn set_default_leverage(&mut self, leverage: f64)

    source

    pub fn set_leverage(&mut self, instrument_id: InstrumentId, leverage: f64)

    source

    pub fn get_leverage(&self, instrument_id: &InstrumentId) -> f64

    source

    pub fn is_unleveraged(&self, instrument_id: InstrumentId) -> bool

    source

    pub fn is_cash_account(&self) -> bool

    source

    pub fn is_margin_account(&self) -> bool

    source

    pub fn initial_margins(&self) -> HashMap<InstrumentId, Money>

    source

    pub fn maintenance_margins(&self) -> HashMap<InstrumentId, Money>

    source

    pub fn update_initial_margin( &mut self, instrument_id: InstrumentId, margin_init: Money -)

    source

    pub fn initial_margin(&self, instrument_id: InstrumentId) -> Money

    source

    pub fn update_maintenance_margin( +)

    source

    pub fn initial_margin(&self, instrument_id: InstrumentId) -> Money

    source

    pub fn update_maintenance_margin( &mut self, instrument_id: InstrumentId, margin_maintenance: Money -)

    source

    pub fn maintenance_margin(&self, instrument_id: InstrumentId) -> Money

    source

    pub fn calculate_initial_margin<T: Instrument>( +)

    source

    pub fn maintenance_margin(&self, instrument_id: InstrumentId) -> Money

    source

    pub fn calculate_initial_margin<T: Instrument>( &mut self, instrument: T, quantity: Quantity, price: Price, use_quote_for_inverse: Option<bool> -) -> Money

    source

    pub fn calculate_maintenance_margin<T: Instrument>( +) -> Money

    source

    pub fn calculate_maintenance_margin<T: Instrument>( &mut self, instrument: T, quantity: Quantity, price: Price, use_quote_for_inverse: Option<bool> -) -> Money

    source

    pub fn recalculate_balance(&mut self, currency: Currency)

    source§

    impl MarginAccount

    source

    pub fn py_calculate_initial_margin( +) -> Money

    source

    pub fn recalculate_balance(&mut self, currency: Currency)

    source§

    impl MarginAccount

    source

    pub fn py_calculate_initial_margin( &mut self, instrument: PyObject, quantity: Quantity, @@ -38,50 +38,50 @@ price: Price, use_quote_for_inverse: Option<bool>, py: Python<'_> -) -> PyResult<Money>

    Methods from Deref<Target = BaseAccount>§

    source

    pub fn base_balance_total(&self, currency: Option<Currency>) -> Option<Money>

    source

    pub fn base_balances_total(&self) -> HashMap<Currency, Money>

    source

    pub fn base_balance_free(&self, currency: Option<Currency>) -> Option<Money>

    source

    pub fn base_balances_free(&self) -> HashMap<Currency, Money>

    source

    pub fn base_balance_locked(&self, currency: Option<Currency>) -> Option<Money>

    source

    pub fn base_balances_locked(&self) -> HashMap<Currency, Money>

    source

    pub fn base_last_event(&self) -> Option<AccountState>

    source

    pub fn update_balances(&mut self, balances: Vec<AccountBalance>)

    source

    pub fn base_apply(&mut self, event: AccountState)

    source

    pub fn base_calculate_balance_locked<T: Instrument>( +) -> PyResult<Money>

    Methods from Deref<Target = BaseAccount>§

    source

    pub fn base_balance_total(&self, currency: Option<Currency>) -> Option<Money>

    source

    pub fn base_balances_total(&self) -> HashMap<Currency, Money>

    source

    pub fn base_balance_free(&self, currency: Option<Currency>) -> Option<Money>

    source

    pub fn base_balances_free(&self) -> HashMap<Currency, Money>

    source

    pub fn base_balance_locked(&self, currency: Option<Currency>) -> Option<Money>

    source

    pub fn base_balances_locked(&self) -> HashMap<Currency, Money>

    source

    pub fn base_last_event(&self) -> Option<AccountState>

    source

    pub fn update_balances(&mut self, balances: Vec<AccountBalance>)

    source

    pub fn base_apply(&mut self, event: AccountState)

    source

    pub fn base_calculate_balance_locked<T: Instrument>( &mut self, instrument: T, side: OrderSide, quantity: Quantity, price: Price, use_quote_for_inverse: Option<bool> -) -> Result<Money>

    source

    pub fn base_calculate_pnls<T: Instrument>( +) -> Result<Money>

    source

    pub fn base_calculate_pnls<T: Instrument>( &self, instrument: T, fill: OrderFilled, position: Option<Position> -) -> Result<Vec<Money>>

    source

    pub fn base_calculate_commission<T: Instrument>( +) -> Result<Vec<Money>>

    source

    pub fn base_calculate_commission<T: Instrument>( &self, instrument: T, last_qty: Quantity, last_px: Price, liquidity_side: LiquiditySide, use_quote_for_inverse: Option<bool> -) -> Result<Money>

    Trait Implementations§

    source§

    impl Account for MarginAccount

    source§

    fn balance_total(&self, currency: Option<Currency>) -> Option<Money>

    source§

    fn balances_total(&self) -> HashMap<Currency, Money>

    source§

    fn balance_free(&self, currency: Option<Currency>) -> Option<Money>

    source§

    fn balances_free(&self) -> HashMap<Currency, Money>

    source§

    fn balance_locked(&self, currency: Option<Currency>) -> Option<Money>

    source§

    fn balances_locked(&self) -> HashMap<Currency, Money>

    source§

    fn last_event(&self) -> Option<AccountState>

    source§

    fn events(&self) -> Vec<AccountState>

    source§

    fn event_count(&self) -> usize

    source§

    fn currencies(&self) -> Vec<Currency>

    source§

    fn starting_balances(&self) -> HashMap<Currency, Money>

    source§

    fn balances(&self) -> HashMap<Currency, AccountBalance>

    source§

    fn apply(&mut self, event: AccountState)

    source§

    fn calculate_balance_locked<T: Instrument>( +) -> Result<Money>

    Trait Implementations§

    source§

    impl Account for MarginAccount

    source§

    fn balance_total(&self, currency: Option<Currency>) -> Option<Money>

    source§

    fn balances_total(&self) -> HashMap<Currency, Money>

    source§

    fn balance_free(&self, currency: Option<Currency>) -> Option<Money>

    source§

    fn balances_free(&self) -> HashMap<Currency, Money>

    source§

    fn balance_locked(&self, currency: Option<Currency>) -> Option<Money>

    source§

    fn balances_locked(&self) -> HashMap<Currency, Money>

    source§

    fn last_event(&self) -> Option<AccountState>

    source§

    fn events(&self) -> Vec<AccountState>

    source§

    fn event_count(&self) -> usize

    source§

    fn currencies(&self) -> Vec<Currency>

    source§

    fn starting_balances(&self) -> HashMap<Currency, Money>

    source§

    fn balances(&self) -> HashMap<Currency, AccountBalance>

    source§

    fn apply(&mut self, event: AccountState)

    source§

    fn calculate_balance_locked<T: Instrument>( &mut self, instrument: T, side: OrderSide, quantity: Quantity, price: Price, use_quote_for_inverse: Option<bool> -) -> Result<Money>

    source§

    fn calculate_pnls<T: Instrument>( +) -> Result<Money>

    source§

    fn calculate_pnls<T: Instrument>( &self, instrument: T, fill: OrderFilled, position: Option<Position> -) -> Result<Vec<Money>>

    source§

    fn calculate_commission<T: Instrument>( +) -> Result<Vec<Money>>

    source§

    fn calculate_commission<T: Instrument>( &self, instrument: T, last_qty: Quantity, last_px: Price, liquidity_side: LiquiditySide, use_quote_for_inverse: Option<bool> -) -> Result<Money>

    source§

    impl Debug for MarginAccount

    source§

    fn fmt(&self, f: &mut Formatter<'_>) -> Result

    Formats the value using the given formatter. Read more
    source§

    impl Deref for MarginAccount

    §

    type Target = BaseAccount

    The resulting type after dereferencing.
    source§

    fn deref(&self) -> &Self::Target

    Dereferences the value.
    source§

    impl DerefMut for MarginAccount

    source§

    fn deref_mut(&mut self) -> &mut Self::Target

    Mutably dereferences the value.
    source§

    impl Display for MarginAccount

    source§

    fn fmt(&self, f: &mut Formatter<'_>) -> Result

    Formats the value using the given formatter. Read more
    source§

    impl Hash for MarginAccount

    source§

    fn hash<H: Hasher>(&self, state: &mut H)

    Feeds this value into the given Hasher. Read more
    1.3.0 · source§

    fn hash_slice<H>(data: &[Self], state: &mut H)
    where +) -> Result<Money>

    source§

    impl Debug for MarginAccount

    source§

    fn fmt(&self, f: &mut Formatter<'_>) -> Result

    Formats the value using the given formatter. Read more
    source§

    impl Deref for MarginAccount

    §

    type Target = BaseAccount

    The resulting type after dereferencing.
    source§

    fn deref(&self) -> &Self::Target

    Dereferences the value.
    source§

    impl DerefMut for MarginAccount

    source§

    fn deref_mut(&mut self) -> &mut Self::Target

    Mutably dereferences the value.
    source§

    impl Display for MarginAccount

    source§

    fn fmt(&self, f: &mut Formatter<'_>) -> Result

    Formats the value using the given formatter. Read more
    source§

    impl Hash for MarginAccount

    source§

    fn hash<H: Hasher>(&self, state: &mut H)

    Feeds this value into the given Hasher. Read more
    1.3.0 · source§

    fn hash_slice<H>(data: &[Self], state: &mut H)
    where H: Hasher, - Self: Sized,

    Feeds a slice of this type into the given Hasher. Read more
    source§

    impl IntoPy<Py<PyAny>> for MarginAccount

    source§

    fn into_py(self, py: Python<'_>) -> PyObject

    Performs the conversion.
    source§

    impl PartialEq for MarginAccount

    source§

    fn eq(&self, other: &Self) -> bool

    This method tests for self and other values to be equal, and is used + Self: Sized,

    Feeds a slice of this type into the given Hasher. Read more
    source§

    impl IntoPy<Py<PyAny>> for MarginAccount

    source§

    fn into_py(self, py: Python<'_>) -> PyObject

    Performs the conversion.
    source§

    impl PartialEq for MarginAccount

    source§

    fn eq(&self, other: &Self) -> bool

    This method tests for self and other values to be equal, and is used by ==.
    1.0.0 · source§

    fn ne(&self, other: &Rhs) -> bool

    This method tests for !=. The default implementation is almost always -sufficient, and should not be overridden without very good reason.
    source§

    impl PyClass for MarginAccount

    §

    type Frozen = False

    Whether the pyclass is frozen. Read more
    source§

    impl PyClassImpl for MarginAccount

    source§

    const IS_BASETYPE: bool = false

    #[pyclass(subclass)]
    source§

    const IS_SUBCLASS: bool = false

    #[pyclass(extends=…)]
    source§

    const IS_MAPPING: bool = false

    #[pyclass(mapping)]
    source§

    const IS_SEQUENCE: bool = false

    #[pyclass(sequence)]
    §

    type BaseType = PyAny

    Base class
    §

    type ThreadChecker = SendablePyClass<MarginAccount>

    This handles following two situations: Read more
    §

    type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild

    Immutable or mutable
    §

    type Dict = PyClassDummySlot

    Specify this class has #[pyclass(dict)] or not.
    §

    type WeakRef = PyClassDummySlot

    Specify this class has #[pyclass(weakref)] or not.
    §

    type BaseNativeType = PyAny

    The closest native ancestor. This is PyAny by default, and when you declare -#[pyclass(extends=PyDict)], it’s PyDict.
    source§

    fn items_iter() -> PyClassItemsIter

    source§

    fn doc(py: Python<'_>) -> PyResult<&'static CStr>

    Rendered class doc
    source§

    fn lazy_type_object() -> &'static LazyTypeObject<Self>

    §

    fn dict_offset() -> Option<isize>

    §

    fn weaklist_offset() -> Option<isize>

    source§

    impl PyClassNewTextSignature<MarginAccount> for PyClassImplCollector<MarginAccount>

    source§

    fn new_text_signature(self) -> Option<&'static str>

    source§

    impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a MarginAccount

    §

    type Holder = Option<PyRef<'py, MarginAccount>>

    source§

    fn extract(obj: &'py PyAny, holder: &'a mut Self::Holder) -> PyResult<Self>

    source§

    impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a mut MarginAccount

    §

    type Holder = Option<PyRefMut<'py, MarginAccount>>

    source§

    fn extract(obj: &'py PyAny, holder: &'a mut Self::Holder) -> PyResult<Self>

    source§

    impl PyMethods<MarginAccount> for PyClassImplCollector<MarginAccount>

    source§

    fn py_methods(self) -> &'static PyClassItems

    source§

    impl PyTypeInfo for MarginAccount

    §

    type AsRefTarget = PyCell<MarginAccount>

    Utility type to make Py::as_ref work.
    source§

    const NAME: &'static str = "MarginAccount"

    Class name.
    source§

    const MODULE: Option<&'static str> = _

    Module name, if any.
    source§

    fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject

    Returns the PyTypeObject instance for this type.
    §

    fn type_object(py: Python<'_>) -> &PyType

    Returns the safe abstraction over the type object.
    §

    fn is_type_of(object: &PyAny) -> bool

    Checks if object is an instance of this type or a subclass of this type.
    §

    fn is_exact_type_of(object: &PyAny) -> bool

    Checks if object is an instance of this type.
    source§

    impl Eq for MarginAccount

    Auto Trait Implementations§

    §

    impl Freeze for MarginAccount

    §

    impl RefUnwindSafe for MarginAccount

    §

    impl Send for MarginAccount

    §

    impl Sync for MarginAccount

    §

    impl Unpin for MarginAccount

    §

    impl UnwindSafe for MarginAccount

    Blanket Implementations§

    source§

    impl<T> Any for T
    where +sufficient, and should not be overridden without very good reason.

    source§

    impl PyClass for MarginAccount

    §

    type Frozen = False

    Whether the pyclass is frozen. Read more
    source§

    impl PyClassImpl for MarginAccount

    source§

    const IS_BASETYPE: bool = false

    #[pyclass(subclass)]
    source§

    const IS_SUBCLASS: bool = false

    #[pyclass(extends=…)]
    source§

    const IS_MAPPING: bool = false

    #[pyclass(mapping)]
    source§

    const IS_SEQUENCE: bool = false

    #[pyclass(sequence)]
    §

    type BaseType = PyAny

    Base class
    §

    type ThreadChecker = SendablePyClass<MarginAccount>

    This handles following two situations: Read more
    §

    type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild

    Immutable or mutable
    §

    type Dict = PyClassDummySlot

    Specify this class has #[pyclass(dict)] or not.
    §

    type WeakRef = PyClassDummySlot

    Specify this class has #[pyclass(weakref)] or not.
    §

    type BaseNativeType = PyAny

    The closest native ancestor. This is PyAny by default, and when you declare +#[pyclass(extends=PyDict)], it’s PyDict.
    source§

    fn items_iter() -> PyClassItemsIter

    source§

    fn doc(py: Python<'_>) -> PyResult<&'static CStr>

    Rendered class doc
    source§

    fn lazy_type_object() -> &'static LazyTypeObject<Self>

    §

    fn dict_offset() -> Option<isize>

    §

    fn weaklist_offset() -> Option<isize>

    source§

    impl PyClassNewTextSignature<MarginAccount> for PyClassImplCollector<MarginAccount>

    source§

    fn new_text_signature(self) -> Option<&'static str>

    source§

    impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a MarginAccount

    §

    type Holder = Option<PyRef<'py, MarginAccount>>

    source§

    fn extract(obj: &'py PyAny, holder: &'a mut Self::Holder) -> PyResult<Self>

    source§

    impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a mut MarginAccount

    §

    type Holder = Option<PyRefMut<'py, MarginAccount>>

    source§

    fn extract(obj: &'py PyAny, holder: &'a mut Self::Holder) -> PyResult<Self>

    source§

    impl PyMethods<MarginAccount> for PyClassImplCollector<MarginAccount>

    source§

    fn py_methods(self) -> &'static PyClassItems

    source§

    impl PyTypeInfo for MarginAccount

    §

    type AsRefTarget = PyCell<MarginAccount>

    Utility type to make Py::as_ref work.
    source§

    const NAME: &'static str = "MarginAccount"

    Class name.
    source§

    const MODULE: Option<&'static str> = _

    Module name, if any.
    source§

    fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject

    Returns the PyTypeObject instance for this type.
    §

    fn type_object(py: Python<'_>) -> &PyType

    Returns the safe abstraction over the type object.
    §

    fn is_type_of(object: &PyAny) -> bool

    Checks if object is an instance of this type or a subclass of this type.
    §

    fn is_exact_type_of(object: &PyAny) -> bool

    Checks if object is an instance of this type.
    source§

    impl Eq for MarginAccount

    Auto Trait Implementations§

    §

    impl Freeze for MarginAccount

    §

    impl RefUnwindSafe for MarginAccount

    §

    impl Send for MarginAccount

    §

    impl Sync for MarginAccount

    §

    impl Unpin for MarginAccount

    §

    impl UnwindSafe for MarginAccount

    Blanket Implementations§

    source§

    impl<T> Any for T
    where T: 'static + ?Sized,

    source§

    fn type_id(&self) -> TypeId

    Gets the TypeId of self. Read more
    source§

    impl<T> Borrow<T> for T
    where T: ?Sized,

    source§

    fn borrow(&self) -> &T

    Immutably borrows from an owned value. Read more
    source§

    impl<T> BorrowMut<T> for T
    where T: ?Sized,

    source§

    fn borrow_mut(&mut self) -> &mut T

    Mutably borrows from an owned value. Read more
    §

    impl<Q, K> Equivalent<K> for Q
    where diff --git a/nightly/core/nautilus_accounting/account/trait.Account.html b/nightly/core/nautilus_accounting/account/trait.Account.html index 8bd6aba00a03..35a8321b0fd3 100644 --- a/nightly/core/nautilus_accounting/account/trait.Account.html +++ b/nightly/core/nautilus_accounting/account/trait.Account.html @@ -1,5 +1,5 @@ -Account in nautilus_accounting::account - Rust -
    pub trait Account {
    +Account in nautilus_accounting::account - Rust
    +    
    pub trait Account {
     
    Show 16 methods // Required methods fn balance_total(&self, currency: Option<Currency>) -> Option<Money>; fn balances_total(&self) -> HashMap<Currency, Money>; @@ -36,23 +36,23 @@ liquidity_side: LiquiditySide, use_quote_for_inverse: Option<bool> ) -> Result<Money>; -
    }

    Required Methods§

    source

    fn balance_total(&self, currency: Option<Currency>) -> Option<Money>

    source

    fn balances_total(&self) -> HashMap<Currency, Money>

    source

    fn balance_free(&self, currency: Option<Currency>) -> Option<Money>

    source

    fn balances_free(&self) -> HashMap<Currency, Money>

    source

    fn balance_locked(&self, currency: Option<Currency>) -> Option<Money>

    source

    fn balances_locked(&self) -> HashMap<Currency, Money>

    source

    fn last_event(&self) -> Option<AccountState>

    source

    fn events(&self) -> Vec<AccountState>

    source

    fn event_count(&self) -> usize

    source

    fn currencies(&self) -> Vec<Currency>

    source

    fn starting_balances(&self) -> HashMap<Currency, Money>

    source

    fn balances(&self) -> HashMap<Currency, AccountBalance>

    source

    fn apply(&mut self, event: AccountState)

    source

    fn calculate_balance_locked<T: Instrument>( +

    }

    Required Methods§

    source

    fn balance_total(&self, currency: Option<Currency>) -> Option<Money>

    source

    fn balances_total(&self) -> HashMap<Currency, Money>

    source

    fn balance_free(&self, currency: Option<Currency>) -> Option<Money>

    source

    fn balances_free(&self) -> HashMap<Currency, Money>

    source

    fn balance_locked(&self, currency: Option<Currency>) -> Option<Money>

    source

    fn balances_locked(&self) -> HashMap<Currency, Money>

    source

    fn last_event(&self) -> Option<AccountState>

    source

    fn events(&self) -> Vec<AccountState>

    source

    fn event_count(&self) -> usize

    source

    fn currencies(&self) -> Vec<Currency>

    source

    fn starting_balances(&self) -> HashMap<Currency, Money>

    source

    fn balances(&self) -> HashMap<Currency, AccountBalance>

    source

    fn apply(&mut self, event: AccountState)

    source

    fn calculate_balance_locked<T: Instrument>( &mut self, instrument: T, side: OrderSide, quantity: Quantity, price: Price, use_quote_for_inverse: Option<bool> -) -> Result<Money>

    source

    fn calculate_pnls<T: Instrument>( +) -> Result<Money>

    source

    fn calculate_pnls<T: Instrument>( &self, instrument: T, fill: OrderFilled, position: Option<Position> -) -> Result<Vec<Money>>

    source

    fn calculate_commission<T: Instrument>( +) -> Result<Vec<Money>>

    source

    fn calculate_commission<T: Instrument>( &self, instrument: T, last_qty: Quantity, last_px: Price, liquidity_side: LiquiditySide, use_quote_for_inverse: Option<bool> -) -> Result<Money>

    Object Safety§

    This trait is not object safe.

    Implementors§

    \ No newline at end of file +) -> Result<Money>

    Object Safety§

    This trait is not object safe.

    Implementors§

    \ No newline at end of file diff --git a/nightly/core/nautilus_accounting/all.html b/nightly/core/nautilus_accounting/all.html index 9e19da8570b2..6818f257c678 100644 --- a/nightly/core/nautilus_accounting/all.html +++ b/nightly/core/nautilus_accounting/all.html @@ -1,2 +1,2 @@ -List of all items in this crate +List of all items in this crate
    \ No newline at end of file diff --git a/nightly/core/nautilus_accounting/index.html b/nightly/core/nautilus_accounting/index.html index 18cdbc566407..5b9c51625d1e 100644 --- a/nightly/core/nautilus_accounting/index.html +++ b/nightly/core/nautilus_accounting/index.html @@ -1,3 +1,3 @@ -nautilus_accounting - Rust use std::collections::HashMap; -use anyhow::Result; use nautilus_model::{ enums::{AccountType, LiquiditySide, OrderSide}, events::{account::state::AccountState, order::filled::OrderFilled}, @@ -293,7 +291,7 @@

    Files

    } impl BaseAccount { - pub fn new(event: AccountState, calculate_account_state: bool) -> Result<Self> { + pub fn new(event: AccountState, calculate_account_state: bool) -> anyhow::Result<Self> { let mut balances_starting: HashMap<Currency, Money> = HashMap::new(); let mut balances: HashMap<Currency, AccountBalance> = HashMap::new(); event.balances.iter().for_each(|balance| { @@ -393,7 +391,7 @@

    Files

    quantity: Quantity, price: Price, use_quote_for_inverse: Option<bool>, - ) -> Result<Money> { + ) -> anyhow::Result<Money> { let base_currency = instrument .base_currency() .unwrap_or(instrument.quote_currency()); @@ -426,7 +424,7 @@

    Files

    instrument: T, fill: OrderFilled, position: Option<Position>, - ) -> Result<Vec<Money>> { + ) -> anyhow::Result<Vec<Money>> { let mut pnls: HashMap<Currency, Money> = HashMap::new(); let quote_currency = instrument.quote_currency(); let base_currency = instrument.base_currency(); @@ -470,7 +468,7 @@

    Files

    last_px: Price, liquidity_side: LiquiditySide, use_quote_for_inverse: Option<bool>, - ) -> Result<Money> { + ) -> anyhow::Result<Money> { assert!( liquidity_side != LiquiditySide::NoLiquiditySide, "Invalid liquidity side" diff --git a/nightly/core/src/nautilus_accounting/account/cash.rs.html b/nightly/core/src/nautilus_accounting/account/cash.rs.html index e337a1ad2b71..3ef0cd12fa70 100644 --- a/nightly/core/src/nautilus_accounting/account/cash.rs.html +++ b/nightly/core/src/nautilus_accounting/account/cash.rs.html @@ -1,4 +1,4 @@ -cash.rs - source 573 574 575 -576
    // -------------------------------------------------------------------------------------------------
     //  Copyright (C) 2015-2024 Nautech Systems Pty Ltd. All rights reserved.
     //  https://nautechsystems.io
    @@ -597,7 +596,6 @@ 

    Files

    ops::{Deref, DerefMut}, }; -use anyhow::Result; use nautilus_model::{ enums::{AccountType, LiquiditySide, OrderSide}, events::{account::state::AccountState, order::filled::OrderFilled}, @@ -620,7 +618,7 @@

    Files

    } impl CashAccount { - pub fn new(event: AccountState, calculate_account_state: bool) -> Result<Self> { + pub fn new(event: AccountState, calculate_account_state: bool) -> anyhow::Result<Self> { Ok(Self { base: BaseAccount::new(event, calculate_account_state)?, }) @@ -691,7 +689,7 @@

    Files

    quantity: Quantity, price: Price, use_quote_for_inverse: Option<bool>, - ) -> Result<Money> { + ) -> anyhow::Result<Money> { self.base_calculate_balance_locked(instrument, side, quantity, price, use_quote_for_inverse) } fn calculate_pnls<T: Instrument>( @@ -699,7 +697,7 @@

    Files

    instrument: T, fill: OrderFilled, position: Option<Position>, - ) -> Result<Vec<Money>> { + ) -> anyhow::Result<Vec<Money>> { self.base_calculate_pnls(instrument, fill, position) } fn calculate_commission<T: Instrument>( @@ -709,7 +707,7 @@

    Files

    last_px: Price, liquidity_side: LiquiditySide, use_quote_for_inverse: Option<bool>, - ) -> Result<Money> { + ) -> anyhow::Result<Money> { self.base_calculate_commission( instrument, last_qty, diff --git a/nightly/core/src/nautilus_accounting/account/margin.rs.html b/nightly/core/src/nautilus_accounting/account/margin.rs.html index c473980ef2a5..c649435891ab 100644 --- a/nightly/core/src/nautilus_accounting/account/margin.rs.html +++ b/nightly/core/src/nautilus_accounting/account/margin.rs.html @@ -1,4 +1,4 @@ -margin.rs - source 628 629 630 -631
    // -------------------------------------------------------------------------------------------------
     //  Copyright (C) 2015-2024 Nautech Systems Pty Ltd. All rights reserved.
     //  https://nautechsystems.io
    @@ -655,7 +654,6 @@ 

    Files

    ops::{Deref, DerefMut}, }; -use anyhow::Result; use nautilus_model::{ enums::{AccountType, LiquiditySide, OrderSide}, events::{account::state::AccountState, order::filled::OrderFilled}, @@ -687,7 +685,7 @@

    Files

    } impl MarginAccount { - pub fn new(event: AccountState, calculate_account_state: bool) -> Result<Self> { + pub fn new(event: AccountState, calculate_account_state: bool) -> anyhow::Result<Self> { Ok(Self { base: BaseAccount::new(event, calculate_account_state)?, leverages: HashMap::new(), @@ -955,7 +953,7 @@

    Files

    quantity: Quantity, price: Price, use_quote_for_inverse: Option<bool>, - ) -> Result<Money> { + ) -> anyhow::Result<Money> { self.base_calculate_balance_locked(instrument, side, quantity, price, use_quote_for_inverse) } fn calculate_pnls<T: Instrument>( @@ -963,7 +961,7 @@

    Files

    instrument: T, fill: OrderFilled, position: Option<Position>, - ) -> Result<Vec<Money>> { + ) -> anyhow::Result<Vec<Money>> { self.base_calculate_pnls(instrument, fill, position) } fn calculate_commission<T: Instrument>( @@ -973,7 +971,7 @@

    Files

    last_px: Price, liquidity_side: LiquiditySide, use_quote_for_inverse: Option<bool>, - ) -> Result<Money> { + ) -> anyhow::Result<Money> { self.base_calculate_commission( instrument, last_qty, diff --git a/nightly/core/src/nautilus_accounting/account/mod.rs.html b/nightly/core/src/nautilus_accounting/account/mod.rs.html index 6f2927e4528a..004465d39573 100644 --- a/nightly/core/src/nautilus_accounting/account/mod.rs.html +++ b/nightly/core/src/nautilus_accounting/account/mod.rs.html @@ -1,4 +1,4 @@ -mod.rs - source 72 73 74 -75
    // -------------------------------------------------------------------------------------------------
     //  Copyright (C) 2015-2024 Nautech Systems Pty Ltd. All rights reserved.
     //  https://nautechsystems.io
    @@ -92,7 +91,6 @@ 

    Files

    use std::collections::HashMap; -use anyhow::Result; use nautilus_model::{ enums::{LiquiditySide, OrderSide}, events::{account::state::AccountState, order::filled::OrderFilled}, @@ -125,14 +123,14 @@

    Files

    quantity: Quantity, price: Price, use_quote_for_inverse: Option<bool>, - ) -> Result<Money>; + ) -> anyhow::Result<Money>; fn calculate_pnls<T: Instrument>( &self, instrument: T, fill: OrderFilled, position: Option<Position>, - ) -> Result<Vec<Money>>; + ) -> anyhow::Result<Vec<Money>>; fn calculate_commission<T: Instrument>( &self, @@ -141,7 +139,7 @@

    Files

    last_px: Price, liquidity_side: LiquiditySide, use_quote_for_inverse: Option<bool>, - ) -> Result<Money>; + ) -> anyhow::Result<Money>; } pub mod base; diff --git a/nightly/core/src/nautilus_accounting/lib.rs.html b/nightly/core/src/nautilus_accounting/lib.rs.html index 28467f03395a..5db560931cb2 100644 --- a/nightly/core/src/nautilus_accounting/lib.rs.html +++ b/nightly/core/src/nautilus_accounting/lib.rs.html @@ -1,4 +1,4 @@ -lib.rs - source /// # Safety /// /// - Assumes `ptr` is a valid C string pointer. -pub unsafe fn raw_ptr_to_string(ptr: *const c_char) -> Result<String> { +pub unsafe fn raw_ptr_to_string(ptr: *const c_char) -> anyhow::Result<String> { let c_str: &CStr = unsafe { CStr::from_ptr(ptr) }; - let str_slice: &str = c_str.to_str().map_err(|e| anyhow!(e))?; + let str_slice: &str = c_str.to_str().map_err(|e| anyhow::anyhow!(e))?; Ok(str_slice.to_owned()) } /// # Safety /// /// - Assumes `ptr` is a valid C string pointer. -pub unsafe fn raw_ptr_to_ustr(ptr: *const c_char) -> Result<Ustr> { +pub unsafe fn raw_ptr_to_ustr(ptr: *const c_char) -> anyhow::Result<Ustr> { let c_str: &CStr = unsafe { CStr::from_ptr(ptr) }; - let str_slice: &str = c_str.to_str().map_err(|e| anyhow!(e))?; + let str_slice: &str = c_str.to_str().map_err(|e| anyhow::anyhow!(e))?; Ok(Ustr::from(str_slice)) } @@ -1205,6 +1225,8 @@

    Files

    None, // TBD None, // TBD None, // TBD + None, // TBD + None, // TBD msg.ts_recv, // More accurate and reliable timestamp ts_init, ) @@ -1240,6 +1262,8 @@

    Files

    None, // TBD None, // TBD None, // TBD + None, // TBD + None, // TBD msg.ts_recv, // More accurate and reliable timestamp ts_init, ) @@ -1282,7 +1306,9 @@

    Files

    None, // TBD None, // TBD None, // TBD - msg.ts_recv, // More accurate and reliable timestamp + None, + None, + msg.ts_recv, // More accurate and reliable timestamp ts_init, ) } @@ -1324,6 +1350,8 @@

    Files

    None, // TBD None, // TBD None, // TBD + None, // TBD + None, // TBD msg.ts_recv, // More accurate and reliable timestamp ts_init, ) @@ -1506,7 +1534,7 @@

    Files

    // ohlcv-1d BarType::new(instrument_id, BAR_SPEC_1D, AggregationSource::External) } - _ => bail!( + _ => anyhow::bail!( "`rtype` is not a supported bar aggregation, was {}", msg.hd.rtype ), @@ -1533,7 +1561,7 @@

    Files

    // ohlcv-1d BAR_CLOSE_ADJUSTMENT_1D } - _ => bail!( + _ => anyhow::bail!( "`rtype` is not a supported bar aggregation, was {}", msg.hd.rtype ), @@ -1583,7 +1611,7 @@

    Files

    (Some(delta), None) => (Some(Data::Delta(delta)), None), (None, Some(trade)) => (Some(Data::Trade(trade)), None), (None, None) => (None, None), - _ => bail!("Invalid `MboMsg` parsing combination"), + _ => anyhow::bail!("Invalid `MboMsg` parsing combination"), } } else if let Some(msg) = record.get::<dbn::TradeMsg>() { let ts_init = determine_timestamp(ts_init, msg.ts_recv); @@ -1605,7 +1633,7 @@

    Files

    let bar = decode_ohlcv_msg(msg, instrument_id, price_precision, ts_init)?; (Some(Data::Bar(bar)), None) } else { - bail!("DBN message type is not currently supported") + anyhow::bail!("DBN message type is not currently supported") }; Ok(result) @@ -1649,9 +1677,9 @@

    Files

    instrument_id, ts_init, )?)), - 'B' => bail!("Unsupported `instrument_class` 'B' (BOND)"), - 'X' => bail!("Unsupported `instrument_class` 'X' (FX_SPOT)"), - _ => bail!( + 'B' => anyhow::bail!("Unsupported `instrument_class` 'B' (Bond)"), + 'X' => anyhow::bail!("Unsupported `instrument_class` 'X' (FX spot)"), + _ => anyhow::bail!( "Unsupported `instrument_class` '{}'", msg.instrument_class as u8 as char ), @@ -1689,9 +1717,9 @@

    Files

    instrument_id, ts_init, )?)), - 'B' => bail!("Unsupported `instrument_class` 'B' (BOND)"), - 'X' => bail!("Unsupported `instrument_class` 'X' (FX_SPOT)"), - _ => bail!( + 'B' => anyhow::bail!("Unsupported `instrument_class` 'B' (Bond)"), + 'X' => anyhow::bail!("Unsupported `instrument_class` 'X' (FX spot)"), + _ => anyhow::bail!( "Unsupported `instrument_class` '{}'", msg.instrument_class as u8 as char ), @@ -1750,11 +1778,13 @@

    Files

    decode_price(msg.min_price_increment, currency.precision)?, Quantity::new(1.0, 0)?, // TBD Quantity::new(1.0, 0)?, // TBD - None, // TBD - None, // TBD - None, // TBD - None, // TBD - msg.ts_recv, // More accurate and reliable timestamp + None, + None, // TBD + None, // TBD + None, // TBD + None, // TBD + None, // TBD + msg.ts_recv, // More accurate and reliable timestamp ts_init, ) } @@ -1789,6 +1819,8 @@

    Files

    None, // TBD None, // TBD None, // TBD + None, // TBD + None, // TBD msg.ts_recv, // More accurate and reliable timestamp ts_init, ) @@ -1831,6 +1863,8 @@

    Files

    None, // TBD None, // TBD None, // TBD + None, // TBD + None, // TBD msg.ts_recv, // More accurate and reliable timestamp ts_init, ) @@ -1873,6 +1907,8 @@

    Files

    None, // TBD None, // TBD None, // TBD + None, // TBD + None, // TBD msg.ts_recv, // More accurate and reliable timestamp ts_init, ) diff --git a/nightly/core/src/nautilus_adapters/databento/enums.rs.html b/nightly/core/src/nautilus_adapters/databento/enums.rs.html index ea979336c204..7f8b47b240d5 100644 --- a/nightly/core/src/nautilus_adapters/databento/enums.rs.html +++ b/nightly/core/src/nautilus_adapters/databento/enums.rs.html @@ -1,4 +1,4 @@ -enums.rs - source } /// Run the feed handler to begin listening for commands and processing messages. - pub async fn run(&mut self) -> Result<()> { + pub async fn run(&mut self) -> anyhow::Result<()> { debug!("Running feed handler"); let clock = get_atomic_clock_realtime(); let mut symbol_map = PitSymbolMap::new(); @@ -580,7 +580,7 @@

    Files

    Err(_) => { self.msg_tx.send(LiveMessage::Close).await?; self.cmd_rx.close(); - return Err(anyhow!("Timeout connecting to LSG")); + return Err(anyhow::anyhow!("Timeout connecting to LSG")); } }; @@ -649,7 +649,7 @@

    Files

    Err(e) => { // Fail the session entirely for now. Consider refining // this strategy to handle specific errors more gracefully. - self.send_msg(LiveMessage::Error(anyhow!(e))).await; + self.send_msg(LiveMessage::Error(anyhow::anyhow!(e))).await; break; } }; @@ -825,7 +825,7 @@

    Files

    msg: &dbn::InstrumentDefMsg, publisher_venue_map: &IndexMap<PublisherId, Venue>, clock: &AtomicTime, -) -> Result<InstrumentType> { +) -> anyhow::Result<InstrumentType> { let c_str: &CStr = unsafe { CStr::from_ptr(msg.raw_symbol.as_ptr()) }; let raw_symbol: &str = c_str.to_str().map_err(to_pyvalue_err)?; diff --git a/nightly/core/src/nautilus_adapters/databento/loader.rs.html b/nightly/core/src/nautilus_adapters/databento/loader.rs.html index 4bdea011a2b0..bedc4d997ed1 100644 --- a/nightly/core/src/nautilus_adapters/databento/loader.rs.html +++ b/nightly/core/src/nautilus_adapters/databento/loader.rs.html @@ -1,4 +1,4 @@ -loader.rs - source use std::{env, fs, path::PathBuf}; -use anyhow::Result; +use databento::dbn; use dbn::{ compat::InstrumentDefMsgV1, decode::{dbn::Decoder, DbnMetadata, DecodeStream}, @@ -371,7 +371,7 @@

    Files

    /// - STATISTICS -> `DatabentoStatistics` /// /// # References -/// <https://docs.databento.com/knowledge-base/new-users/dbn-encoding> +/// <https://databento.com/docs/knowledge-base/new-users/dbn-encoding> #[cfg_attr( feature = "python", pyo3::pyclass(module = "nautilus_trader.core.nautilus_pyo3.databento") @@ -383,7 +383,7 @@

    Files

    } impl DatabentoDataLoader { - pub fn new(path: Option<PathBuf>) -> Result<Self> { + pub fn new(path: Option<PathBuf>) -> anyhow::Result<Self> { let mut loader = Self { publishers_map: IndexMap::new(), venue_dataset_map: IndexMap::new(), @@ -408,7 +408,7 @@

    Files

    } /// Load the publishers data from the file at the given `path`. - pub fn load_publishers(&mut self, path: PathBuf) -> Result<()> { +
    pub fn load_publishers(&mut self, path: PathBuf) -> anyhow::Result<()> { let file_content = fs::read_to_string(path)?; let publishers: Vec<DatabentoPublisher> = serde_json::from_str(&file_content)?; @@ -454,7 +454,7 @@

    Files

    self.publisher_venue_map.get(&publisher_id) } - pub fn schema_from_file(&self, path: PathBuf) -> Result<Option<String>> { + pub fn schema_from_file(&self, path: PathBuf) -> anyhow::Result<Option<String>> { let decoder = Decoder::from_zstd_file(path)?; let metadata = decoder.metadata(); Ok(metadata.schema.map(|schema| schema.to_string())) @@ -463,7 +463,7 @@

    Files

    pub fn read_definition_records( &mut self, path: PathBuf, - ) -> Result<impl Iterator<Item = Result<InstrumentType>> + '_> { + ) -> anyhow::Result<impl Iterator<Item = anyhow::Result<InstrumentType>> + '_> { let mut decoder = Decoder::from_zstd_file(path)?; decoder.set_upgrade_policy(dbn::VersionUpgradePolicy::Upgrade); let mut dbn_stream = decoder.decode_stream::<InstrumentDefMsgV1>(); @@ -503,7 +503,7 @@

    Files

    path: PathBuf, instrument_id: Option<InstrumentId>, include_trades: bool, - ) -> Result<impl Iterator<Item = Result<(Option<Data>, Option<Data>)>> + '_> + ) -> anyhow::Result<impl Iterator<Item = anyhow::Result<(Option<Data>, Option<Data>)>> + '_> where T: dbn::Record + dbn::HasRType + 'static, { @@ -548,7 +548,7 @@

    Files

    &self, path: PathBuf, instrument_id: Option<InstrumentId>, - ) -> Result<impl Iterator<Item = Result<DatabentoImbalance>> + '_> + ) -> anyhow::Result<impl Iterator<Item = anyhow::Result<DatabentoImbalance>> + '_> where T: dbn::Record + dbn::HasRType + 'static, { @@ -590,7 +590,7 @@

    Files

    &self, path: PathBuf, instrument_id: Option<InstrumentId>, - ) -> Result<impl Iterator<Item = Result<DatabentoStatistics>> + '_> + ) -> anyhow::Result<impl Iterator<Item = anyhow::Result<DatabentoStatistics>> + '_> where T: dbn::Record + dbn::HasRType + 'static, { diff --git a/nightly/core/src/nautilus_adapters/databento/mod.rs.html b/nightly/core/src/nautilus_adapters/databento/mod.rs.html index db934c9268ec..6ce5cccbba58 100644 --- a/nightly/core/src/nautilus_adapters/databento/mod.rs.html +++ b/nightly/core/src/nautilus_adapters/databento/mod.rs.html @@ -1,4 +1,4 @@ -mod.rs - source // limitations under the License. // ------------------------------------------------------------------------------------------------- -pub mod decode; -pub mod enums; +pub mod enums; pub mod historical; pub mod live; pub mod loader; @@ -80,14 +70,6 @@

    Files

    m.add_class::<super::loader::DatabentoDataLoader>()?; m.add_class::<live::DatabentoLiveClient>()?; m.add_class::<historical::DatabentoHistoricalClient>()?; - m.add_function(wrap_pyfunction!(decode::py_decode_equity, m)?)?; - m.add_function(wrap_pyfunction!(decode::py_decode_futures_contract, m)?)?; - m.add_function(wrap_pyfunction!(decode::py_decode_options_contract, m)?)?; - m.add_function(wrap_pyfunction!(decode::py_decode_mbo_msg, m)?)?; - m.add_function(wrap_pyfunction!(decode::py_decode_trade_msg, m)?)?; - m.add_function(wrap_pyfunction!(decode::py_decode_mbp1_msg, m)?)?; - m.add_function(wrap_pyfunction!(decode::py_decode_mbp10_msg, m)?)?; - Ok(()) }
    \ No newline at end of file diff --git a/nightly/core/src/nautilus_adapters/databento/python/types.rs.html b/nightly/core/src/nautilus_adapters/databento/python/types.rs.html index 6a9686a402e7..5026faab86db 100644 --- a/nightly/core/src/nautilus_adapters/databento/python/types.rs.html +++ b/nightly/core/src/nautilus_adapters/databento/python/types.rs.html @@ -1,4 +1,4 @@ -types.rs - source record: &dbn::RecordRef, metadata: &dbn::Metadata, publisher_venue_map: &IndexMap<PublisherId, Venue>, -) -> Result<InstrumentId> { +) -> anyhow::Result<InstrumentId> { let publisher = record.publisher().expect("Invalid `publisher` for record"); let publisher_id = publisher as PublisherId; let venue = publisher_venue_map .get(&publisher_id) - .ok_or_else(|| anyhow!("`Venue` not found for `publisher_id` {publisher_id}"))?; + .ok_or_else(|| anyhow::anyhow!("`Venue` not found for `publisher_id` {publisher_id}"))?; let instrument_id = get_nautilus_instrument_id_for_record(record, metadata, *venue)?; Ok(instrument_id) @@ -115,7 +115,7 @@

    Files

    record: &dbn::RecordRef, metadata: &dbn::Metadata, venue: Venue, -) -> Result<InstrumentId> { +) -> anyhow::Result<InstrumentId> { let (instrument_id, nanoseconds) = if let Some(msg) = record.get::<dbn::MboMsg>() { (msg.hd.instrument_id, msg.ts_recv) } else if let Some(msg) = record.get::<dbn::TradeMsg>() { @@ -131,7 +131,7 @@

    Files

    } else if let Some(msg) = record.get::<dbn::StatMsg>() { (msg.hd.instrument_id, msg.ts_recv) } else { - bail!("DBN message type is not currently supported") + anyhow::bail!("DBN message type is not currently supported") }; let duration = time::Duration::nanoseconds(nanoseconds as i64); @@ -142,7 +142,7 @@

    Files

    let symbol_map = metadata.symbol_map_for_date(date)?; let raw_symbol = symbol_map .get(instrument_id) - .ok_or_else(|| anyhow!("No raw symbol found for {instrument_id}"))?; + .ok_or_else(|| anyhow::anyhow!("No raw symbol found for {instrument_id}"))?; let symbol = Symbol::from_str_unchecked(raw_symbol); diff --git a/nightly/core/src/nautilus_adapters/databento/types.rs.html b/nightly/core/src/nautilus_adapters/databento/types.rs.html index 7d9488b3859a..c83f0648a94d 100644 --- a/nightly/core/src/nautilus_adapters/databento/types.rs.html +++ b/nightly/core/src/nautilus_adapters/databento/types.rs.html @@ -1,4 +1,4 @@ -types.rs - source 186 187 188 +189
    // -------------------------------------------------------------------------------------------------
     //  Copyright (C) 2015-2024 Nautech Systems Pty Ltd. All rights reserved.
     //  https://nautechsystems.io
    @@ -205,6 +206,7 @@ 

    Files

    use std::ffi::c_char; +use databento::dbn; use nautilus_core::time::UnixNanos; use nautilus_model::{ enums::OrderSide, diff --git a/nightly/core/src/nautilus_adapters/lib.rs.html b/nightly/core/src/nautilus_adapters/lib.rs.html index 55452ba3b67b..56228f836f5d 100644 --- a/nightly/core/src/nautilus_adapters/lib.rs.html +++ b/nightly/core/src/nautilus_adapters/lib.rs.html @@ -1,4 +1,4 @@ -lib.rs - source stop_time_ns: Option<UnixNanos>, callback: Option<EventHandler>, ) { - check_valid_string(name, "`Timer` name").unwrap(); + check_valid_string(name, stringify!(name)).unwrap(); assert!( callback.is_some() | self.default_callback.is_some(), "All Python callbacks were `None`" diff --git a/nightly/core/src/nautilus_common/enums.rs.html b/nightly/core/src/nautilus_common/enums.rs.html index 6dfe6f8cff50..c2e54d941ee6 100644 --- a/nightly/core/src/nautilus_common/enums.rs.html +++ b/nightly/core/src/nautilus_common/enums.rs.html @@ -1,4 +1,4 @@ -enums.rs - source logging_set_bypass(); } - logging::init_logging(trader_id, instance_id, config, file_config); -} + LogGuard_API(Box::new(logging::init_logging( + trader_id, + instance_id, + config, + file_config, + ))) + // logging::init_logging(trader_id, instance_id, config, file_config); +} /// Creates a new log event. /// @@ -285,9 +355,9 @@

    Files

    headers::log_sysinfo(component) } -/// Flushes global logger buffers. +/// Flushes global logger buffers of any records. #[no_mangle] -pub extern "C" fn logger_flush() { - log::logger().flush() +pub extern "C" fn logger_drop(log_guard: LogGuard_API) { + drop(log_guard) }
    \ No newline at end of file diff --git a/nightly/core/src/nautilus_common/ffi/mod.rs.html b/nightly/core/src/nautilus_common/ffi/mod.rs.html index 6279009d758f..fdca37ebb8fe 100644 --- a/nightly/core/src/nautilus_common/ffi/mod.rs.html +++ b/nightly/core/src/nautilus_common/ffi/mod.rs.html @@ -1,4 +1,4 @@ -mod.rs - source ..Default::default() }; - Logger::init_with_config( + let log_guard = Logger::init_with_config( TraderId::from("TRADER-001"), UUID4::new(), config, @@ -1384,7 +1460,9 @@

    Files

    Duration::from_secs(2), ); - assert_eq!( + drop(log_guard); // Ensure log buffers are flushed + + assert_eq!( log_contents, "{\"timestamp\":\"1970-01-20T02:20:00.000000000Z\",\"trader_id\":\"TRADER-001\",\"level\":\"INFO\",\"color\":\"NORMAL\",\"component\":\"RiskEngine\",\"message\":\"This is a test.\"}\n" ); diff --git a/nightly/core/src/nautilus_common/logging/mod.rs.html b/nightly/core/src/nautilus_common/logging/mod.rs.html index 134e05661c38..0f68ec805270 100644 --- a/nightly/core/src/nautilus_common/logging/mod.rs.html +++ b/nightly/core/src/nautilus_common/logging/mod.rs.html @@ -1,4 +1,4 @@ -mod.rs - source use ustr::Ustr; use self::{ - logger::{Logger, LoggerConfig}, + logger::{LogGuard, Logger, LoggerConfig}, writer::FileWriterConfig, }; use crate::enums::LogLevel; @@ -277,10 +277,10 @@

    Files

    instance_id: UUID4, config: LoggerConfig, file_config: FileWriterConfig, -) { +) -> LogGuard { LOGGING_INITIALIZED.store(true, Ordering::Relaxed); LOGGING_COLORED.store(config.is_colored, Ordering::Relaxed); - Logger::init_with_config(trader_id, instance_id, config, file_config); + Logger::init_with_config(trader_id, instance_id, config, file_config) } pub fn map_log_level_to_filter(log_level: LogLevel) -> LevelFilter { diff --git a/nightly/core/src/nautilus_common/logging/writer.rs.html b/nightly/core/src/nautilus_common/logging/writer.rs.html index 88937b85e530..0637a9af9182 100644 --- a/nightly/core/src/nautilus_common/logging/writer.rs.html +++ b/nightly/core/src/nautilus_common/logging/writer.rs.html @@ -1,4 +1,4 @@ -writer.rs - source use pyo3::prelude::*; -use crate::logging::{logger::LoggerConfig, writer::FileWriterConfig}; - /// Loaded as nautilus_pyo3.common #[pymodule] pub fn common(_: Python<'_>, m: &PyModule) -> PyResult<()> { @@ -76,8 +73,9 @@

    Files

    m.add_class::<crate::enums::LogColor>()?; m.add_class::<crate::enums::LogLevel>()?; m.add_class::<crate::enums::LogFormat>()?; - m.add_class::<LoggerConfig>()?; - m.add_class::<FileWriterConfig>()?; + m.add_class::<crate::logging::logger::LoggerConfig>()?; + m.add_class::<crate::logging::logger::LogGuard>()?; + m.add_class::<crate::logging::writer::FileWriterConfig>()?; m.add_function(wrap_pyfunction!(logging::py_init_tracing, m)?)?; m.add_function(wrap_pyfunction!(logging::py_init_logging, m)?)?; m.add_function(wrap_pyfunction!(logging::py_logger_log, m)?)?; diff --git a/nightly/core/src/nautilus_common/python/timer.rs.html b/nightly/core/src/nautilus_common/python/timer.rs.html index c936bcfbaf01..c1bdf8711b57 100644 --- a/nightly/core/src/nautilus_common/python/timer.rs.html +++ b/nightly/core/src/nautilus_common/python/timer.rs.html @@ -1,4 +1,4 @@ -timer.rs - source #[case] lhs_param: &str, #[case] rhs_param: &str, ) { - assert!(check_u8_equal(lhs, rhs, lhs_param, rhs_param).is_ok()); + assert!(check_equal_u8(lhs, rhs, lhs_param, rhs_param).is_ok()); } #[rstest] @@ -439,7 +525,7 @@

    Files

    #[case] r: u8, #[case] desc: &str, ) { - assert!(check_u8_in_range_inclusive(value, l, r, desc).is_err()); + assert!(check_in_range_inclusive_u8(value, l, r, desc).is_err()); } #[rstest] @@ -452,7 +538,7 @@

    Files

    #[case] r: u64, #[case] desc: &str, ) { - assert!(check_u64_in_range_inclusive(value, l, r, desc).is_ok()); + assert!(check_in_range_inclusive_u64(value, l, r, desc).is_ok()); } #[rstest] @@ -464,7 +550,7 @@

    Files

    #[case] r: u64, #[case] desc: &str, ) { - assert!(check_u64_in_range_inclusive(value, l, r, desc).is_err()); + assert!(check_in_range_inclusive_u64(value, l, r, desc).is_err()); } #[rstest] @@ -477,7 +563,7 @@

    Files

    #[case] r: i64, #[case] desc: &str, ) { - assert!(check_i64_in_range_inclusive(value, l, r, desc).is_ok()); + assert!(check_in_range_inclusive_i64(value, l, r, desc).is_ok()); } #[rstest] @@ -489,14 +575,14 @@

    Files

    #[case] r: i64, #[case] desc: &str, ) { - assert!(check_i64_in_range_inclusive(value, l, r, desc).is_err()); + assert!(check_in_range_inclusive_i64(value, l, r, desc).is_err()); } #[rstest] #[case(0.0, "value")] #[case(1.0, "value")] fn test_f64_non_negative_when_valid_values(#[case] value: f64, #[case] desc: &str) { - assert!(check_f64_non_negative(value, desc).is_ok()); + assert!(check_non_negative_f64(value, desc).is_ok()); } #[rstest] @@ -505,7 +591,7 @@

    Files

    #[case(f64::NEG_INFINITY, "value")] #[case(-0.1, "value")]
    fn test_f64_non_negative_when_invalid_values(#[case] value: f64, #[case] desc: &str) { - assert!(check_f64_non_negative(value, desc).is_err()); + assert!(check_non_negative_f64(value, desc).is_err()); } }
    \ No newline at end of file diff --git a/nightly/core/src/nautilus_core/datetime.rs.html b/nightly/core/src/nautilus_core/datetime.rs.html index 97bbcfaa1ac3..3806ba42cfcd 100644 --- a/nightly/core/src/nautilus_core/datetime.rs.html +++ b/nightly/core/src/nautilus_core/datetime.rs.html @@ -1,4 +1,4 @@ -datetime.rs - source
    use std::time::{Duration, UNIX_EPOCH}; -use anyhow::{anyhow, Result}; use chrono::{ prelude::{DateTime, Utc}, Datelike, NaiveDate, SecondsFormat, TimeDelta, Weekday, @@ -365,8 +364,9 @@

    Files

    dt.to_rfc3339_opts(SecondsFormat::Nanos, true) } -pub fn last_weekday_nanos(year: i32, month: u32, day: u32) -> Result<UnixNanos> { - let date = NaiveDate::from_ymd_opt(year, month, day).ok_or_else(|| anyhow!("Invalid date"))?; +pub fn last_weekday_nanos(year: i32, month: u32, day: u32) -> anyhow::Result<UnixNanos> { + let date = + NaiveDate::from_ymd_opt(year, month, day).ok_or_else(|| anyhow::anyhow!("Invalid date"))?; let current_weekday = date.weekday().number_from_monday(); // Calculate the offset in days for closest weekday (Mon-Fri) @@ -382,19 +382,19 @@

    Files

    // Convert to UNIX nanoseconds let unix_timestamp_ns = last_closest .and_hms_nano_opt(0, 0, 0, 0) - .ok_or_else(|| anyhow!("Failed `and_hms_nano_opt`"))?; + .ok_or_else(|| anyhow::anyhow!("Failed `and_hms_nano_opt`"))?; Ok(unix_timestamp_ns .and_utc() .timestamp_nanos_opt() - .ok_or_else(|| anyhow!("Failed `timestamp_nanos_opt`"))? as UnixNanos) + .ok_or_else(|| anyhow::anyhow!("Failed `timestamp_nanos_opt`"))? as UnixNanos) } -pub fn is_within_last_24_hours(timestamp_ns: UnixNanos) -> Result<bool> { +pub fn is_within_last_24_hours(timestamp_ns: UnixNanos) -> anyhow::Result<bool> { let seconds = timestamp_ns / NANOSECONDS_IN_SECOND; let nanoseconds = (timestamp_ns % NANOSECONDS_IN_SECOND) as u32; let timestamp = DateTime::from_timestamp(seconds as i64, nanoseconds) - .ok_or_else(|| anyhow!("Invalid timestamp {timestamp_ns}"))?; + .ok_or_else(|| anyhow::anyhow!("Invalid timestamp {timestamp_ns}"))?; let now = Utc::now(); Ok(now.signed_duration_since(timestamp) <= TimeDelta::try_days(1).unwrap()) diff --git a/nightly/core/src/nautilus_core/ffi/cvec.rs.html b/nightly/core/src/nautilus_core/ffi/cvec.rs.html index 01d226dbcdbb..81b31a7b2e1c 100644 --- a/nightly/core/src/nautilus_core/ffi/cvec.rs.html +++ b/nightly/core/src/nautilus_core/ffi/cvec.rs.html @@ -1,4 +1,4 @@ -cvec.rs - source
    use std::fmt::{Display, Formatter}; -use anyhow::Result; use nautilus_model::{ data::{bar::Bar, quote::QuoteTick, trade::TradeTick}, enums::PriceType, @@ -357,7 +355,7 @@

    Files

    } impl HullMovingAverage { - pub fn new(period: usize, price_type: Option<PriceType>) -> Result<Self> { + pub fn new(period: usize, price_type: Option<PriceType>) -> anyhow::Result<Self> { let period_halved = period / 2; let period_sqrt = (period as f64).sqrt() as usize; diff --git a/nightly/core/src/nautilus_indicators/average/mod.rs.html b/nightly/core/src/nautilus_indicators/average/mod.rs.html index 76fbfad22d34..f41ad5e386c0 100644 --- a/nightly/core/src/nautilus_indicators/average/mod.rs.html +++ b/nightly/core/src/nautilus_indicators/average/mod.rs.html @@ -1,4 +1,4 @@ -mod.rs - source use std::fmt::Display; -use anyhow::Result; use nautilus_model::{ data::{bar::Bar, quote::QuoteTick, trade::TradeTick}, enums::PriceType, @@ -310,7 +308,7 @@

    Files

    } impl WilderMovingAverage { - pub fn new(period: usize, price_type: Option<PriceType>) -> Result<Self> { + pub fn new(period: usize, price_type: Option<PriceType>) -> anyhow::Result<Self> { // Inputs don't require validation, however we return a `Result` // to standardize with other indicators which do need validation. // The Wilder Moving Average is The Wilder's Moving Average is simply diff --git a/nightly/core/src/nautilus_indicators/average/sma.rs.html b/nightly/core/src/nautilus_indicators/average/sma.rs.html index 795d445f9785..9f06c07026c5 100644 --- a/nightly/core/src/nautilus_indicators/average/sma.rs.html +++ b/nightly/core/src/nautilus_indicators/average/sma.rs.html @@ -1,4 +1,4 @@ -sma.rs - source 201 202 203 -204
    // -------------------------------------------------------------------------------------------------
     //  Copyright (C) 2015-2024 Nautech Systems Pty Ltd. All rights reserved.
     //  https://nautechsystems.io
    @@ -221,7 +220,6 @@ 

    Files

    use std::fmt::Display; -use anyhow::Result; use nautilus_model::{ data::{bar::Bar, quote::QuoteTick, trade::TradeTick}, enums::PriceType, @@ -284,7 +282,7 @@

    Files

    } impl SimpleMovingAverage { - pub fn new(period: usize, price_type: Option<PriceType>) -> Result<Self> { + pub fn new(period: usize, price_type: Option<PriceType>) -> anyhow::Result<Self> { // Inputs don't require validation, however we return a `Result` // to standardize with other indicators which do need validation. Ok(Self { diff --git a/nightly/core/src/nautilus_indicators/average/vidya.rs.html b/nightly/core/src/nautilus_indicators/average/vidya.rs.html index 4a4036e782c7..685ac3d4b60c 100644 --- a/nightly/core/src/nautilus_indicators/average/vidya.rs.html +++ b/nightly/core/src/nautilus_indicators/average/vidya.rs.html @@ -1,4 +1,4 @@ -vidya.rs - source 234 235 236 -237
    // -------------------------------------------------------------------------------------------------
     //  Copyright (C) 2015-2024 Nautech Systems Pty Ltd. All rights reserved.
     //  https://nautechsystems.io
    @@ -254,7 +253,6 @@ 

    Files

    use std::fmt::{Display, Formatter}; -use anyhow::Result; use nautilus_model::{ data::{bar::Bar, quote::QuoteTick, trade::TradeTick}, enums::PriceType, @@ -330,7 +328,7 @@

    Files

    period: usize, price_type: Option<PriceType>, cmo_ma_type: Option<MovingAverageType>, - ) -> Result<Self> { + ) -> anyhow::Result<Self> { Ok(Self { period, price_type: price_type.unwrap_or(PriceType::Last), diff --git a/nightly/core/src/nautilus_indicators/average/wma.rs.html b/nightly/core/src/nautilus_indicators/average/wma.rs.html index 4bd1d59eb47d..9a999d0fc65b 100644 --- a/nightly/core/src/nautilus_indicators/average/wma.rs.html +++ b/nightly/core/src/nautilus_indicators/average/wma.rs.html @@ -1,4 +1,4 @@ -wma.rs - source 238 239 240 +241 +242 +243
    // -------------------------------------------------------------------------------------------------
     //  Copyright (C) 2015-2024 Nautech Systems Pty Ltd. All rights reserved.
     //  https://nautechsystems.io
    @@ -257,7 +260,6 @@ 

    Files

    use std::fmt::Display; -use anyhow::Result; use nautilus_model::{ data::{bar::Bar, quote::QuoteTick, trade::TradeTick}, enums::PriceType, @@ -295,7 +297,11 @@

    Files

    } impl WeightedMovingAverage { - pub fn new(period: usize, weights: Vec<f64>, price_type: Option<PriceType>) -> Result<Self> { + pub fn new( + period: usize, + weights: Vec<f64>, + price_type: Option<PriceType>, + ) -> anyhow::Result<Self> { if weights.len() != period { return Err(anyhow::anyhow!("Weights length must be equal to period")); } diff --git a/nightly/core/src/nautilus_indicators/book/imbalance.rs.html b/nightly/core/src/nautilus_indicators/book/imbalance.rs.html index b0f83b7b0986..0af7f57586e3 100644 --- a/nightly/core/src/nautilus_indicators/book/imbalance.rs.html +++ b/nightly/core/src/nautilus_indicators/book/imbalance.rs.html @@ -1,4 +1,4 @@ -imbalance.rs - source 221 222 223 -224
    // -------------------------------------------------------------------------------------------------
     //  Copyright (C) 2015-2024 Nautech Systems Pty Ltd. All rights reserved.
     //  https://nautechsystems.io
    @@ -241,7 +240,6 @@ 

    Files

    use std::fmt::Display; -use anyhow::Result; use nautilus_model::{ orderbook::{book_mbo::OrderBookMbo, book_mbp::OrderBookMbp}, types::quantity::Quantity, @@ -298,7 +296,7 @@

    Files

    } impl BookImbalanceRatio { - pub fn new() -> Result<Self> { + pub fn new() -> anyhow::Result<Self> { // Inputs don't require validation, however we return a `Result` // to standardize with other indicators which do need validation. Ok(Self { diff --git a/nightly/core/src/nautilus_indicators/book/mod.rs.html b/nightly/core/src/nautilus_indicators/book/mod.rs.html index c17c34e8fdb1..01e47fac8b69 100644 --- a/nightly/core/src/nautilus_indicators/book/mod.rs.html +++ b/nightly/core/src/nautilus_indicators/book/mod.rs.html @@ -1,4 +1,4 @@ -mod.rs - source use std::fmt::Display; -use anyhow::Result; use nautilus_model::data::{bar::Bar, quote::QuoteTick, trade::TradeTick}; use crate::{ @@ -298,7 +296,7 @@

    Files

    } impl ChandeMomentumOscillator { - pub fn new(period: usize, ma_type: Option<MovingAverageType>) -> Result<Self> { + pub fn new(period: usize, ma_type: Option<MovingAverageType>) -> anyhow::Result<Self> { Ok(Self { period, ma_type: ma_type.unwrap_or(MovingAverageType::Wilder), diff --git a/nightly/core/src/nautilus_indicators/momentum/mod.rs.html b/nightly/core/src/nautilus_indicators/momentum/mod.rs.html index b576f3e4b0cd..56ed96fdcd32 100644 --- a/nightly/core/src/nautilus_indicators/momentum/mod.rs.html +++ b/nightly/core/src/nautilus_indicators/momentum/mod.rs.html @@ -1,4 +1,4 @@ -mod.rs - source use std::fmt::{Debug, Display}; -use anyhow::Result; use nautilus_model::{ data::{bar::Bar, quote::QuoteTick, trade::TradeTick}, enums::PriceType, @@ -335,7 +333,7 @@

    Files

    } impl RelativeStrengthIndex { - pub fn new(period: usize, ma_type: Option<MovingAverageType>) -> Result<Self> { + pub fn new(period: usize, ma_type: Option<MovingAverageType>) -> anyhow::Result<Self> { Ok(Self { period, ma_type: ma_type.unwrap_or(MovingAverageType::Exponential), diff --git a/nightly/core/src/nautilus_indicators/python/average/ama.rs.html b/nightly/core/src/nautilus_indicators/python/average/ama.rs.html index 23bfce331626..4a8f13431c79 100644 --- a/nightly/core/src/nautilus_indicators/python/average/ama.rs.html +++ b/nightly/core/src/nautilus_indicators/python/average/ama.rs.html @@ -1,4 +1,4 @@ -ama.rs - source key } -fn get_collection_key(key: &str) -> Result<&str> { +fn get_collection_key(key: &str) -> anyhow::Result<&str> { key.split_once(DELIMITER) .map(|(collection, _)| collection) - .ok_or_else(|| anyhow!("Invalid `key`, missing a '{DELIMITER}' delimiter, was {key}")) + .ok_or_else(|| { + anyhow::anyhow!("Invalid `key`, missing a '{DELIMITER}' delimiter, was {key}") + }) } -fn get_index_key(key: &str) -> Result<&str> { +fn get_index_key(key: &str) -> anyhow::Result<&str> { key.split_once(DELIMITER) .map(|(_, index_key)| index_key) - .ok_or_else(|| anyhow!("Invalid `key`, missing a '{DELIMITER}' delimiter, was {key}")) + .ok_or_else(|| { + anyhow::anyhow!("Invalid `key`, missing a '{DELIMITER}' delimiter, was {key}") + }) } // This function can be used when we handle cache serialization in Rust @@ -1210,13 +1238,13 @@

    Files

    fn deserialize_payload( encoding: &str, payload: &[u8], -) -> Result<HashMap<String, serde_json::Value>> { +) -> anyhow::Result<HashMap<String, serde_json::Value>> { match encoding { "msgpack" => rmp_serde::from_slice(payload) - .map_err(|e| anyhow!("Failed to deserialize msgpack `payload`: {e}")), + .map_err(|e| anyhow::anyhow!("Failed to deserialize msgpack `payload`: {e}")), "json" => serde_json::from_slice(payload) - .map_err(|e| anyhow!("Failed to deserialize json `payload`: {e}")), - _ => Err(anyhow!("Unsupported encoding: {encoding}")), + .map_err(|e| anyhow::anyhow!("Failed to deserialize json `payload`: {e}")), + _ => Err(anyhow::anyhow!("Unsupported encoding: {encoding}")), } } diff --git a/nightly/core/src/nautilus_model/currencies.rs.html b/nightly/core/src/nautilus_model/currencies.rs.html index de428ec064f0..fda68ef94b8b 100644 --- a/nightly/core/src/nautilus_model/currencies.rs.html +++ b/nightly/core/src/nautilus_model/currencies.rs.html @@ -1,4 +1,4 @@ -currencies.rs - source use std::fmt::{Display, Formatter}; -use anyhow::Result; use derive_builder::Builder; use nautilus_core::{time::UnixNanos, uuid::UUID4}; use serde::{Deserialize, Serialize}; @@ -151,7 +149,7 @@

    Files

    event_id: UUID4, ts_event: UnixNanos, ts_init: UnixNanos, - ) -> Result<Self> { + ) -> anyhow::Result<Self> { Ok(Self { trader_id, strategy_id, diff --git a/nightly/core/src/nautilus_model/events/order/event.rs.html b/nightly/core/src/nautilus_model/events/order/event.rs.html index 8229ab137437..fedc8af198bc 100644 --- a/nightly/core/src/nautilus_model/events/order/event.rs.html +++ b/nightly/core/src/nautilus_model/events/order/event.rs.html @@ -1,4 +1,4 @@ -event.rs - source use std::fmt::Display; -use anyhow::Result; use derive_builder::Builder; use nautilus_core::{time::UnixNanos, uuid::UUID4}; use serde::{Deserialize, Serialize}; @@ -171,7 +169,7 @@

    Files

    reconciliation: bool, venue_order_id: Option<VenueOrderId>, account_id: Option<AccountId>, - ) -> Result<Self> { + ) -> anyhow::Result<Self> { Ok(Self { trader_id, strategy_id, diff --git a/nightly/core/src/nautilus_model/events/order/filled.rs.html b/nightly/core/src/nautilus_model/events/order/filled.rs.html index 752e4f2d8594..7bd752782226 100644 --- a/nightly/core/src/nautilus_model/events/order/filled.rs.html +++ b/nightly/core/src/nautilus_model/events/order/filled.rs.html @@ -1,4 +1,4 @@ -filled.rs - source 203 204 205 -206
    // -------------------------------------------------------------------------------------------------
     //  Copyright (C) 2015-2024 Nautech Systems Pty Ltd. All rights reserved.
     //  https://nautechsystems.io
    @@ -223,7 +222,6 @@ 

    Files

    use std::fmt::Display; -use anyhow::Result; use derive_builder::Builder; use nautilus_core::{time::UnixNanos, uuid::UUID4}; use serde::{Deserialize, Serialize}; @@ -290,7 +288,7 @@

    Files

    reconciliation: bool, position_id: Option<PositionId>, commission: Option<Money>, - ) -> Result<Self> { + ) -> anyhow::Result<Self> { Ok(Self { trader_id, strategy_id, diff --git a/nightly/core/src/nautilus_model/events/order/initialized.rs.html b/nightly/core/src/nautilus_model/events/order/initialized.rs.html index 2e09cc41e75f..2a0b06a433b1 100644 --- a/nightly/core/src/nautilus_model/events/order/initialized.rs.html +++ b/nightly/core/src/nautilus_model/events/order/initialized.rs.html @@ -1,4 +1,4 @@ -initialized.rs - source 293 294 295 -296
    // -------------------------------------------------------------------------------------------------
     //  Copyright (C) 2015-2024 Nautech Systems Pty Ltd. All rights reserved.
     //  https://nautechsystems.io
    @@ -316,7 +315,6 @@ 

    Files

    fmt::{Display, Formatter}, }; -use anyhow::Result; use derive_builder::Builder; use nautilus_core::{time::UnixNanos, uuid::UUID4}; use serde::{Deserialize, Serialize}; @@ -452,7 +450,7 @@

    Files

    exec_algorithm_params: Option<HashMap<Ustr, Ustr>>, exec_spawn_id: Option<ClientOrderId>, tags: Option<Ustr>, - ) -> Result<Self> { + ) -> anyhow::Result<Self> { Ok(Self { trader_id, strategy_id, diff --git a/nightly/core/src/nautilus_model/events/order/mod.rs.html b/nightly/core/src/nautilus_model/events/order/mod.rs.html index d17eb11066a9..d64d6baf54c0 100644 --- a/nightly/core/src/nautilus_model/events/order/mod.rs.html +++ b/nightly/core/src/nautilus_model/events/order/mod.rs.html @@ -1,4 +1,4 @@ -mod.rs - source
    use std::fmt::{Display, Formatter}; -use anyhow::Result; use derive_builder::Builder; use nautilus_core::{time::UnixNanos, uuid::UUID4}; use serde::{Deserialize, Serialize}; @@ -179,7 +177,7 @@

    Files

    reconciliation: bool, venue_order_id: Option<VenueOrderId>, account_id: Option<AccountId>, - ) -> Result<Self> { + ) -> anyhow::Result<Self> { Ok(Self { trader_id, strategy_id, diff --git a/nightly/core/src/nautilus_model/events/order/pending_cancel.rs.html b/nightly/core/src/nautilus_model/events/order/pending_cancel.rs.html index e540d9225e15..057ffb77e36a 100644 --- a/nightly/core/src/nautilus_model/events/order/pending_cancel.rs.html +++ b/nightly/core/src/nautilus_model/events/order/pending_cancel.rs.html @@ -1,4 +1,4 @@ -pending_cancel.rs - source 106 107 108 -109
    // -------------------------------------------------------------------------------------------------
     //  Copyright (C) 2015-2024 Nautech Systems Pty Ltd. All rights reserved.
     //  https://nautechsystems.io
    @@ -126,7 +125,6 @@ 

    Files

    use std::fmt::{Display, Formatter}; -use anyhow::Result; use derive_builder::Builder; use nautilus_core::{time::UnixNanos, uuid::UUID4}; use serde::{Deserialize, Serialize}; @@ -170,7 +168,7 @@

    Files

    ts_init: UnixNanos, reconciliation: bool, venue_order_id: Option<VenueOrderId>, - ) -> Result<Self> { + ) -> anyhow::Result<Self> { Ok(Self { trader_id, strategy_id, diff --git a/nightly/core/src/nautilus_model/events/order/pending_update.rs.html b/nightly/core/src/nautilus_model/events/order/pending_update.rs.html index 0b95eca81fbe..49454b0624d1 100644 --- a/nightly/core/src/nautilus_model/events/order/pending_update.rs.html +++ b/nightly/core/src/nautilus_model/events/order/pending_update.rs.html @@ -1,4 +1,4 @@ -pending_update.rs - source 106 107 108 -109
    // -------------------------------------------------------------------------------------------------
     //  Copyright (C) 2015-2024 Nautech Systems Pty Ltd. All rights reserved.
     //  https://nautechsystems.io
    @@ -126,7 +125,6 @@ 

    Files

    use std::fmt::{Display, Formatter}; -use anyhow::Result; use derive_builder::Builder; use nautilus_core::{time::UnixNanos, uuid::UUID4}; use serde::{Deserialize, Serialize}; @@ -170,7 +168,7 @@

    Files

    ts_init: UnixNanos, reconciliation: bool, venue_order_id: Option<VenueOrderId>, - ) -> Result<Self> { + ) -> anyhow::Result<Self> { Ok(Self { trader_id, strategy_id, diff --git a/nightly/core/src/nautilus_model/events/order/rejected.rs.html b/nightly/core/src/nautilus_model/events/order/rejected.rs.html index fb4a7162f022..ccda32a22c1e 100644 --- a/nightly/core/src/nautilus_model/events/order/rejected.rs.html +++ b/nightly/core/src/nautilus_model/events/order/rejected.rs.html @@ -1,4 +1,4 @@ -rejected.rs - source 102 103 104 -105
    // -------------------------------------------------------------------------------------------------
     //  Copyright (C) 2015-2024 Nautech Systems Pty Ltd. All rights reserved.
     //  https://nautechsystems.io
    @@ -122,7 +121,6 @@ 

    Files

    use std::fmt::{Display, Formatter}; -use anyhow::Result; use derive_builder::Builder; use nautilus_core::{time::UnixNanos, uuid::UUID4}; use serde::{Deserialize, Serialize}; @@ -167,7 +165,7 @@

    Files

    ts_event: UnixNanos, ts_init: UnixNanos, reconciliation: bool, - ) -> Result<Self> { + ) -> anyhow::Result<Self> { Ok(Self { trader_id, strategy_id, diff --git a/nightly/core/src/nautilus_model/events/order/released.rs.html b/nightly/core/src/nautilus_model/events/order/released.rs.html index 60bd1ef6c0f6..2a0571dc365a 100644 --- a/nightly/core/src/nautilus_model/events/order/released.rs.html +++ b/nightly/core/src/nautilus_model/events/order/released.rs.html @@ -1,4 +1,4 @@ -released.rs - source 98 99 100 -101
    // -------------------------------------------------------------------------------------------------
     //  Copyright (C) 2015-2024 Nautech Systems Pty Ltd. All rights reserved.
     //  https://nautechsystems.io
    @@ -118,7 +117,6 @@ 

    Files

    use std::fmt::Display; -use anyhow::Result; use derive_builder::Builder; use nautilus_core::{time::UnixNanos, uuid::UUID4}; use serde::{Deserialize, Serialize}; @@ -161,7 +159,7 @@

    Files

    event_id: UUID4, ts_event: UnixNanos, ts_init: UnixNanos, - ) -> Result<Self> { + ) -> anyhow::Result<Self> { Ok(Self { trader_id, strategy_id, diff --git a/nightly/core/src/nautilus_model/events/order/stubs.rs.html b/nightly/core/src/nautilus_model/events/order/stubs.rs.html index d7d84197037e..cd6800d19e7f 100644 --- a/nightly/core/src/nautilus_model/events/order/stubs.rs.html +++ b/nightly/core/src/nautilus_model/events/order/stubs.rs.html @@ -1,4 +1,4 @@ -stubs.rs - source use std::fmt::{Display, Formatter}; -use anyhow::Result; use derive_builder::Builder; use nautilus_core::{time::UnixNanos, uuid::UUID4}; use serde::{Deserialize, Serialize}; @@ -158,7 +156,7 @@

    Files

    event_id: UUID4, ts_event: UnixNanos, ts_init: UnixNanos, - ) -> Result<Self> { + ) -> anyhow::Result<Self> { Ok(Self { trader_id, strategy_id, diff --git a/nightly/core/src/nautilus_model/events/order/triggered.rs.html b/nightly/core/src/nautilus_model/events/order/triggered.rs.html index 6856f423a750..df9f810f6190 100644 --- a/nightly/core/src/nautilus_model/events/order/triggered.rs.html +++ b/nightly/core/src/nautilus_model/events/order/triggered.rs.html @@ -1,4 +1,4 @@ -triggered.rs - source 108 109 110 -111
    // -------------------------------------------------------------------------------------------------
     //  Copyright (C) 2015-2024 Nautech Systems Pty Ltd. All rights reserved.
     //  https://nautechsystems.io
    @@ -128,7 +127,6 @@ 

    Files

    use std::fmt::Display; -use anyhow::Result; use derive_builder::Builder; use nautilus_core::{time::UnixNanos, uuid::UUID4}; use serde::{Deserialize, Serialize}; @@ -172,7 +170,7 @@

    Files

    reconciliation: bool, venue_order_id: Option<VenueOrderId>, account_id: Option<AccountId>, - ) -> Result<Self> { + ) -> anyhow::Result<Self> { Ok(Self { trader_id, strategy_id, diff --git a/nightly/core/src/nautilus_model/events/order/updated.rs.html b/nightly/core/src/nautilus_model/events/order/updated.rs.html index 9319c9d74b51..3b90a5f6f2d4 100644 --- a/nightly/core/src/nautilus_model/events/order/updated.rs.html +++ b/nightly/core/src/nautilus_model/events/order/updated.rs.html @@ -1,4 +1,4 @@ -updated.rs - source 121 122 123 -124
    // -------------------------------------------------------------------------------------------------
     //  Copyright (C) 2015-2024 Nautech Systems Pty Ltd. All rights reserved.
     //  https://nautechsystems.io
    @@ -141,7 +140,6 @@ 

    Files

    use std::fmt::{Display, Formatter}; -use anyhow::Result; use derive_builder::Builder; use nautilus_core::{time::UnixNanos, uuid::UUID4}; use serde::{Deserialize, Serialize}; @@ -194,7 +192,7 @@

    Files

    account_id: Option<AccountId>, price: Option<Price>, trigger_price: Option<Price>, - ) -> Result<Self> { + ) -> anyhow::Result<Self> { Ok(Self { trader_id, strategy_id, diff --git a/nightly/core/src/nautilus_model/events/position/changed.rs.html b/nightly/core/src/nautilus_model/events/position/changed.rs.html index bb6fc446edbb..0e06cbabed44 100644 --- a/nightly/core/src/nautilus_model/events/position/changed.rs.html +++ b/nightly/core/src/nautilus_model/events/position/changed.rs.html @@ -1,4 +1,4 @@ -changed.rs - source currency, price_precision, price_increment, + size_precision: 0, + size_increment: Quantity::from("1"), multiplier, lot_size, + margin_init: margin_init.unwrap_or(0.into()), + margin_maint: margin_maint.unwrap_or(0.into()), max_quantity, - min_quantity, + min_quantity: Some(min_quantity.unwrap_or(1.into())), max_price, min_price, ts_event, diff --git a/nightly/core/src/nautilus_model/instruments/mod.rs.html b/nightly/core/src/nautilus_model/instruments/mod.rs.html index 93b43318aad9..89e94587753c 100644 --- a/nightly/core/src/nautilus_model/instruments/mod.rs.html +++ b/nightly/core/src/nautilus_model/instruments/mod.rs.html @@ -1,4 +1,4 @@ -mod.rs - source 148 149 150 -151
    // -------------------------------------------------------------------------------------------------
     //  Copyright (C) 2015-2024 Nautech Systems Pty Ltd. All rights reserved.
     //  https://nautechsystems.io
    @@ -180,7 +179,6 @@ 

    Files

    #[cfg(feature = "stubs")] pub mod stubs; -use anyhow::Result; use nautilus_core::time::UnixNanos; use rust_decimal::Decimal; use rust_decimal_macros::dec; @@ -252,12 +250,12 @@

    Files

    fn ts_init(&self) -> UnixNanos; /// Creates a new price from the given `value` with the correct price precision for the instrument. - fn make_price(&self, value: f64) -> Result<Price> { +
    fn make_price(&self, value: f64) -> anyhow::Result<Price> { Price::new(value, self.price_precision()) } /// Creates a new quantity from the given `value` with the correct size precision for the instrument. - fn make_qty(&self, value: f64) -> Result<Quantity> { + fn make_qty(&self, value: f64) -> anyhow::Result<Quantity> { Quantity::new(value, self.size_precision()) } diff --git a/nightly/core/src/nautilus_model/instruments/options_contract.rs.html b/nightly/core/src/nautilus_model/instruments/options_contract.rs.html index d5bc6ee1b174..0d8315b2903d 100644 --- a/nightly/core/src/nautilus_model/instruments/options_contract.rs.html +++ b/nightly/core/src/nautilus_model/instruments/options_contract.rs.html @@ -1,4 +1,4 @@ -options_contract.rs - source 225 226 227 +228 +229 +230 +231 +232 +233 +234 +235 +236 +237 +238 +239 +240 +241 +242 +243 +244 +245 +246 +247 +248 +249 +250 +251 +252
    // -------------------------------------------------------------------------------------------------
     //  Copyright (C) 2015-2024 Nautech Systems Pty Ltd. All rights reserved.
     //  https://nautechsystems.io
    @@ -247,8 +272,13 @@ 

    Files

    hash::{Hash, Hasher}, }; -use anyhow::Result; -use nautilus_core::time::UnixNanos; +use nautilus_core::{ + correctness::{ + check_equal_u8, check_positive_i64, check_valid_string, check_valid_string_optional, + }, + time::UnixNanos, +}; +use rust_decimal::Decimal; use serde::{Deserialize, Serialize}; use ustr::Ustr; @@ -280,8 +310,12 @@

    Files

    pub currency: Currency, pub price_precision: u8, pub price_increment: Price, + pub size_increment: Quantity, + pub size_precision: u8, pub multiplier: Quantity, pub lot_size: Quantity, + pub margin_init: Decimal, + pub margin_maint: Decimal, pub max_quantity: Option<Quantity>, pub min_quantity: Option<Quantity>, pub max_price: Option<Price>, @@ -311,9 +345,21 @@

    Files

    min_quantity: Option<Quantity>, max_price: Option<Price>, min_price: Option<Price>, + margin_init: Option<Decimal>, + margin_maint: Option<Decimal>, ts_event: UnixNanos, ts_init: UnixNanos, - ) -> Result<Self> { + ) -> anyhow::Result<Self> { + check_valid_string_optional(exchange.map(|u| u.as_str()), stringify!(isin))?; + check_valid_string(underlying.as_str(), stringify!(underlying))?; + check_equal_u8( + price_precision, + price_increment.precision, + stringify!(price_precision), + stringify!(price_increment.precision), + )?; + check_positive_i64(price_increment.raw, stringify!(price_increment.raw))?; + Ok(Self { id, raw_symbol, @@ -327,12 +373,16 @@

    Files

    currency, price_precision, price_increment, + size_precision: 0, + size_increment: Quantity::from("1"), multiplier, lot_size, max_quantity, - min_quantity, + min_quantity: Some(min_quantity.unwrap_or(1.into())), max_price, min_price, + margin_init: margin_init.unwrap_or(0.into()), + margin_maint: margin_maint.unwrap_or(0.into()), ts_event, ts_init, }) diff --git a/nightly/core/src/nautilus_model/instruments/options_spread.rs.html b/nightly/core/src/nautilus_model/instruments/options_spread.rs.html index 61b49a1d110a..2de713ba1c33 100644 --- a/nightly/core/src/nautilus_model/instruments/options_spread.rs.html +++ b/nightly/core/src/nautilus_model/instruments/options_spread.rs.html @@ -1,4 +1,4 @@ -options_spread.rs - source 221 222 223 +224 +225 +226 +227 +228 +229 +230 +231 +232 +233 +234 +235 +236 +237 +238 +239 +240 +241 +242 +243 +244 +245 +246 +247 +248 +249
    // -------------------------------------------------------------------------------------------------
     //  Copyright (C) 2015-2024 Nautech Systems Pty Ltd. All rights reserved.
     //  https://nautechsystems.io
    @@ -243,8 +269,13 @@ 

    Files

    hash::{Hash, Hasher}, }; -use anyhow::Result; -use nautilus_core::time::UnixNanos; +use nautilus_core::{ + correctness::{ + check_equal_u8, check_positive_i64, check_valid_string, check_valid_string_optional, + }, + time::UnixNanos, +}; +use rust_decimal::Decimal; use serde::{Deserialize, Serialize}; use ustr::Ustr; @@ -275,8 +306,12 @@

    Files

    pub currency: Currency, pub price_precision: u8, pub price_increment: Price, + pub size_increment: Quantity, + pub size_precision: u8, pub multiplier: Quantity, pub lot_size: Quantity, + pub margin_init: Decimal, + pub margin_maint: Decimal, pub max_quantity: Option<Quantity>, pub min_quantity: Option<Quantity>, pub max_price: Option<Price>, @@ -301,13 +336,26 @@

    Files

    price_increment: Price, multiplier: Quantity, lot_size: Quantity, + margin_init: Option<Decimal>, + margin_maint: Option<Decimal>, max_quantity: Option<Quantity>, min_quantity: Option<Quantity>, max_price: Option<Price>, min_price: Option<Price>, ts_event: UnixNanos, ts_init: UnixNanos, - ) -> Result<Self> { + ) -> anyhow::Result<Self> { + check_valid_string_optional(exchange.map(|u| u.as_str()), stringify!(isin))?; + check_valid_string(underlying.as_str(), stringify!(underlying))?; + check_valid_string(strategy_type.as_str(), stringify!(strategy_type))?; + check_equal_u8( + price_precision, + price_increment.precision, + stringify!(price_precision), + stringify!(price_increment.precision), + )?; + check_positive_i64(price_increment.raw, stringify!(price_increment.raw))?; + Ok(Self { id, raw_symbol, @@ -320,10 +368,14 @@

    Files

    currency, price_precision, price_increment, + size_precision: 0, + size_increment: Quantity::from("1"), multiplier, lot_size, + margin_init: margin_init.unwrap_or(0.into()), + margin_maint: margin_maint.unwrap_or(0.into()), max_quantity, - min_quantity, + min_quantity: Some(min_quantity.unwrap_or(1.into())), max_price, min_price, ts_event, diff --git a/nightly/core/src/nautilus_model/instruments/stubs.rs.html b/nightly/core/src/nautilus_model/instruments/stubs.rs.html index 057b7399e16c..c49ea3e48e11 100644 --- a/nightly/core/src/nautilus_model/instruments/stubs.rs.html +++ b/nightly/core/src/nautilus_model/instruments/stubs.rs.html @@ -1,4 +1,4 @@ -stubs.rs - source 420 421 422 +423 +424 +425 +426 +427 +428 +429 +430
    // -------------------------------------------------------------------------------------------------
     //  Copyright (C) 2015-2024 Nautech Systems Pty Ltd. All rights reserved.
     //  https://nautechsystems.io
    @@ -506,7 +514,7 @@ 

    Files

    Currency::from("USDT"), false, 2, - 0, + 3, Price::from("0.01"), Quantity::from("0.001"), dec!(0.0002), @@ -742,6 +750,8 @@

    Files

    None, None, None, + None, + None, 0, 0, ) @@ -774,6 +784,8 @@

    Files

    None, None, None, + None, + None, 0, 0, ) @@ -807,6 +819,8 @@

    Files

    None, None, None, + None, + None, 0, 0, ) @@ -839,6 +853,8 @@

    Files

    None, None, None, + None, + None, 0, 0, ) diff --git a/nightly/core/src/nautilus_model/instruments/synthetic.rs.html b/nightly/core/src/nautilus_model/instruments/synthetic.rs.html index c98cee46804a..2ce10c1fbb9f 100644 --- a/nightly/core/src/nautilus_model/instruments/synthetic.rs.html +++ b/nightly/core/src/nautilus_model/instruments/synthetic.rs.html @@ -1,4 +1,4 @@ -synthetic.rs - source 229 230 231 -232
    // -------------------------------------------------------------------------------------------------
     //  Copyright (C) 2015-2024 Nautech Systems Pty Ltd. All rights reserved.
     //  https://nautechsystems.io
    @@ -252,7 +251,6 @@ 

    Files

    hash::{Hash, Hasher}, }; -use anyhow::{anyhow, Result}; use evalexpr::{ContextWithMutableVariables, HashMapContext, Node, Value}; use nautilus_core::time::UnixNanos; @@ -289,7 +287,7 @@

    Files

    formula: String, ts_event: UnixNanos, ts_init: UnixNanos, - ) -> Result<Self, anyhow::Error> { + ) -> anyhow::Result<Self> { let price_increment = Price::new(10f64.powi(-i32::from(price_precision)), price_precision)?; // Extract variables from the component instruments @@ -319,7 +317,7 @@

    Files

    evalexpr::build_operator_tree(formula).is_ok() } - pub fn change_formula(&mut self, formula: String) -> Result<(), anyhow::Error> { + pub fn change_formula(&mut self, formula: String) -> anyhow::Result<()> { let operator_tree = evalexpr::build_operator_tree(&formula)?; self.formula = formula; self.operator_tree = operator_tree; @@ -329,7 +327,7 @@

    Files

    /// Calculates the price of the synthetic instrument based on the given component input prices /// provided as a map. #[allow(dead_code)] - pub fn calculate_from_map(&mut self, inputs: &HashMap<String, f64>) -> Result<Price> { +
    pub fn calculate_from_map(&mut self, inputs: &HashMap<String, f64>) -> anyhow::Result<Price> { let mut input_values = Vec::new(); for variable in &self.variables { @@ -347,9 +345,9 @@

    Files

    /// Calculates the price of the synthetic instrument based on the given component input prices /// provided as an array of `f64` values. - pub fn calculate(&mut self, inputs: &[f64]) -> Result<Price> { +
    pub fn calculate(&mut self, inputs: &[f64]) -> anyhow::Result<Price> { if inputs.len() != self.variables.len() { - return Err(anyhow!("Invalid number of input values")); + return Err(anyhow::anyhow!("Invalid number of input values")); } for (variable, input) in self.variables.iter().zip(inputs) { @@ -361,7 +359,7 @@

    Files

    match result { Value::Float(price) => Price::new(price, self.price_precision), - _ => Err(anyhow!( + _ => Err(anyhow::anyhow!( "Failed to evaluate formula to a floating point number" )), } diff --git a/nightly/core/src/nautilus_model/lib.rs.html b/nightly/core/src/nautilus_model/lib.rs.html index 367916aa4f7a..3749e631497e 100644 --- a/nightly/core/src/nautilus_model/lib.rs.html +++ b/nightly/core/src/nautilus_model/lib.rs.html @@ -1,4 +1,4 @@ -lib.rs - source tags: Option<Ustr>, init_id: UUID4, ts_init: UnixNanos, - ) -> Self { - Self { + ) -> anyhow::Result<Self> { + Ok(Self { core: OrderCore::new( trader_id, strategy_id, @@ -497,7 +496,7 @@

    Files

    is_post_only: post_only, display_qty, trigger_instrument_id, - } + }) } } @@ -766,6 +765,7 @@

    Files

    event.event_id, event.ts_event, ) - } + .unwrap() // SAFETY: From can panic + } }
    \ No newline at end of file diff --git a/nightly/core/src/nautilus_model/orders/limit_if_touched.rs.html b/nightly/core/src/nautilus_model/orders/limit_if_touched.rs.html index 52cc79011b51..f81ecb840576 100644 --- a/nightly/core/src/nautilus_model/orders/limit_if_touched.rs.html +++ b/nightly/core/src/nautilus_model/orders/limit_if_touched.rs.html @@ -1,4 +1,4 @@ -limit_if_touched.rs - source } impl LimitIfTouchedOrder { - #[must_use] - #[allow(clippy::too_many_arguments)] + #[allow(clippy::too_many_arguments)] pub fn new( trader_id: TraderId, strategy_id: StrategyId, @@ -487,8 +486,8 @@

    Files

    tags: Option<Ustr>, init_id: UUID4, ts_init: UnixNanos, - ) -> Self { - Self { + ) -> anyhow::Result<Self> { + Ok(Self { core: OrderCore::new( trader_id, strategy_id, @@ -521,7 +520,7 @@

    Files

    trigger_instrument_id, is_triggered: false, ts_triggered: None, - } + }) } } @@ -796,6 +795,7 @@

    Files

    event.event_id, event.ts_event, ) - } + .unwrap() // SAFETY: From can panic + } }
    \ No newline at end of file diff --git a/nightly/core/src/nautilus_model/orders/market.rs.html b/nightly/core/src/nautilus_model/orders/market.rs.html index f37edc3b58d0..da659a068c19 100644 --- a/nightly/core/src/nautilus_model/orders/market.rs.html +++ b/nightly/core/src/nautilus_model/orders/market.rs.html @@ -1,4 +1,4 @@ -market.rs - source 397 398 399 -400
    // -------------------------------------------------------------------------------------------------
     //  Copyright (C) 2015-2024 Nautech Systems Pty Ltd. All rights reserved.
     //  https://nautechsystems.io
    @@ -420,7 +419,6 @@ 

    Files

    ops::{Deref, DerefMut}, }; -use anyhow::{bail, Result}; use nautilus_core::{time::UnixNanos, uuid::UUID4}; use ustr::Ustr; @@ -475,10 +473,10 @@

    Files

    exec_algorithm_params: Option<HashMap<Ustr, Ustr>>, exec_spawn_id: Option<ClientOrderId>, tags: Option<Ustr>, - ) -> Result<Self> { + ) -> anyhow::Result<Self> { check_quantity_positive(quantity)?; if time_in_force == TimeInForce::Gtd { - bail!("{}", "GTD not supported for Market orders"); + anyhow::bail!("{}", "GTD not supported for Market orders"); } Ok(Self { @@ -758,8 +756,8 @@

    Files

    event.exec_spawn_id, event.tags, ) - .unwrap() - } + .unwrap() // SAFETY: From can panic + } } //////////////////////////////////////////////////////////////////////////////// diff --git a/nightly/core/src/nautilus_model/orders/market_if_touched.rs.html b/nightly/core/src/nautilus_model/orders/market_if_touched.rs.html index edf96dd7e3f3..20f12bf42efb 100644 --- a/nightly/core/src/nautilus_model/orders/market_if_touched.rs.html +++ b/nightly/core/src/nautilus_model/orders/market_if_touched.rs.html @@ -1,4 +1,4 @@ -market_if_touched.rs - source 384 385 386 -387
    // -------------------------------------------------------------------------------------------------
     //  Copyright (C) 2015-2024 Nautech Systems Pty Ltd. All rights reserved.
     //  https://nautechsystems.io
    @@ -443,8 +442,7 @@ 

    Files

    } impl MarketIfTouchedOrder { - #[must_use] - #[allow(clippy::too_many_arguments)] + #[allow(clippy::too_many_arguments)] pub fn new( trader_id: TraderId, strategy_id: StrategyId, @@ -471,8 +469,8 @@

    Files

    tags: Option<Ustr>, init_id: UUID4, ts_init: UnixNanos, - ) -> Self { - Self { + ) -> anyhow::Result<Self> { + Ok(Self { core: OrderCore::new( trader_id, strategy_id, @@ -503,7 +501,7 @@

    Files

    trigger_instrument_id, is_triggered: false, ts_triggered: None, - } + }) } } @@ -771,7 +769,7 @@

    Files

    event.tags, event.event_id, event.ts_event, - ) - } + ).unwrap() // SAFETY: From can panic + } }
    \ No newline at end of file diff --git a/nightly/core/src/nautilus_model/orders/market_to_limit.rs.html b/nightly/core/src/nautilus_model/orders/market_to_limit.rs.html index 2ccbabc3c684..10272d7bcaa7 100644 --- a/nightly/core/src/nautilus_model/orders/market_to_limit.rs.html +++ b/nightly/core/src/nautilus_model/orders/market_to_limit.rs.html @@ -1,4 +1,4 @@ -market_to_limit.rs - source } impl MarketToLimitOrder { - #[must_use] - #[allow(clippy::too_many_arguments)] + #[allow(clippy::too_many_arguments)] pub fn new( trader_id: TraderId, strategy_id: StrategyId, @@ -453,8 +452,8 @@

    Files

    tags: Option<Ustr>, init_id: UUID4, ts_init: UnixNanos, - ) -> Self { - Self { + ) -> anyhow::Result<Self> { + Ok(Self { core: OrderCore::new( trader_id, strategy_id, @@ -482,7 +481,7 @@

    Files

    expire_time, is_post_only: post_only, display_qty, - } + }) } } @@ -746,6 +745,7 @@

    Files

    event.event_id, event.ts_event, ) - } + .unwrap() // SAFETY: From can panic + } }
    \ No newline at end of file diff --git a/nightly/core/src/nautilus_model/orders/mod.rs.html b/nightly/core/src/nautilus_model/orders/mod.rs.html index 5783dc9748be..9e2207b5263e 100644 --- a/nightly/core/src/nautilus_model/orders/mod.rs.html +++ b/nightly/core/src/nautilus_model/orders/mod.rs.html @@ -1,4 +1,4 @@ -mod.rs - source tags: Option<Ustr>, init_id: UUID4, ts_init: UnixNanos, - ) -> Self { - Self { + ) -> anyhow::Result<Self> { + Ok(Self { core: OrderCore::new( trader_id, strategy_id, @@ -521,7 +520,7 @@

    Files

    trigger_instrument_id, is_triggered: false, ts_triggered: None, - } + }) } } @@ -796,6 +795,7 @@

    Files

    event.event_id, event.ts_event, ) - } + .unwrap() // SAFETY: From can panic + } }
    \ No newline at end of file diff --git a/nightly/core/src/nautilus_model/orders/stop_market.rs.html b/nightly/core/src/nautilus_model/orders/stop_market.rs.html index 0a653d455ce1..9947f1ac3bdb 100644 --- a/nightly/core/src/nautilus_model/orders/stop_market.rs.html +++ b/nightly/core/src/nautilus_model/orders/stop_market.rs.html @@ -1,4 +1,4 @@ -stop_market.rs - source } impl StopMarketOrder { - #[must_use] - #[allow(clippy::too_many_arguments)] + #[allow(clippy::too_many_arguments)] pub fn new( trader_id: TraderId, strategy_id: StrategyId, @@ -473,8 +472,8 @@

    Files

    tags: Option<Ustr>, init_id: UUID4, ts_init: UnixNanos, - ) -> Self { - Self { + ) -> anyhow::Result<Self> { + Ok(Self { core: OrderCore::new( trader_id, strategy_id, @@ -505,7 +504,7 @@

    Files

    trigger_instrument_id, is_triggered: false, ts_triggered: None, - } + }) } } @@ -774,6 +773,7 @@

    Files

    event.event_id, event.ts_event, ) - } + .unwrap() // SAFETY: From can panic + } } \ No newline at end of file diff --git a/nightly/core/src/nautilus_model/orders/stubs.rs.html b/nightly/core/src/nautilus_model/orders/stubs.rs.html index f996ba88e346..fcc94333db6f 100644 --- a/nightly/core/src/nautilus_model/orders/stubs.rs.html +++ b/nightly/core/src/nautilus_model/orders/stubs.rs.html @@ -1,4 +1,4 @@ -stubs.rs - source 224 225 226 +227 +228
    // -------------------------------------------------------------------------------------------------
     //  Copyright (C) 2015-2024 Nautech Systems Pty Ltd. All rights reserved.
     //  https://nautechsystems.io
    @@ -406,6 +408,7 @@ 

    Files

    UUID4::new(), 12_321_312_321_312, ) + .unwrap() } #[must_use] @@ -450,6 +453,7 @@

    Files

    UUID4::new(), 12_321_312_321_312, ) + .unwrap() } }
    \ No newline at end of file diff --git a/nightly/core/src/nautilus_model/orders/trailing_stop_limit.rs.html b/nightly/core/src/nautilus_model/orders/trailing_stop_limit.rs.html index 8a49dfbef917..08a582353e41 100644 --- a/nightly/core/src/nautilus_model/orders/trailing_stop_limit.rs.html +++ b/nightly/core/src/nautilus_model/orders/trailing_stop_limit.rs.html @@ -1,4 +1,4 @@ -trailing_stop_limit.rs - source 408 409 410 -411
    // -------------------------------------------------------------------------------------------------
     //  Copyright (C) 2015-2024 Nautech Systems Pty Ltd. All rights reserved.
     //  https://nautechsystems.io
    @@ -472,8 +471,7 @@ 

    Files

    } impl TrailingStopLimitOrder { - #[must_use] - #[allow(clippy::too_many_arguments)] + #[allow(clippy::too_many_arguments)] pub fn new( trader_id: TraderId, strategy_id: StrategyId, @@ -505,8 +503,8 @@

    Files

    tags: Option<Ustr>, init_id: UUID4, ts_init: UnixNanos, - ) -> Self { - Self { + ) -> anyhow::Result<Self> { + Ok(Self { core: OrderCore::new( trader_id, strategy_id, @@ -542,7 +540,7 @@

    Files

    trigger_instrument_id, is_triggered: false, ts_triggered: None, - } + }) } } @@ -819,7 +817,7 @@

    Files

    event.tags, event.event_id, event.ts_event, - ) - } + ).unwrap() // SAFETY: From can panic + } }
    \ No newline at end of file diff --git a/nightly/core/src/nautilus_model/orders/trailing_stop_market.rs.html b/nightly/core/src/nautilus_model/orders/trailing_stop_market.rs.html index ea9e5ee33212..4db2df2b2f7f 100644 --- a/nightly/core/src/nautilus_model/orders/trailing_stop_market.rs.html +++ b/nightly/core/src/nautilus_model/orders/trailing_stop_market.rs.html @@ -1,4 +1,4 @@ -trailing_stop_market.rs - source 393 394 395 -396
    // -------------------------------------------------------------------------------------------------
     //  Copyright (C) 2015-2024 Nautech Systems Pty Ltd. All rights reserved.
     //  https://nautechsystems.io
    @@ -455,8 +454,7 @@ 

    Files

    } impl TrailingStopMarketOrder { - #[must_use] - #[allow(clippy::too_many_arguments)] + #[allow(clippy::too_many_arguments)] pub fn new( trader_id: TraderId, strategy_id: StrategyId, @@ -485,8 +483,8 @@

    Files

    tags: Option<Ustr>, init_id: UUID4, ts_init: UnixNanos, - ) -> Self { - Self { + ) -> anyhow::Result<Self> { + Ok(Self { core: OrderCore::new( trader_id, strategy_id, @@ -519,7 +517,7 @@

    Files

    trigger_instrument_id, is_triggered: false, ts_triggered: None, - } + }) } } @@ -789,7 +787,7 @@

    Files

    event.tags, event.event_id, event.ts_event, - ) - } + ).unwrap() // SAFETY: From can panic + } }
    \ No newline at end of file diff --git a/nightly/core/src/nautilus_model/position.rs.html b/nightly/core/src/nautilus_model/position.rs.html index e33382f5cf55..266288564348 100644 --- a/nightly/core/src/nautilus_model/position.rs.html +++ b/nightly/core/src/nautilus_model/position.rs.html @@ -1,4 +1,4 @@ -position.rs - source 2076 2077 2078 -2079
    // -------------------------------------------------------------------------------------------------
     //  Copyright (C) 2015-2024 Nautech Systems Pty Ltd. All rights reserved.
     //  https://nautechsystems.io
    @@ -2100,7 +2099,6 @@ 

    Files

    hash::{Hash, Hasher}, }; -use anyhow::Result; use nautilus_core::time::UnixNanos; use serde::{Deserialize, Serialize}; @@ -2163,7 +2161,7 @@

    Files

    } impl Position { - pub fn new<T: Instrument>(instrument: T, fill: OrderFilled) -> Result<Self> { + pub fn new<T: Instrument>(instrument: T, fill: OrderFilled) -> anyhow::Result<Self> { assert_eq!(instrument.id(), fill.instrument_id); assert!(fill.position_id.is_some()); assert_ne!(fill.order_side, OrderSide::NoOrderSide); diff --git a/nightly/core/src/nautilus_model/python/common.rs.html b/nightly/core/src/nautilus_model/python/common.rs.html index 4ddbd200d791..1fcacbff6001 100644 --- a/nightly/core/src/nautilus_model/python/common.rs.html +++ b/nightly/core/src/nautilus_model/python/common.rs.html @@ -1,4 +1,4 @@ -common.rs - source