Create project rules that help Cursor understand the Wallbit API. In your project root:
mkdir -p .cursor
Create .cursor/rules.md:
# Wallbit API development rulesYou are an AI assistant specialized in building integrations with the Wallbit Public API.## API OverviewWallbit is a global neobank and the world's first to offer a public API for programmatic account control. We offer US accounts, investments in ETFs, stocks and bonds, and local currency rails.The API allows you to:- Query account balances (checking and investment)- View transaction history- Execute trades (buy/sell stocks, ETFs, bonds)- Get bank account details for deposits (ACH/SEPA)- Retrieve crypto wallet addresses## AuthenticationAll requests require an `X-API-Key` header:```bashcurl -X GET "https://api.wallbit.io/api/public/v1/balance/checking" \ -H "X-API-Key: $WALLBIT_API_KEY"```## Available Endpoints### Balance- `GET /api/public/v1/balance/checking` - Get checking account balance- `GET /api/public/v1/balance/stocks` - Get investment portfolio### Transactions- `GET /api/public/v1/transactions` - List transactions with filters### Trades- `POST /api/public/v1/trades` - Execute a buy/sell trade### Account Details- `GET /api/public/v1/account-details` - Get bank account details (ACH/SEPA)### Wallets- `GET /api/public/v1/wallets` - Get crypto wallet addresses### Assets- `GET /api/public/v1/assets` - List available assets- `GET /api/public/v1/assets/{symbol}` - Get asset details### Operations- `POST /api/public/v1/operations/internal` - Move funds between accounts## Code Examples### Fetch balance```javascriptconst response = await fetch( "https://api.wallbit.io/api/public/v1/balance/checking", { headers: { "X-API-Key": process.env.WALLBIT_API_KEY }, },);const { data } = await response.json();// data: [{ currency: "USD", balance: 1000.50 }]```### Execute a trade```javascriptconst response = await fetch("https://api.wallbit.io/api/public/v1/trades", { method: "POST", headers: { "X-API-Key": process.env.WALLBIT_API_KEY, "Content-Type": "application/json", }, body: JSON.stringify({ symbol: "AAPL", direction: "BUY", currency: "USD", order_type: "MARKET", amount: 100.0, }),});```### List transactions with filters```javascriptconst params = new URLSearchParams({ status: "COMPLETED", currency: "USD", from_date: "2024-01-01", limit: "20",});const response = await fetch( `https://api.wallbit.io/api/public/v1/transactions?${params}`, { headers: { "X-API-Key": process.env.WALLBIT_API_KEY } },);```## Error HandlingAlways handle these HTTP status codes:- `401` - Invalid or missing API key- `403` - Insufficient permissions- `412` - KYC incomplete or account locked- `422` - Validation error- `429` - Rate limit exceeded## Best Practices- Store API keys in environment variables, never hardcode them- Implement exponential backoff for rate limit errors- Always validate trade parameters before submitting- Check account balance before executing trades- Log all API responses for debugging
Copy and paste this prompt to Cursor to generate a complete Wallbit account dashboard:
Create a React dashboard component for exploring a Wallbit account. The dashboard should:1. Display checking account balances (GET /api/public/v1/balance/checking) showing currency and amount for each account2. Show investment portfolio (GET /api/public/v1/balance/stocks) with: - Total portfolio value - Individual positions (symbol, shares, current value, gain/loss) - Percentage allocation per asset3. Display recent transactions (GET /api/public/v1/transactions) with: - Transaction type, amount, currency, status, and timestamp - Filter by status (COMPLETED, PENDING, FAILED) - Pagination support4. Show available assets (GET /api/public/v1/assets) in a searchable list5. Include a simple trade execution form (POST /api/public/v1/trades) with: - Symbol selector - Buy/Sell toggle - Amount input - Order type (MARKET/LIMIT) - Success/error feedbackUse the Wallbit API base URL: https://api.wallbit.ioAll requests require X-API-Key header from environment variable: process.env.WALLBIT_API_KEYStyle with Tailwind CSS, include loading states, error handling, and make it responsive. Use shadcn/ui components if available.