UNPKG

@parcl-finance/product-sdk

Version:

TypeScript SDK for interacting with Parcl's product APIs

103 lines 3.15 kB
import { PublicKey } from "@solana/web3.js"; import { Env } from "./types"; export declare class Predictions { baseUrl: string; private headers; private expressClient; constructor(accessToken?: string, env?: Env); getUserPortfolio({ userAddress }: { userAddress: PublicKey; }): Promise<{ availablePoints: number; openInterestPoints: number; }>; getUserOrders({ userAddress, orderStatusFilter, }: { userAddress: PublicKey; orderStatusFilter?: PredictionsOrderStatus; }): Promise<PredictionsOrder[]>; getUserPositions({ userAddress }: { userAddress: PublicKey; }): Promise<PredictionsPosition[]>; getUserTrades({ userAddress }: { userAddress: PublicKey; }): Promise<PredictionsTrade[]>; getPredictionMarkets({ marketCategoryFilter, isResolvedFilter, }: { marketCategoryFilter?: "indexUpdate" | "other"; isResolvedFilter?: boolean; }): Promise<PredictionsMarketInfo[]>; getPredictionMarketInfo({ marketId }: { marketId: string; }): Promise<PredictionsMarketInfo>; getOrderBook({ marketId }: { marketId: string; }): Promise<{ yesOrderBook: PredictionsOrderBook; noOrderBook: PredictionsOrderBook; bestYesBidPrice: number; bestYesAskPrice: number; bestNoBidPrice: number; bestNoAskPrice: number; }>; placeOrder({ userAddress, marketId, type, side, price, contracts, }: { userAddress: PublicKey; marketId: string; type: PredictionsOrderType; side: PredictionsOutcome; price: number; contracts: number; }): Promise<PredictionsOrder>; cancelOrder({ orderId, userAddress }: { orderId: string; userAddress: PublicKey; }): Promise<"executed" | "failed">; } export type PredictionsOutcome = "YES" | "NO"; export type PredictionsOrderType = "BUY" | "SELL"; export type PredictionsOrderStatus = "OPEN" | "FILLED" | "CANCELLED"; export type PredictionsOrder = { orderId: string; marketId: string; userId: string; type: PredictionsOrderType; side: PredictionsOutcome; price: number; contracts: number; remainingContracts: number; status: PredictionsOrderStatus; createdAt?: Date; updatedAt?: Date; }; export type PredictionsPosition = { positionId: number; marketId: string; userId: string; contracts: number; avgPrice: number; side: PredictionsOutcome; createdAt?: Date; updatedAt?: Date; }; export type PredictionsTrade = { tradeId?: number; marketId: string; orderId: string; side: PredictionsOutcome; type: PredictionsOrderType; contracts: number; price: number; createdAt?: Date; }; export type PredictionsMarketInfo = { marketId: string; question: string; deadline: Date; isResolved: boolean; outcome: PredictionsOutcome | null; marketCategory: "indexUpdate" | "other"; createdAt?: Date; }; export type PredictionsOrderBook = { bids: PredictionsOrder[]; asks: PredictionsOrder[]; }; //# sourceMappingURL=predictions.d.ts.map