# @alpha-arcade/sdk TypeScript SDK for trading on **Alpha Market** - Algorand prediction markets. Place orders, manage positions, stake ALPHA for fee rewards, read orderbooks from the API or chain, and build automated trading bots. ## Installation ```bash npm install @alpha-arcade/sdk algosdk @algorandfoundation/algokit-utils ``` `algosdk` and `@algorandfoundation/algokit-utils` are peer dependencies. ## Getting an API key An API key is **optional**. Without it, you can still fetch markets on-chain, place orders, and use most SDK features. With an API key, you get richer market data, liquidity rewards information, wallet order lookups, routed liquidity, and RFQ endpoints. To get an API key: 1. Go to [alphaarcade.com](https://alphaarcade.com) and **sign up** with your email or Google account. 2. Open the **Account** page 3. Open the **Partners** tab. 4. Click **Create API key** and copy the key. 5. Add it to your environment (e.g. a `.env` file in the project root): ```bash ALPHA_API_KEY=your_api_key_here ``` Then pass it when creating the client: `apiKey: process.env.ALPHA_API_KEY`. ## Quick Start ```typescript import { AlphaClient } from '@alpha-arcade/sdk'; import algosdk from 'algosdk'; // 1. Setup clients const algodClient = new algosdk.Algodv2('', 'https://mainnet-api.algonode.cloud', 443); const indexerClient = new algosdk.Indexer('', 'https://mainnet-idx.algonode.cloud', 443); // 2. Setup signer from mnemonic (or use any TransactionSigner) const account = algosdk.mnemonicToSecretKey('your twenty five word mnemonic ...'); const signer = algosdk.makeBasicAccountTransactionSigner(account); // 3. Initialize the client (no API key needed!) const client = new AlphaClient({ algodClient, indexerClient, signer, activeAddress: account.addr.toString(), matcherAppId: 3078581851, usdcAssetId: 31566704, }); // 4. Fetch live markets (reads directly from chain) const markets = await client.getLiveMarkets(); console.log(`Found ${markets.length} live markets`); // 5. Place a limit buy order on the first market const market = markets[0]; const result = await client.createLimitOrder({ marketAppId: market.marketAppId, position: 1, // 1 = Yes price: 500_000, // $0.50 quantity: 1_000_000, // 1 share isBuying: true, }); console.log(`Order created! Escrow app ID: ${result.escrowAppId}`); ``` ## Examples The repo includes runnable examples (use `npx tsx examples/