createLimitOrder

Provides a method to create a buy or sell order for the specified market:

import { Nectar, OrderType, UserOrder } from "@wasd3rplay/nectar-sdk";
import { Wallet } from "ethers";

const nectar = new Nectar();

const buyerWallet = Wallet.createRandom()
const buyOrderID = await nectar.createLimitOrder({
    symbol: "ETH_ETH:USDT_ETH",
    orderType: OrderType.BUY,
    price: "1000",         // 1000 USDT
    requestAmount: "0.1",  // 0.1 ETH
    signer: buyerWallet
});

Properties

  • symbol

    • The market symbol

    • The symbol expression is a combination of base_ticker, a colon (':'), and quote_ticker.

  • orderType

    • The order type for a new order

  • price

    • The desired amount for buying or selling, expressed in the quote token

  • requestAmount

    • The desired quantity of the base token for buying or selling

  • signer (optional)

    • The user's wallet placing the order

    • Nectar is a non-custodial exchange, which is why it requires user signatures for each order. User wallet is essential for performing these signatures.

    • If the private_key parameter is provided during the creation of a Nectar instance, or if the NODE_NECTAR_WALLET_SECRET environment variable is set before creating a Nectar instance, then the user wallet can be omitted.

OrderType Choices

// Limit order
BUY = 0
SELL = 1

Result

The result of this method is a created order ID:

e.g.

nxboqg8qln2zp579 // order_id
  • order_id

    • The unique value of the this created order provided by Nectar