Reference / @getenginex/sdk-predictions / PortfolioApi
PortfolioApi
The user's positions and portfolio summary. Every method requires a session (UNAUTHENTICATED without one, before any request).
Methods
get()
get(
params?,options?):Promise<Portfolio>
Portfolio summary: totals, open positions and open orders.
Parameters
params?
options?
Returns
Promise<Portfolio>
Example
const { totalValue, openPositions, openOrders } = await predictions.portfolio.get()Throws
As in PortfolioApi.listPositions.
getPosition()
getPosition(
input,options?):Promise<MarketPosition>
The user's position in a market, summed per side. Without a position, the numbers come as 0 (not an error). The gateway sums only the first page of 10 positions of the market.
Parameters
input
marketId
string
options?
Returns
Promise<MarketPosition>
Example
const { yesQuantity, yesAvgPrice } = await predictions.portfolio.getPosition({ marketId: 'mkt-1' })Throws
CONFIGURATION_ERROR without a request if marketId is empty, has whitespace at the start or end, has /, is . or .., and the errors of PortfolioApi.listPositions.
listPositions()
listPositions(
params?,options?):Promise<Position[]>
Lists the user's positions. The gateway ignores filters and pagination: it always returns the first page of 100.
Parameters
params?
options?
Returns
Promise<Position[]>
Example
const positions = await predictions.portfolio.listPositions()Throws
UNAUTHENTICATED without a session, NETWORK_ERROR, TIMEOUT, ABORTED, VALIDATION_ERROR or CONFIGURATION_ERROR (including after dispose()). Identify with isEnginexError(error, code).