* fix: orderbook fixed dp - and show rejection reason * fix: show rejection reason in order list * fix: fix parked rejection reason test * fix: remove not covered part
This commit is contained in:
parent
cf43566bde
commit
0fd1739ce5
@ -216,12 +216,14 @@ describe('subscribe orders', { tags: '@smoke' }, () => {
|
|||||||
|
|
||||||
it('must see a parked order', () => {
|
it('must see a parked order', () => {
|
||||||
// 7002-SORD-048
|
// 7002-SORD-048
|
||||||
// NOT COVERED: must see an explanation of why parked orders happen
|
|
||||||
updateOrder({
|
updateOrder({
|
||||||
id: orderId,
|
id: orderId,
|
||||||
status: Schema.OrderStatus.STATUS_PARKED,
|
status: Schema.OrderStatus.STATUS_PARKED,
|
||||||
});
|
});
|
||||||
cy.getByTestId(`order-status-${orderId}`).should('have.text', 'Parked');
|
cy.getByTestId(`order-status-${orderId}`).should(
|
||||||
|
'have.text',
|
||||||
|
'Parked: Internal error'
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('must see the size of the order and direction/side -', () => {
|
it('must see the size of the order and direction/side -', () => {
|
||||||
|
@ -13,7 +13,7 @@ import {
|
|||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
addDecimalsFormatNumber,
|
addDecimalsFixedFormatNumber,
|
||||||
t,
|
t,
|
||||||
useResizeObserver,
|
useResizeObserver,
|
||||||
formatNumberFixed,
|
formatNumberFixed,
|
||||||
@ -227,25 +227,25 @@ const OrderbookDebugInfo = ({
|
|||||||
viewportHeight,
|
viewportHeight,
|
||||||
lockOnMidPrice,
|
lockOnMidPrice,
|
||||||
priceInCenter: priceInCenter
|
priceInCenter: priceInCenter
|
||||||
? addDecimalsFormatNumber(priceInCenter, decimalPlaces)
|
? addDecimalsFixedFormatNumber(priceInCenter, decimalPlaces)
|
||||||
: '-',
|
: '-',
|
||||||
maxPriceLevel: addDecimalsFormatNumber(
|
maxPriceLevel: addDecimalsFixedFormatNumber(
|
||||||
maxPriceLevel ?? '0',
|
maxPriceLevel ?? '0',
|
||||||
decimalPlaces
|
decimalPlaces
|
||||||
),
|
),
|
||||||
bestStaticBidPrice: addDecimalsFormatNumber(
|
bestStaticBidPrice: addDecimalsFixedFormatNumber(
|
||||||
bestStaticBidPrice ?? '0',
|
bestStaticBidPrice ?? '0',
|
||||||
decimalPlaces
|
decimalPlaces
|
||||||
),
|
),
|
||||||
bestStaticOfferPrice: addDecimalsFormatNumber(
|
bestStaticOfferPrice: addDecimalsFixedFormatNumber(
|
||||||
bestStaticOfferPrice ?? '0',
|
bestStaticOfferPrice ?? '0',
|
||||||
decimalPlaces
|
decimalPlaces
|
||||||
),
|
),
|
||||||
minPriceLevel: addDecimalsFormatNumber(
|
minPriceLevel: addDecimalsFixedFormatNumber(
|
||||||
minPriceLevel ?? '0',
|
minPriceLevel ?? '0',
|
||||||
decimalPlaces
|
decimalPlaces
|
||||||
),
|
),
|
||||||
midPrice: addDecimalsFormatNumber(
|
midPrice: addDecimalsFixedFormatNumber(
|
||||||
(bestStaticOfferPrice &&
|
(bestStaticOfferPrice &&
|
||||||
bestStaticBidPrice &&
|
bestStaticBidPrice &&
|
||||||
getPriceLevel(
|
getPriceLevel(
|
||||||
|
@ -84,11 +84,9 @@ const getRejectionReason = (order: OrderEventFieldsFragment): string | null => {
|
|||||||
Schema.OrderTimeInForceMapping[order.timeInForce]
|
Schema.OrderTimeInForceMapping[order.timeInForce]
|
||||||
} order was not filled and it has been stopped`
|
} order was not filled and it has been stopped`
|
||||||
);
|
);
|
||||||
case Schema.OrderStatus.STATUS_REJECTED:
|
default:
|
||||||
return order.rejectionReason
|
return order.rejectionReason
|
||||||
? t(Schema.OrderRejectionReasonMapping[order.rejectionReason])
|
? t(Schema.OrderRejectionReasonMapping[order.rejectionReason])
|
||||||
: null;
|
: null;
|
||||||
default:
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -249,7 +249,7 @@ export const OrderListTable = forwardRef<AgGridReact, OrderListTableProps>(
|
|||||||
value,
|
value,
|
||||||
data,
|
data,
|
||||||
}: VegaValueFormatterParams<Order, 'status'>) => {
|
}: VegaValueFormatterParams<Order, 'status'>) => {
|
||||||
if (value === Schema.OrderStatus.STATUS_REJECTED) {
|
if (data?.rejectionReason && value) {
|
||||||
return `${Schema.OrderStatusMapping[value]}: ${
|
return `${Schema.OrderStatusMapping[value]}: ${
|
||||||
data?.rejectionReason &&
|
data?.rejectionReason &&
|
||||||
Schema.OrderRejectionReasonMapping[data.rejectionReason]
|
Schema.OrderRejectionReasonMapping[data.rejectionReason]
|
||||||
|
@ -100,6 +100,16 @@ export const addDecimalsFormatNumber = (
|
|||||||
return formatNumber(x, formatDecimals);
|
return formatNumber(x, formatDecimals);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const addDecimalsFixedFormatNumber = (
|
||||||
|
rawValue: string | number,
|
||||||
|
decimalPlaces: number,
|
||||||
|
formatDecimals: number = decimalPlaces
|
||||||
|
) => {
|
||||||
|
const x = addDecimal(rawValue, decimalPlaces);
|
||||||
|
|
||||||
|
return formatNumberFixed(x, formatDecimals);
|
||||||
|
};
|
||||||
|
|
||||||
export const formatNumberPercentage = (value: BigNumber, decimals?: number) => {
|
export const formatNumberPercentage = (value: BigNumber, decimals?: number) => {
|
||||||
const decimalPlaces =
|
const decimalPlaces =
|
||||||
typeof decimals === 'undefined' ? Math.max(value.dp() || 0, 2) : decimals;
|
typeof decimals === 'undefined' ? Math.max(value.dp() || 0, 2) : decimals;
|
||||||
|
Loading…
Reference in New Issue
Block a user