βοΈAPIs
Each product in pear is uniquely designed to march its the API
For base_url: www.api.pearprotocol.io/v1
GMX
This API is for the Isolated product
OPEN POSITIONS
Returns all open positions of a specific user address
URL: {base_url}/isolated/positions/open?chainId=42161&showPnlAfterFees=false&isPnlInLeverage=false&address=0x0C9cCbaDa1411687f6FFa7df317Af35B16b1FE0C
QUERY
chainId<number>: The chain ID to query(use arbitrum 4216)
showPnlAfterFees<boolean>: true or false
isPnlInLeverage<boolean>: true or false
address<
0x${string}
>: address of the user to query
RETURN: Retrieves all users open positions
CLOSE POSITIONS
Returns all close positions of a specific user address
URL: {base_url}/isolated/positions/close?chainId=42161&showPnlAfterFees=false&isPnlInLeverage=false&address=0x0C9cCbaDa1411687f6FFa7df317Af35B16b1FE0C
QUERY
chainId<number>: The chain ID to query(use arbitrum 4216)
showPnlAfterFees<boolean>: true or false
isPnlInLeverage<boolean>: true or false
address<
0x${string}
>: address of the user to query
RETURN: Retrieves all users close positions
VERTEX
This API is for the cross product
POSITIONS
Returns all positions of a specific user address
URL: {base_url}/cross/positions?address=0x0C9cCbaDa1411687f6FFa7df317Af35B16b1FE0C
QUERY
address<
0x${string}
>: address of the user to query
RETURN: Retrieves all users both closed and open positions
CREATE POSITION
stores users position on the DB
URL: {base_url}/cross/positions/create
BODY
export class ICreatePositionDto { readonly owner: string; readonly longToken: string; readonly longPrice: string; readonly longProductId: number; readonly longTokenAmount: string; readonly shortToken: string; readonly shortPrice: string; readonly shortProductId: number; readonly shortTokenAmount: string; readonly collateralAmount: string; readonly leverage: string; readonly longSize: string; readonly shortSize: string; readonly longFee: string; readonly shortFee: string; }
RETURN: returns user created position
CLOSE POSITION
closes user open position in the db
URL: {base_url}/cross/positions/close
BODY
export class IClosePositionDto { readonly positionId: string; readonly longExitPrice: string; readonly shortExitPrice: string; readonly longExitMargin: number; readonly shortExitMargin: string; }
RETURN: returns user closed position
This API is for the Intent product
OPEN TRADES
Returns all open trades of a specific user address
URL: {base_url}/intent/positions/open-trades?account=0x0C9cCbaDa1411687f6FFa7df317Af35B16b1FE0C
QUERY
account<
0x${string}
>: address of the user to query
RETURN: Retrieves all users open positions
{ id: string; LongSideQuote: Quote; ShortSideQuote: Quote; type: PositionType; singleTrade?: "LONG" | "SHORT"; }
OPEN QUOTES
Returns all open quotes of a specific user address
URL: {base_url}/intent/positions/open-quotes?account=0x0C9cCbaDa1411687f6FFa7df317Af35B16b1FE0C
QUERY
account<
0x${string}
>: sub account address of the user pear wallet to query
RETURN: Retrieves all users open positions
{
id: string;
LongSideQuote: Quote;
ShortSideQuote: Quote;
type: PositionType;
singleTrade?: "LONG" | "SHORT";
}
ALL OPEN
Returns all open positions of all users
URL: {base_url}/intent/positions/all-open
QUERY <none>
RETURN: Retrieves all users open positions
{
longToken: any;
shortToken: any;
leverage: any;
size: number;
longId: number;
shortId: number;
createdAt: Date;
}[]
VOLUME
Returns user traded volume
URL: {base_url}/intent/positions/volume?address=0x0C9cCbaDa1411687f6FFa7df317Af35B16b1FE0C&period=2M&startDate=2024-03-16
QUERY
address<
0x${string}
>: user wallet addressperiod<date>: period to check, 1Y=1year, 1M=1month, 2D=2days
startDate<date string>: date to start counting
RETURN: Retrieves user volume
{
totalVolume: number;
}
ALL VOLUME
Returns user traded volume
URL: {base_url}/intent/positions/volume?period=2M&startDate=2024-03-16
QUERY
period<date>: period to check, 1Y=1year, 1M=1month, 2D=2days
startDate<date string>: date to start counting
RETURN: Retrieves all users volume
MARKETS PAGE
API for Markets
Get all Markets by query
URL: {base_url}/market?showFavorites=true&account=0xD323CC9C8Ad7850FC443F432F7a39395452E0b99&netFunding=-0.0000001&searchText=btc&page=1&offset=1000&engine=all
Query
showFavorites <boolean>: Returns tokens favorited by account
account <address>: User pear address
netFunding <number>: Shows tokens equal or above net funding
searchText <string>: Token to search for
page <number>: page number
offset <number>: amount of data per page
engine <string>: enum values can be the following <intent, cross, isolated or all>
Last updated