diff --git a/libs/deal-ticket/src/components/deal-ticket/deal-ticket.tsx b/libs/deal-ticket/src/components/deal-ticket/deal-ticket.tsx
index d5f0c060a..bedbfe4ba 100644
--- a/libs/deal-ticket/src/components/deal-ticket/deal-ticket.tsx
+++ b/libs/deal-ticket/src/components/deal-ticket/deal-ticket.tsx
@@ -1,6 +1,6 @@
import { t } from '@vegaprotocol/i18n';
import * as Schema from '@vegaprotocol/types';
-import { memo, useCallback, useEffect, useState } from 'react';
+import { memo, useCallback, useEffect, useMemo, useState } from 'react';
import { Controller } from 'react-hook-form';
import { DealTicketAmount } from './deal-ticket-amount';
import { DealTicketButton } from './deal-ticket-button';
@@ -16,10 +16,12 @@ import {
useVegaWalletDialogStore,
} from '@vegaprotocol/wallet';
import {
+ Checkbox,
ExternalLink,
InputError,
Intent,
Notification,
+ Tooltip,
} from '@vegaprotocol/ui-toolkit';
import {
@@ -143,6 +145,16 @@ export const DealTicket = ({
clearErrors,
]);
+ const disablePostOnlyCheckbox = useMemo(() => {
+ const disabled = order
+ ? [
+ Schema.OrderTimeInForce.TIME_IN_FORCE_IOC,
+ Schema.OrderTimeInForce.TIME_IN_FORCE_FOK,
+ ].includes(order.timeInForce)
+ : true;
+ return disabled;
+ }, [order]);
+
const onSubmit = useCallback(
(order: OrderSubmission) => {
submit(
@@ -230,8 +242,8 @@ export const DealTicket = ({
value={order.timeInForce}
orderType={order.type}
onSelect={(timeInForce) => {
- update({ timeInForce });
- // Set tif value for the given order type, so that when switching
+ update({ timeInForce, reduceOnly: false, postOnly: false });
+ // Set TIF value for the given order type, so that when switching
// types we know the last used TIF for the given order type
setLastTIF((curr) => ({
...curr,
@@ -267,6 +279,66 @@ export const DealTicket = ({
)}
/>
)}
+
+ (
+ {
+ update({ postOnly: !order.postOnly, reduceOnly: false });
+ }}
+ label={
+
+ {disablePostOnlyCheckbox
+ ? t(
+ '"Post only" can not be used on "Fill or Kill" or "Immediate or Cancel" orders.'
+ )
+ : t(
+ '"Post only" will ensure the order is not filled immediately but is placed on the order book as a passive order. When the order is processed it is either stopped (if it would not be filled immediately), or placed in the order book as a passive order until the price taker matches with it.'
+ )}
+
+ }
+ >
+ {t('Post only')}
+
+ }
+ />
+ )}
+ />
+ (
+ {
+ update({ postOnly: false, reduceOnly: !order.reduceOnly });
+ }}
+ label={
+
+ {t(
+ '"Reduce only" will ensure that this order will not increase the size of an open position. When the order is matched, it will only trade enough volume to bring your open volume towards 0 but never change the direction of your position. If applied to a limit order that is not instantly filled, the order will be stopped.'
+ )}
+
+ }
+ >
+ {t('Reduce only')}
+
+ }
+ />
+ )}
+ />
+