> ## Documentation Index
> Fetch the complete documentation index at: https://docs.0xmonaco.com/llms.txt
> Use this file to discover all available pages before exploring further.

# V0.6.0

# Monaco Protocol SDK v0.6.0

## Portfolio Analytics API

This release adds portfolio analytics to the TypeScript SDK, giving developers access to aggregate trading statistics and time-series chart data for the authenticated user.

***

## New Features

### Portfolio Statistics

Retrieve aggregate performance metrics for the authenticated user over a configurable time period.

**New Method:** `sdk.profile.getPortfolioStats(period)`

**Periods:** `"24h"` | `"7d"` | `"30d"` | `"all"`

```typescript theme={null}
import { MonacoSDK } from "@0xmonaco/core";

const sdk = new MonacoSDK({ walletClient, network: "staging", seiRpcUrl: "https://evm-rpc-testnet.sei-apis.com", wsUrl: "wss://staging.apimonaco.xyz/ws" });

// Authenticate first
await sdk.login('your-client-id');

// Get portfolio stats for the last 30 days
const stats = await sdk.profile.getPortfolioStats("30d");

console.log(`PnL: ${stats.pnl}`);
console.log(`Volume: ${stats.volume}`);
console.log(`Total trades: ${stats.total_trades}`);
console.log(`Total orders: ${stats.total_orders}`);
console.log(`Fees paid: ${stats.fees_paid}`);
console.log(`Total equity: ${stats.total_equity}`);
console.log(`Win/loss ratio: ${stats.win_loss_ratio}`);
console.log(`Max drawdown: ${stats.max_drawdown}`);
```

**Response — `PortfolioStats`:**

```typescript theme={null}
interface PortfolioStats {
  pnl: string;            // Realized profit and loss (quote asset, normalized)
  volume: string;         // Total trading volume (quote asset, normalized)
  max_drawdown: string;   // Peak-to-trough drawdown on running PnL
  total_orders: number;   // Total orders placed
  total_trades: number;   // Total trades executed
  fees_paid: string;      // Total fees paid (quote asset, normalized)
  win_loss_ratio: string; // Ratio of profitable trades to total trades
  total_equity: string;   // Sum of all spot balances (quote asset, normalized)
}
```

***

### Portfolio Chart

Retrieve a time-bucketed chart series for volume or PnL over a given period.

**New Method:** `sdk.profile.getPortfolioChart(period, metric)`

**Periods:** `"24h"` | `"7d"` | `"30d"` | `"all"`

**Metrics:** `"volume"` | `"pnl"`

```typescript theme={null}
// Get PnL chart for the last 7 days
const chart = await sdk.profile.getPortfolioChart("7d", "pnl");

console.log(`Metric: ${chart.metric}`);
console.log(`Period: ${chart.period}`);

chart.data.forEach(point => {
  console.log(`${point.timestamp}: ${point.value}`);
});

// Get volume chart for all time
const volumeChart = await sdk.profile.getPortfolioChart("all", "volume");
```

**Response — `PortfolioChartResponse`:**

```typescript theme={null}
interface PortfolioChartResponse {
  metric: PortfolioMetric;       // "volume" | "pnl"
  period: PortfolioPeriod;       // "24h" | "7d" | "30d" | "all"
  data: PortfolioChartPoint[];   // Time-bucketed data points
}

interface PortfolioChartPoint {
  timestamp: string; // ISO 8601 bucket start time
  value: string;     // Metric value for the bucket (normalized)
}
```

***

### User Trade History

Retrieve paginated trade history for the authenticated user, with optional filtering by trading pair.

**New Method:** `sdk.profile.getUserTrades(params?)`

```typescript theme={null}
// Get first page of trade history
const trades = await sdk.profile.getUserTrades({ page: 1, limit: 20 });

trades.trades.forEach(trade => {
  console.log(`${trade.side} ${trade.quantity} @ ${trade.price} — fee: ${trade.fee}`);
  console.log(`Executed: ${trade.executed_at}`);
});

// Filter by trading pair
const btcTrades = await sdk.profile.getUserTrades({
  trading_pair_id: '123e4567-e89b-12d3-a456-426614174000',
});

console.log(`Total trades: ${trades.total_count}, Pages: ${trades.total_pages}`);
```

**Response — `GetUserTradesResponse`:**

```typescript theme={null}
interface GetUserTradesResponse {
  trades: UserTrade[];
  page: number;
  limit: number;
  total_count: number;
  total_pages: number;
}

interface UserTrade {
  trade_id: string;          // Trade unique identifier
  trading_pair_id: string;   // Trading pair UUID
  price: string;             // Execution price (normalized)
  quantity: string;          // Executed quantity (normalized)
  quote_volume: string;      // price × quantity (normalized)
  side: "BUY" | "SELL";     // From the user's perspective
  fee: string;               // Fee paid for this trade (normalized)
  executed_at: string;       // Trade execution timestamp (ISO 8601)
}
```

***

### Fee Rates on User Profile

`getProfile()` now returns your account's fee rates directly.

```typescript theme={null}
const profile = await sdk.profile.getProfile();

console.log(`Taker fee: ${profile.taker_fee_bps} bps (${profile.taker_fee_bps / 100}%)`);
console.log(`Maker fee: ${profile.maker_fee_bps} bps (${profile.maker_fee_bps / 100}%)`);
```

**New fields on `UserProfile`:**

* `taker_fee_bps` (`number`): Taker fee rate in basis points
* `maker_fee_bps` (`number`): Maker fee rate in basis points

***

## New Types

The following types are now exported from `@0xmonaco/types`:

| Type | Description |
| - | - |
| `PortfolioPeriod` | `"24h" \| "7d" \| "30d" \| "all"` |
| `PortfolioMetric` | `"volume" \| "pnl"` |
| `PortfolioStats` | Aggregate stats response |
| `PortfolioChartPoint` | Single time-series data point |
| `PortfolioChartResponse` | Chart series response |
| `UserTrade` | Single trade execution record |
| `GetUserTradesParams` | Query params for trade history |
| `GetUserTradesResponse` | Paginated trade history response |

***

## Technical Updates

* Stopped publishing declaration and JavaScript source maps that referenced unpublished `src/` files across all packages. No API changes.

***

## Upgrade Instructions

```bash theme={null}
# NPM
npm install @0xmonaco/core@0.6.0 @0xmonaco/types@0.6.0 @0xmonaco/react@0.6.0

# Bun
bun add @0xmonaco/core@0.6.0 @0xmonaco/types@0.6.0 @0xmonaco/react@0.6.0
```

No breaking changes. No migration steps required — this is a purely additive release.

***

*For complete documentation, see the [Profile API guide](/sdk/typescript/profile).*


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.