🍑APIs

APIs for query products, options, and positions.

List Products

const products = await apis.products();

List VTokens

First, you will need to fetch the expiry list for a particular product. The only parameter is the product hash. The product differentiates call and put using an isPut attribute.

const expiries = await apis.expiry("0x...");

Then you can fetch vTokens for specific expiry under certain products.

const vTokens = await apis.vTokens(
  "0x....", // Product Hash
  1655105845, // Expiry
  address, // Addresses Object
  false, // With Statistics
  true, // With Market
  true, // With Greek Figures
);

List Ask/Bid Orders

Queries the ask or bid orders in the order book.

const orders = await apis.orderBook(
  "0x....", // VToken Address
  Side.Ask // Enum imported from the library, Ask or Bid
);

List Long Positions

Queries all long positions in a specific wallet address. Filtered with expired, redeemed.

const params = new URLSearchParams({
  address: wallet.address,
  isExpired: expired.toString(),
  withVToken: withVToken.toString(),
  isRedeemed: "false",
});
const data = await fetch(
  `${API_ENDPOINT}/eth/volare/vTokens/longs?${params}`,
  {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
    },
  }
);

List Short Positions

Queries all short positions in a specific wallet address. Filtered with expired, settled.

const params = new URLSearchParams({
  address: wallet.address,
  isExpired: expired.toString(),
  withVToken: withVToken.toString(),
  isSettled: "false",
});
const data = await fetch(
  `${API_ENDPOINT}/eth/volare/vTokens/shorts?${params}`,
  {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
    },
  }
)

Last updated