Skip to content

Commit

Permalink
Add OmsType docs
Browse files Browse the repository at this point in the history
  • Loading branch information
cjdsellers committed Jun 23, 2024
1 parent 7880491 commit 262cac5
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions docs/concepts/execution.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,55 @@ This diagram illustrates message flow (commands and events) across the Nautilus
```

## Order management system (OmsType)

An order management system (OMS) type refers to the method used for tracking positions for an instrument.
This applies to both strategies and venues (simulated and real). Even if a venue doesn't explicitly
state the method in use, an OMS type is always in effect. The OMS type for a component can be specified
using the `OmsType` enum.

There are three OMS types:

- `UNSPECIFIED`: The OMS type defaults based on where it is applied (details below)
- `NETTING`: Positions are combined into a single position per instrument ID
- `HEDGING`: Multiple positions per instrument ID are supported (both long and short)

:::note
Configuring OMS types separately for strategies and venues increases platform complexity but allows
for a wide range of trading styles and preferences (see the table below).
:::

The table below describes different configuration combinations and their applicable scenarios.
When the strategy and venue OMS types differ, the `ExecutionEngine` handles this by overriding or assigning `position_id` values upon received order fill events.
A "virtual position" refers to a position ID that exists within the Nautilus system but not on the venue in
reality.

| Strategy OMS | Venue OMS | Description |
|:-----------------------------|:-----------------------|:-----------------------------------------------------------------------------------------------------------------------------------------------------------|
| `NETTING` | `NETTING` | The strategy uses the venues native OMS type, with a single position ID per instrument ID. |
| `HEDGING` | `HEDGING` | The strategy uses the venues native OMS type, with multiple position IDs per instrument ID (both `LONG` and `SHORT`). |
| `NETTING` | `HEDGING` | The strategy **overrides** the venues native OMS type. The venue tracks multiple positions per instrument ID, but Nautilus maintains a single position ID. |
| `HEDGING` | `NETTING` | The strategy **overrides** the venues native OMS type. The venue tracks a single position per instrument ID, but Nautilus maintains multiple position IDs. |

Examples:

- Most cryptocurrency exchanges use a `NETTING` OMS type, representing a single position per market. However, it may be desirable for a trader to track multiple "virtual" positions for a strategy.
- Some FX ECNs or brokers use a `HEDGING` OMS type, tracking multiple positions both `LONG` and `SHORT`. However, the trader may only care about the NET position per currency pair.

:::info
Nautilus does not yet support venue-side hedging modes such as Binance `BOTH` vs. `LONG/SHORT` where the venue nets per direction.
It is advised to keep Binance account configurations as `BOTH` so that a single position is netted.
:::

### OMS configuration

When configuring a backtest, it's possible to specify the oms_type for the venue.
It is advised to match this with the actual OMS type used by the venue in reality.

If a strategy OMS type is not explicitly set through the oms_type configuration option,
it will default to `UNSPECIFIED`. This means the `ExecutionEngine` will not override any venue `position_id`s,
and the OMS type will follow the venue's OMS type.

## Execution algorithms

The platform supports customized execution algorithm components and provides some built-in
Expand Down

0 comments on commit 262cac5

Please sign in to comment.