File tree Expand file tree Collapse file tree 2 files changed +14
-7
lines changed Expand file tree Collapse file tree 2 files changed +14
-7
lines changed Original file line number Diff line number Diff line change @@ -156,10 +156,15 @@ export async function POST(req: NextRequest) {
156
156
const stats = open . reduce (
157
157
( acc , position ) => ( {
158
158
...acc ,
159
- [ `${ position . trade . underlyingAssetSymbol } -${ position . trade . underlyingAssetUnitPriceDenominator } ` ] :
160
- prices [ position . trade . underlyingAssetSymbol ! . toLowerCase ( ) ] [
161
- position . trade . underlyingAssetUnitPriceDenominator ! . toLowerCase ( )
162
- ] ?? 0 ,
159
+ ...( position . trade . underlyingAssetSymbol &&
160
+ position . trade . underlyingAssetUnitPriceDenominator
161
+ ? {
162
+ [ `${ position . trade . underlyingAssetSymbol } -${ position . trade . underlyingAssetUnitPriceDenominator } ` ] :
163
+ prices [ position . trade . underlyingAssetSymbol . toLowerCase ( ) ] [
164
+ position . trade . underlyingAssetUnitPriceDenominator . toLowerCase ( )
165
+ ] ,
166
+ }
167
+ : { } ) ,
163
168
} ) ,
164
169
{ } ,
165
170
)
Original file line number Diff line number Diff line change @@ -52,10 +52,12 @@ export const mapQuoteToTrade = (
52
52
} )
53
53
54
54
const getUnderlyingAssetSymbol = ( quote : Quote ) => {
55
- const symbol = ( quote . isMinting ? quote . outputToken : quote . inputToken ) . symbol
55
+ const symbol = (
56
+ quote . isMinting ? quote . outputToken : quote . inputToken
57
+ ) . symbol . toUpperCase ( )
56
58
57
- if ( symbol . startsWith ( 'ETH' ) || symbol . startsWith ( 'iETH ' ) ) return 'ETH'
58
- if ( symbol . startsWith ( 'BTC' ) || symbol . startsWith ( 'iBTC ' ) ) return 'BTC'
59
+ if ( symbol . startsWith ( 'ETH' ) || symbol . startsWith ( 'IETH ' ) ) return 'ETH'
60
+ if ( symbol . startsWith ( 'BTC' ) || symbol . startsWith ( 'IBTC ' ) ) return 'BTC'
59
61
if ( symbol . startsWith ( 'WSTETH' ) ) return 'WSTETH'
60
62
if ( symbol . startsWith ( 'USUI' ) ) return 'SUI'
61
63
if ( symbol . startsWith ( 'USOL' ) ) return 'SOL'
You can’t perform that action at this time.
0 commit comments