@orderly.network/ui-orders
Version:
139 lines (132 loc) • 4.82 kB
text/typescript
import * as react from 'react';
import { ForwardedRef, FC } from 'react';
import { SharePnLConfig } from '@orderly.network/ui-share';
import * as _orderly_network_ui from '@orderly.network/ui';
import { Table } from '@orderly.network/ui';
import * as _orderly_network_types from '@orderly.network/types';
import { OrderStatus, API, OrderSide } from '@orderly.network/types';
import * as react_jsx_runtime from 'react/jsx-runtime';
type OrderListInstance = {
download?: () => void;
};
type useOrderListScriptOptions = {
type: TabType;
ordersStatus?: OrderStatus;
symbol?: string;
enableLoadMore?: boolean;
onSymbolChange?: (symbol: API.Symbol) => void;
sharePnLConfig?: SharePnLConfig;
filterConfig?: {
side?: OrderSide | "all";
range?: {
from?: Date;
to?: Date;
};
};
pnlNotionalDecimalPrecision?: number;
ref?: ForwardedRef<OrderListInstance>;
};
declare const useOrderListScript: (props: useOrderListScriptOptions) => {
type: TabType;
dataSource: any[] | undefined;
isLoading: boolean;
loadMore: () => void;
cancelOrder: (orderId: number, symbol?: string) => Promise<any>;
updateOrder: (orderId: string, order: _orderly_network_types.OrderEntity) => Promise<any>;
cancelAlgoOrder: (orderId: number, symbol?: string) => Promise<any>;
updateAlgoOrder: (orderId: string, order: _orderly_network_types.OrderEntity) => Promise<any>;
pagination: _orderly_network_ui.PaginationMeta;
manualPagination: boolean;
pnlNotionalDecimalPrecision: number | undefined;
onFilter: (filter: {
name: string;
value: any;
}) => void;
filterItems: any[];
onCancelAll: () => void;
onSymbolChange: ((symbol: API.Symbol) => void) | undefined;
sharePnLConfig: SharePnLConfig | undefined;
tableInstance: react.MutableRefObject<Table<any> | undefined>;
symbolsInfo: Record<string, <Key extends keyof API.SymbolExt>(key: Key, defaultValue?: API.SymbolExt[Key] | undefined) => API.SymbolExt[Key]> & Record<string, () => API.SymbolExt> & {
isNil: boolean;
};
filterDays: 1 | 30 | 7 | 90 | null;
updateFilterDays: (days: 1 | 7 | 30 | 90) => void;
};
type OrdersBuilderState$1 = ReturnType<typeof useOrderListScript>;
declare enum TabType {
all = "all",
pending = "pending",
tp_sl = "tp_sl",
filled = "filled",
cancelled = "cancelled",
rejected = "rejected",
orderHistory = "orderHistory"
}
type OrdersWidgetProps = {
current?: TabType;
pnlNotionalDecimalPrecision?: number;
sharePnLConfig?: SharePnLConfig;
};
declare const OrdersWidget: react.ForwardRefExoticComponent<OrdersWidgetProps & react.RefAttributes<OrderListInstance>>;
type UseOrdersScriptOptions = {
current?: TabType;
pnlNotionalDecimalPrecision?: number;
ref: ForwardedRef<OrderListInstance>;
sharePnLConfig?: SharePnLConfig;
};
declare const useOrdersScript: (props: UseOrdersScriptOptions) => {
current: TabType | undefined;
pnlNotionalDecimalPrecision: number | undefined;
orderListRef: react.RefObject<OrderListInstance>;
sharePnLConfig: SharePnLConfig | undefined;
};
type OrdersBuilderState = ReturnType<typeof useOrdersScript>;
declare const DesktopOrderList: FC<OrdersBuilderState$1 & {
testIds?: {
tableBody?: string;
};
}>;
declare const MobileOrderList: FC<OrdersBuilderState$1 & {
classNames?: {
root?: string;
cell?: string;
content?: string;
};
showFilter?: boolean;
}>;
type DesktopOrderListWidgetProps = {
type: TabType;
ordersStatus?: OrderStatus;
/** if has value, will be fetch current symbol orders*/
symbol?: string;
onSymbolChange?: (symbol: API.Symbol) => void;
pnlNotionalDecimalPrecision?: number;
sharePnLConfig?: SharePnLConfig;
testIds?: {
tableBody?: string;
};
};
declare const DesktopOrderListWidget: react.ForwardRefExoticComponent<DesktopOrderListWidgetProps & react.RefAttributes<OrderListInstance>>;
declare const MobileOrderListWidget: (props: {
type: TabType;
ordersStatus?: OrderStatus;
/** if has value, will be fetch current symbol orders*/
symbol?: string;
onSymbolChange?: (symbol: API.Symbol) => void;
sharePnLConfig?: SharePnLConfig;
classNames?: {
root?: string;
cell?: string;
content?: string;
};
showFilter?: boolean;
filterConfig?: {
side?: OrderSide | "all";
range?: {
from?: Date;
to?: Date;
};
};
}) => react_jsx_runtime.JSX.Element;
export { DesktopOrderList, DesktopOrderListWidget, MobileOrderList, MobileOrderListWidget, type OrderListInstance, type OrdersBuilderState, OrdersWidget, TabType, useOrderListScript, useOrdersScript };