API Endpoints
Complete reference documentation for all PMF Finance API endpoints.
Base URL
Production: https://api.pmf.finance
Sandbox: https://sandbox-api.pmf.finance
Account Endpoints
Get Account Information
GET /api/v1/account
Response:
{
"user_id": "user_12345",
"email": "user@example.com",
"account_type": "individual",
"created_at": "2024-01-01T00:00:00Z",
"verified": true,
"permissions": ["read", "trade"]
}
Get Account Balance
GET /api/v1/account/balance
Response:
{
"total_balance": "1000.00",
"available_balance": "750.00",
"reserved_balance": "250.00",
"currency": "USDC"
}
Get Account Positions
GET /api/v1/account/positions
Query Parameters:
market_id(optional): Filter by specific marketstatus(optional): Filter by position status (open, closed)limit(optional): Number of results (default: 50, max: 100)offset(optional): Pagination offset
Response:
{
"positions": [
{
"position_id": "pos_12345",
"market_id": "market_67890",
"market_title": "2024 Presidential Election",
"outcome": "Yes",
"shares": "100.00",
"average_price": "0.65",
"current_price": "0.70",
"unrealized_pnl": "5.00",
"created_at": "2024-01-01T00:00:00Z"
}
],
"total": 1,
"limit": 50,
"offset": 0
}
Market Endpoints
Get All Markets
GET /api/v1/markets
Query Parameters:
category(optional): Filter by market categorystatus(optional): Filter by market status (active, closed, resolved)search(optional): Search markets by title or descriptionlimit(optional): Number of results (default: 50, max: 100)offset(optional): Pagination offset
Response:
{
"markets": [
{
"market_id": "market_12345",
"title": "2024 Presidential Election",
"description": "Who will win the 2024 US Presidential Election?",
"category": "politics",
"status": "active",
"outcomes": [
{
"outcome_id": "outcome_1",
"name": "Yes",
"price": "0.65",
"volume_24h": "10000.00"
},
{
"outcome_id": "outcome_2",
"name": "No",
"price": "0.35",
"volume_24h": "8000.00"
}
],
"total_volume": "500000.00",
"resolution_date": "2024-11-06T00:00:00Z",
"created_at": "2024-01-01T00:00:00Z"
}
],
"total": 1,
"limit": 50,
"offset": 0
}
Get Market Details
GET /api/v1/markets/{market_id}
Response:
{
"market_id": "market_12345",
"title": "2024 Presidential Election",
"description": "Who will win the 2024 US Presidential Election?",
"category": "politics",
"status": "active",
"outcomes": [
{
"outcome_id": "outcome_1",
"name": "Yes",
"price": "0.65",
"volume_24h": "10000.00",
"order_book": {
"bids": [
{"price": "0.64", "size": "100.00"},
{"price": "0.63", "size": "200.00"}
],
"asks": [
{"price": "0.66", "size": "150.00"},
{"price": "0.67", "size": "300.00"}
]
}
}
],
"total_volume": "500000.00",
"resolution_date": "2024-11-06T00:00:00Z",
"resolution_criteria": "Resolved based on official election results",
"created_at": "2024-01-01T00:00:00Z"
}
Get Market Order Book
GET /api/v1/markets/{market_id}/orderbook
Query Parameters:
outcome_id(optional): Filter by specific outcomedepth(optional): Number of price levels (default: 10, max: 50)
Response:
{
"market_id": "market_12345",
"outcomes": [
{
"outcome_id": "outcome_1",
"name": "Yes",
"bids": [
{"price": "0.64", "size": "100.00"},
{"price": "0.63", "size": "200.00"}
],
"asks": [
{"price": "0.66", "size": "150.00"},
{"price": "0.67", "size": "300.00"}
]
}
],
"timestamp": "2024-01-01T12:00:00Z"
}
Trading Endpoints
Place Order
POST /api/v1/orders
Request Body:
{
"market_id": "market_12345",
"outcome_id": "outcome_1",
"side": "buy",
"order_type": "market",
"size": "100.00",
"price": "0.65"
}
Response:
{
"order_id": "order_12345",
"market_id": "market_12345",
"outcome_id": "outcome_1",
"side": "buy",
"order_type": "market",
"size": "100.00",
"price": "0.65",
"status": "filled",
"filled_size": "100.00",
"average_fill_price": "0.65",
"created_at": "2024-01-01T12:00:00Z",
"updated_at": "2024-01-01T12:00:01Z"
}
Get Orders
GET /api/v1/orders
Query Parameters:
market_id(optional): Filter by marketstatus(optional): Filter by order status (pending, filled, cancelled)limit(optional): Number of results (default: 50, max: 100)offset(optional): Pagination offset
Response:
{
"orders": [
{
"order_id": "order_12345",
"market_id": "market_12345",
"outcome_id": "outcome_1",
"side": "buy",
"order_type": "limit",
"size": "100.00",
"price": "0.65",
"status": "pending",
"filled_size": "0.00",
"created_at": "2024-01-01T12:00:00Z"
}
],
"total": 1,
"limit": 50,
"offset": 0
}
Cancel Order
DELETE /api/v1/orders/{order_id}
Response:
{
"order_id": "order_12345",
"status": "cancelled",
"cancelled_at": "2024-01-01T12:05:00Z"
}
PMF Endpoints
Get All PMFs
GET /api/v1/pmfs
Query Parameters:
category(optional): Filter by PMF categorywriter_id(optional): Filter by specific writermin_aum(optional): Minimum assets under managementlimit(optional): Number of results (default: 50, max: 100)offset(optional): Pagination offset
Response:
{
"pmfs": [
{
"pmf_id": "pmf_12345",
"name": "Election Specialist Fund",
"description": "Focused on political prediction markets",
"writer_id": "writer_67890",
"writer_name": "John Doe",
"nav": "10.25",
"aum": "1000000.00",
"performance_1m": "5.2",
"performance_3m": "12.8",
"performance_1y": "25.4",
"management_fee": "2.0",
"performance_fee": "15.0",
"created_at": "2024-01-01T00:00:00Z"
}
],
"total": 1,
"limit": 50,
"offset": 0
}
Get PMF Details
GET /api/v1/pmfs/{pmf_id}
Response:
{
"pmf_id": "pmf_12345",
"name": "Election Specialist Fund",
"description": "Focused on political prediction markets",
"writer_id": "writer_67890",
"writer_name": "John Doe",
"nav": "10.25",
"aum": "1000000.00",
"total_shares": "97560.98",
"performance": {
"1d": "0.1",
"1w": "1.2",
"1m": "5.2",
"3m": "12.8",
"1y": "25.4",
"inception": "32.1"
},
"fees": {
"management_fee": "2.0",
"performance_fee": "15.0"
},
"holdings": [
{
"market_id": "market_12345",
"market_title": "2024 Presidential Election",
"allocation": "25.5",
"value": "255000.00"
}
],
"created_at": "2024-01-01T00:00:00Z"
}
Invest in PMF
POST /api/v1/pmfs/{pmf_id}/invest
Request Body:
{
"amount": "1000.00"
}
Response:
{
"investment_id": "inv_12345",
"pmf_id": "pmf_12345",
"amount": "1000.00",
"nav": "10.25",
"shares": "97.56",
"status": "pending",
"created_at": "2024-01-01T12:00:00Z"
}
Redeem from PMF
POST /api/v1/pmfs/{pmf_id}/redeem
Request Body:
{
"shares": "50.00"
}
Response:
{
"redemption_id": "red_12345",
"pmf_id": "pmf_12345",
"shares": "50.00",
"nav": "10.25",
"amount": "512.50",
"status": "pending",
"created_at": "2024-01-01T12:00:00Z"
}
Leaderboard Endpoints
Get Leaderboards
GET /api/v1/leaderboards
Query Parameters:
category(optional): Filter by category (traders, writers)period(optional): Time period (1d, 1w, 1m, 3m, 1y, all)limit(optional): Number of results (default: 50, max: 100)offset(optional): Pagination offset
Response:
{
"leaderboard": [
{
"rank": 1,
"user_id": "user_12345",
"username": "TopTrader",
"return": "25.4",
"sharpe_ratio": "1.8",
"max_drawdown": "5.2",
"trades": 156,
"win_rate": "68.5"
}
],
"period": "1m",
"category": "traders",
"total": 1000,
"limit": 50,
"offset": 0
}
WebSocket API
Connection
wss://api.pmf.finance/ws
Authentication
Send authentication message after connection:
{
"type": "auth",
"api_key": "your_api_key",
"signature": "calculated_signature",
"timestamp": 1640995200000
}
Subscribe to Market Data
{
"type": "subscribe",
"channel": "market_data",
"market_id": "market_12345"
}
Market Data Updates
{
"type": "market_update",
"market_id": "market_12345",
"outcomes": [
{
"outcome_id": "outcome_1",
"price": "0.65",
"volume": "1000.00"
}
],
"timestamp": "2024-01-01T12:00:00Z"
}
Error Responses
Standard Error Format
{
"error": "INVALID_REQUEST",
"message": "The request is invalid",
"code": 400,
"details": {
"field": "market_id",
"reason": "required"
}
}
Common Error Codes
400- Bad Request401- Unauthorized403- Forbidden404- Not Found429- Too Many Requests500- Internal Server Error
Next Steps
- Review API authentication for security setup
- Explore API examples for common use cases
- Test endpoints in our sandbox environment
- Join our developer community for support