1.0.0-beta.1 • Published 2 years ago

@coinset/okex v1.0.0-beta.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

@coinset/okex

Universal OKEX API client

:children_crossing: This is not official

Public API

A request for an entry point that does not require authentication.

fetchTicker

Retrieve the latest price snapshot, best bid/ask price, and trading volume in the last 24 hours. Docs

example:

import { fetchTicker } from "https://deno.land/x/okex@$VERSION/mod.ts";
await fetchTicker({ instId: "BTC-USD-SWAP" });

parameters:

type TickerOptions = {
  instId: string;
};

returns:

type TickerResponse = {
  code: "0";
  msg: "";
  data: {
    instType: InstType;
    instId: string;
    last: number;
    lastSz: number;
    askPx: number;
    askSz: number;
    bidPx: number;
    bidSz: number;
    open24h: number;
    high24h: number;
    low24h: number;
    volCcy24h: number;
    vol24h: number;
    sodUtc0: number;
    sodUtc8: number;
    ts: number;
  }[];
};

fetchIndexTickers

Retrieve index tickers. Docs

example:

import { fetchIndexTickers } from "https://deno.land/x/okex@$VERSION/mod.ts";

await fetchIndexTickers({ quoteCcy: "BTC" });
await fetchIndexTickers({ instId: "BTC-USD" });

parameters:

type IndexTickersOptions =
  | ({
    quoteCcy: "USD" | "USDT" | "BTC";
  } & {
    instId?: undefined;
  })
  | ({
    instId: string;
  } & {
    quoteCcy?: undefined;
  });

returns:

type IndexTickersResponse = {
  code: "0";
  msg: "";
  data: {
    instId: string;
    idxPx: number;
    high24h: number;
    low24h: number;
    open24h: number;
    sodUtc0: number;
    sodUtc8: number;
    ts: number;
  }[];
};