๐ŸŽฏ Place Single Order

Learn how to place a single limit buy or sell order using the Forkast SDK by validating, signing, and submitting it.

Places a single limit order (buy/sell) after validating wallet + key, signing the order, and submitting it.

import { ForkastSDK, Network, OrderResponse } from "@forkastgg/client";

const sdk = new ForkastSDK(Network.MAINNET, "YOUR_API_KEY");

const accountService = sdk.getAccountService();
const orderService = sdk.getOrderService();

const { accessToken } = await accountService.loginWithPrivateKey(
  "YOUR_PRIVATE_KEY"
);

const order: OrderResponse = await orderService.placeSingleOrder(
  "TOKEN_ID",
  0, // side: 0 = buy, 1 = sell
  0.45, // price
  10, // amount
  {
    wallet: "0xYourWallet",
    proxy_wallet: "0xYourProxyWallet",
    private_key: "0xYourPrivateKey",
  },
  accessToken
);

Parameters

FieldTypeRequiredDescription
tokenIdstringYesAddress of the token
accountAccountYesWallet Address, Proxy Wallet and Private Key
pricenumberYesPrice at which to place the order ( 0 < price < 1 )
amountnumberYesNumber of shares ( amount > 1)
sidenumberYesThe side of the order ( 0 = buy, 1 = sell)
accessTokenstringYesAccess Token received from login response
  • Minimum order value is 0.5, ensure price ร— amount โ‰ฅ 0.5
  • Make sure Approve Trading Credits step is completed before placing the order.