@@ -18,11 +18,10 @@ type Inputs = {
1818} ;
1919
2020export const ClosePosition : FC < {
21- symbol : string ;
2221 position : API . PositionExt ;
2322 refresh : import ( 'swr/_internal' ) . KeyedMutator < API . PositionInfo > ;
2423 setOpen : Dispatch < SetStateAction < boolean > > ;
25- } > = ( { symbol , position, refresh, setOpen } ) => {
24+ } > = ( { position, refresh, setOpen } ) => {
2625 const [ loading , setLoading ] = useState ( false ) ;
2726
2827 const symbolsInfo = useSymbolsInfo ( ) ;
@@ -36,7 +35,7 @@ export const ClosePosition: FC<{
3635 } ) ;
3736 const { onSubmit, helper } = useOrderEntry (
3837 {
39- symbol,
38+ symbol : position . symbol ,
4039 side : OrderSide . BUY ,
4140 order_type : OrderType . MARKET
4241 } ,
@@ -56,7 +55,7 @@ export const ClosePosition: FC<{
5655 message : 'Closing position...'
5756 } ) ;
5857 try {
59- await onSubmit ( getInput ( data , symbol ) ) ;
58+ await onSubmit ( getInput ( data , position . symbol ) ) ;
6059 update ( {
6160 eventCode : 'closePositionSuccess' ,
6261 type : 'success' ,
@@ -78,8 +77,8 @@ export const ClosePosition: FC<{
7877 }
7978 } ;
8079
81- const symbolInfo = symbolsInfo [ symbol ] ( ) ;
82- const [ _ , base ] = symbol . split ( '_' ) ;
80+ const symbolInfo = symbolsInfo [ position . symbol ] ( ) ;
81+ const [ _ , base ] = position . symbol . split ( '_' ) ;
8382 const [ baseDecimals ] = getDecimalsFromTick ( symbolInfo ) ;
8483
8584 return (
@@ -97,7 +96,7 @@ export const ClosePosition: FC<{
9796 rules = { {
9897 validate : {
9998 custom : async ( _ , data ) => {
100- const errors = await getValidationErrors ( data , symbol , helper . validator ) ;
99+ const errors = await getValidationErrors ( data , position . symbol , helper . validator ) ;
101100 return errors ?. order_quantity != null ? errors . order_quantity . message : true ;
102101 }
103102 }
0 commit comments