๐ Get Portfolio Stats
Retrieve a user's portfolio statsโPnL, ROI, volume, and trade countโusing an accessToken or userId with the Forkast SDK.
Returns a userโs trading performance summary (PnL, ROI, volume, trades count). You can pass an accessToken for the authenticated user or a userIdto fetch stats for a specific user.
import { ForkastSDK, Network, PortfolioStats } from "@forkastgg/client";
const sdk = new ForkastSDK(Network.TESTNET, "YOUR_API_KEY");
const accountService = sdk.getAccountService();
const stats: PortfolioStats = await accountService.getPortfolioStats({
accessToken: "YOUR_ACCESS_TOKEN",
// or userId: 123
});
Parameters
| Field | Type | Required | Description |
|---|---|---|---|
| accessToken | string | No | Token from login response |
| userId | number | No | Specific user id to query |
One of the above parameter is needed.