@@ -13,12 +13,12 @@ import {
1313} from "../utils/utils" ;
1414
1515export default function BuySell ( {
16- buyPrice ,
17- sellPrice ,
16+ askPrice ,
17+ bidPrice ,
1818 symbol,
1919} : {
20- buyPrice : number ;
21- sellPrice : number ;
20+ askPrice : number ;
21+ bidPrice : number ;
2222 symbol : SYMBOL ;
2323} ) {
2424 const [ orderType , setOrderType ] = useState < "market" | "pending" > ( "market" ) ;
@@ -79,8 +79,8 @@ export default function BuySell({
7979 // 1. Convert all inputs to the correct scaled-integer format
8080 const openPriceForCalc =
8181 activeTab === "buy"
82- ? toInternalPrice ( buyPrice )
83- : toInternalPrice ( sellPrice ) ;
82+ ? toInternalPrice ( askPrice )
83+ : toInternalPrice ( bidPrice ) ;
8484 const closePriceForCalc = toInternalPrice ( Number ( tpPrice ) ) ;
8585 const marginForCalc = margin * 100 ; // Convert dollar margin to cents
8686
@@ -92,16 +92,16 @@ export default function BuySell({
9292 marginCents : marginForCalc ,
9393 leverage : leverage ,
9494 } ) ;
95- } , [ tpEnabled , tpPrice , activeTab , buyPrice , sellPrice , margin , leverage ] ) ;
95+ } , [ tpEnabled , tpPrice , activeTab , askPrice , bidPrice , margin , leverage ] ) ;
9696
9797 const estimatedSlPnlInCents = useMemo ( ( ) => {
9898 if ( ! slEnabled || ! slPrice || Number ( slPrice ) <= 0 ) return 0 ;
9999
100100 // 1. Convert all inputs to the correct scaled-integer format
101101 const openPriceForCalc =
102102 activeTab === "buy"
103- ? toInternalPrice ( buyPrice )
104- : toInternalPrice ( sellPrice ) ;
103+ ? toInternalPrice ( askPrice )
104+ : toInternalPrice ( bidPrice ) ;
105105 const closePriceForCalc = toInternalPrice ( Number ( slPrice ) ) ;
106106 const marginForCalc = margin * 100 ; // Convert dollar margin to cents
107107
@@ -113,7 +113,7 @@ export default function BuySell({
113113 marginCents : marginForCalc ,
114114 leverage : leverage ,
115115 } ) ;
116- } , [ slEnabled , slPrice , activeTab , buyPrice , sellPrice , margin , leverage ] ) ;
116+ } , [ slEnabled , slPrice , activeTab , askPrice , bidPrice , margin , leverage ] ) ;
117117
118118 const handleSubmitTrade = async ( ) => {
119119 if ( margin <= 0 ) {
@@ -222,7 +222,9 @@ export default function BuySell({
222222 </ div >
223223 </ div >
224224 ) : (
225- < div className = "text-sm font-semibold text-neutral-50" > { symbol } </ div >
225+ < div className = "text-sm font-semibold text-neutral-50" >
226+ { symbol }
227+ </ div >
226228 ) }
227229 < div className = "text-xs ml-auto bg-neutral-800/60 backdrop-blur-sm px-3 py-2 rounded-md border border-neutral-600" >
228230 < span className = "text-neutral-300" > Balance:</ span >
@@ -243,7 +245,7 @@ export default function BuySell({
243245 </ div >
244246 < div className = "mt-2 text-lg font-semibold text-[#EB483F] flex items-center" >
245247 < span className = "text-sm mr-1" > $</ span >
246- { sellPrice }
248+ { bidPrice }
247249 </ div >
248250 < div className = "absolute w-1 h-full bg-[#EB483F]/40 left-0 top-0" > </ div >
249251 </ div >
@@ -256,7 +258,7 @@ export default function BuySell({
256258 </ div >
257259 < div className = "mt-2 text-lg font-semibold text-[#158BF9] flex items-center" >
258260 < span className = "text-sm mr-1" > $</ span >
259- { buyPrice }
261+ { askPrice }
260262 </ div >
261263 < div className = "absolute w-1 h-full bg-[#158BF9]/40 left-0 top-0" > </ div >
262264 </ div >
@@ -559,7 +561,7 @@ export default function BuySell({
559561 </ div >
560562 < div className = "text-[10px] text-white/40" >
561563 Target: ${ tpPrice } | Current: $
562- { activeTab === "buy" ? buyPrice : sellPrice }
564+ { activeTab === "buy" ? askPrice : bidPrice }
563565 </ div >
564566 </ div >
565567 ) }
@@ -650,7 +652,7 @@ export default function BuySell({
650652 </ div >
651653 < div className = "text-[10px] text-white/40" >
652654 Stop: ${ slPrice } | Current: $
653- { activeTab === "buy" ? buyPrice : sellPrice }
655+ { activeTab === "buy" ? askPrice : bidPrice }
654656 </ div >
655657 </ div >
656658 ) }
0 commit comments