Skip to content

Quick Start

A step-by-step guide to making your first trade with Vortum.

Prerequisites

  • Node.js 18+
  • A modern browser (for Internet Identity)

Step 1: Install the SDK

bash
npm install @vortum/sdk

Step 2: Create a Client

typescript
import { VortumClient } from '@vortum/sdk'

const client = await VortumClient.create()

Step 3: Authenticate

typescript
// Login with Internet Identity
await client.auth.loginWithII()

// Verify authentication
console.log('Logged in as:', client.getPrincipal())

Step 4: Get a Deposit Address

typescript
// Get your BTC deposit address
const btcAddress = await client.wallet.getDepositAddress('BTC')
console.log('Send BTC to:', btcAddress)

// Or Solana
const solAddress = await client.wallet.getDepositAddress('SOL')
console.log('Send SOL to:', solAddress)

Step 5: Check Your Balance

typescript
const balances = await client.wallet.getBalances()

for (const balance of balances) {
  console.log(`${balance.asset}: ${balance.available}`)
}

Step 6: Place an Order

typescript
// Place a limit buy order (8 decimal precision)
const order = await client.trading.placeOrder({
  marketId: 'BTC-USD',
  side: 'buy',
  type: { limit: 50000_00000000n }, // $50,000
  quantity: 1000000n, // 0.01 BTC
})

console.log('Order placed:', order.order_id)

Step 7: Monitor Your Orders

typescript
// Get open orders
const orders = await client.trading.getOrders('BTC-USD')

for (const order of orders) {
  console.log(`${order.side} ${order.quantity} @ ${order.price}`)
}

// Cancel an order
await client.trading.cancelOrder('BTC-USD', orderId)

Step 8: Withdraw

typescript
const withdrawal = await client.wallet.requestWithdrawal({
  asset: 'BTC',
  amount: 500000n, // 0.005 BTC
  address: 'bc1q...',
})

console.log('Withdrawal ID:', withdrawal)

Complete Example

typescript
import { VortumClient } from '@vortum/sdk'

async function main() {
  // Initialize
  const client = await VortumClient.create()
  if (!client) return // Browser only

  await client.auth.loginWithII()

  // Check balance
  const balances = await client.wallet.getBalances()
  console.log('Balances:', balances)

  // Place order
  const order = await client.trading.placeOrder({
    marketId: 'BTC-USD',
    side: 'buy',
    type: { limit: 50000_00000000n },
    quantity: 1000000n,
  })

  console.log('Order placed:', order.order_id)
}

main()

Next Steps