feat(trading): update submit on TP and SL
This commit is contained in:
parent
4b4f9af8d6
commit
5752b5b089
@ -12,17 +12,12 @@ import {
|
|||||||
Pill,
|
Pill,
|
||||||
} from '@vegaprotocol/ui-toolkit';
|
} from '@vegaprotocol/ui-toolkit';
|
||||||
import { useT } from '../../use-t';
|
import { useT } from '../../use-t';
|
||||||
import { type Side } from '@vegaprotocol/types';
|
|
||||||
|
|
||||||
export interface DealTicketPriceTakeProfitStopLossProps {
|
export interface DealTicketPriceTakeProfitStopLossProps {
|
||||||
control: Control<OrderFormValues>;
|
control: Control<OrderFormValues>;
|
||||||
market: Market;
|
market: Market;
|
||||||
takeProfitError?: string;
|
takeProfitError?: string;
|
||||||
stopLossError?: string;
|
stopLossError?: string;
|
||||||
setPrice?: string;
|
|
||||||
takeProfit?: string;
|
|
||||||
stopLoss?: string;
|
|
||||||
side?: Side;
|
|
||||||
quoteName?: string;
|
quoteName?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -32,10 +27,6 @@ export const DealTicketPriceTakeProfitStopLoss = ({
|
|||||||
takeProfitError,
|
takeProfitError,
|
||||||
stopLossError,
|
stopLossError,
|
||||||
quoteName,
|
quoteName,
|
||||||
setPrice,
|
|
||||||
takeProfit,
|
|
||||||
stopLoss,
|
|
||||||
side,
|
|
||||||
}: DealTicketPriceTakeProfitStopLossProps) => {
|
}: DealTicketPriceTakeProfitStopLossProps) => {
|
||||||
const t = useT();
|
const t = useT();
|
||||||
const validateAmount = useValidateAmount();
|
const validateAmount = useValidateAmount();
|
||||||
|
@ -193,8 +193,6 @@ export const DealTicket = ({
|
|||||||
const peakSize = watch('peakSize');
|
const peakSize = watch('peakSize');
|
||||||
const expiresAt = watch('expiresAt');
|
const expiresAt = watch('expiresAt');
|
||||||
const postOnly = watch('postOnly');
|
const postOnly = watch('postOnly');
|
||||||
const takeProfit = watch('takeProfit');
|
|
||||||
const stopLoss = watch('stopLoss');
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const size = storedFormValues?.[dealTicketType]?.size;
|
const size = storedFormValues?.[dealTicketType]?.size;
|
||||||
@ -400,14 +398,15 @@ export const DealTicket = ({
|
|||||||
submit({
|
submit({
|
||||||
batchMarketInstructions,
|
batchMarketInstructions,
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
const orderSubmission = mapFormValuesToOrderSubmission(
|
||||||
|
formValues,
|
||||||
|
market.id,
|
||||||
|
market.decimalPlaces,
|
||||||
|
market.positionDecimalPlaces
|
||||||
|
);
|
||||||
|
submit({ orderSubmission });
|
||||||
}
|
}
|
||||||
const orderSubmission = mapFormValuesToOrderSubmission(
|
|
||||||
formValues,
|
|
||||||
market.id,
|
|
||||||
market.decimalPlaces,
|
|
||||||
market.positionDecimalPlaces
|
|
||||||
);
|
|
||||||
submit({ orderSubmission });
|
|
||||||
lastSubmitTime.current = now;
|
lastSubmitTime.current = now;
|
||||||
},
|
},
|
||||||
[market, pubKey, submit]
|
[market, pubKey, submit]
|
||||||
@ -764,10 +763,6 @@ export const DealTicket = ({
|
|||||||
takeProfitError={errors.takeProfit?.message}
|
takeProfitError={errors.takeProfit?.message}
|
||||||
stopLossError={errors.stopLoss?.message}
|
stopLossError={errors.stopLoss?.message}
|
||||||
control={control}
|
control={control}
|
||||||
setPrice={price}
|
|
||||||
takeProfit={takeProfit}
|
|
||||||
stopLoss={stopLoss}
|
|
||||||
side={side}
|
|
||||||
quoteName={quoteName}
|
quoteName={quoteName}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
Loading…
Reference in New Issue
Block a user