Skip to Content
Getting StartedFirst Trade

First Trade

Now that your account is funded, let’s place your first order.

Placing a Market Order

A market order is the simplest way to trade. It executes immediately at the best available price.

In this example, we will buy BTC-PERP using a market order.

import { Side, FillMode } from "@n1xyz/nord-ts"; // Market ID 0 represents BTC-PERP on 01 Exchange const MARKET_ID = 0; try { console.log("Placing market order..."); const result = await user.placeOrder({ marketId: MARKET_ID, side: Side.Bid, // Buy fillMode: FillMode.FillOrKill, // FOK for Market Order isReduceOnly: false, size: 0.01, // Quantity of BTC // Note: For market orders, price is set to an aggressive value internally }); console.log("Order placed successfully!"); console.log("Action ID:", result.actionId); } catch (error) { console.error("Trading failed:", error); }

Verifying the Trade

After placing the order, you can check your positions to confirm the trade was executed.

// Refresh data await user.fetchInfo(); // Check positions for Market ID 0 (BTC) const position = user.positions[MARKET_ID]; if (position && position.size > 0) { console.log(`Current Position: ${position.size} BTC`); console.log(`Entry Price: ${position.price}`); } else { console.log("No active position found."); }

Congratulations! You have successfully initialized the SDK, funded your account, and executed your first trade.

Last updated on