npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

okx-api-v5

v1.0.7

Published

[![npm install node-Okx-api](https://nodei.co/npm/okx-api-v5.png?mini=true)](https://npmjs.org/package/okx-api-v5)

Downloads

22

Readme

npm install node-Okx-api

npm package NPM downloads GitHub license GitHub stars GitHub forks Last Commit

完成情况

  • [ ] 交易
  • [ ] 资金
  • [ ] 闪兑
  • [ ] 账户
  • [ ] 子账户
  • [ ] 行情数据
  • [x] 公共数据
  • [x] 交易大数据
  • [x] Status

引入使用

const API = require("okx-api-v5")

正常使用


const api = new API({
    api_key: "<key>",
    secret_key: "<secret>",
    pass_phrase: "<pass>"
})

加入代理

const proxy = {
    host: '127.0.0.1',
    port: 7890
}
const api = new API({
    api_key: "<key>",
    secret_key: "<secret>",
    pass_phrase: "<pass>",
    proxy_setting: proxy
})

已添加的API列表

公共数据

获取交易产品基础信息

GET /api/v5/public/instruments

console.info(await api.get_api_v5_public_instruments({instType: "", uly: "", instId: ""}));

获取交割和行权记录

GET /api/v5/public/delivery-exercise-history

console.info(await api.get_api_v5_public_deliveryExerciseHistory({
    instType: "",
    uly: "",
    after: "",
    before: "",
    limit: ""
}));

获取持仓总量

GET /api/v5/public/open-interest

console.info(await api.get_api_v5_public_openInterest({instType: "", uly: "", instId: ""}));

获取永续合约当前资金费率

GET /api/v5/public/funding-rate

console.info(await api.get_api_v5_public_fundingRate({instId: ""}));

获取永续合约历史资金费率

GET /api/v5/public/funding-rate-history

console.info(await api.get_api_v5_public_fundingRateHistory({instId: "", before: "", after: "", limit: ""}));

获取限价

GET /api/v5/public/limit-price

console.info(await api.get_api_v5_public_limitPrice({instId: ""}));

获取期权定价

GET /api/v5/public/opt-summary

console.info(await api.get_api_v5_public_optSummary({uly: "", expTime: ""}));

获取预估交割/行权价格

GET /api/v5/public/estimated-price

console.info(await api.get_api_v5_public_estimatedPrice({instId: ""}));

获取免息额度和币种折算率等级

GET /api/v5/public/discount-rate-interest-free-quota

console.info(await api.get_api_v5_public_discountRateInterestFreeQuota({discountLv: ""}));

获取系统时间

GET /api/v5/public/time

console.info(await api.get_api_v5_public_time({}));

获取平台公共爆仓单信息

GET /api/v5/public/liquidation-orders

console.info(await api.get_api_v5_public_liquidationOrders({
    instType: "",
    mgnMode: "",
    instId: "",
    ccy: "",
    uly: "",
    alias: "",
    state: "",
    before: "",
    after: "",
    limit: ""
}));

获取标记价格

GET /api/v5/public/mark-price

console.info(await api.get_api_v5_public_markPrice({instType: "", instId: "", uly: ""}));

获取衍生品仓位档位

GET /api/v5/public/position-tiers

console.info(await api.get_api_v5_public_positionTiers({instType: "", instId: "", uly: ""}));

获取市场借币杠杆利率和借币限额

GET /api/v5/public/interest-rate-loan-quota

console.info(await api.get_api_v5_public_interestRateLoanQuota({
    instType: "",
    tdMode: "",
    instId: "",
    uly: "",
    tier: ""
}));

获取尊享借币杠杆利率和借币限额

GET /api/v5/public/vip-interest-rate-loan-quota

console.info(await api.get_api_v5_public_vipInterestRateLoanQuota({}));

获取衍生品标的指数

GET /api/v5/public/underlying

console.info(await api.get_api_v5_public_underlying({}));

获取风险准备金余额

GET /api/v5/public/insurance-fund

console.info(await api.get_api_v5_public_insuranceFund({instType: ""}));

交易大数据

获取交易大数据支持币种

GET /api/v5/rubik/stat/trading-data/support-coin

console.info(await api.get_api_v5_rubik_stat_tradingData_supportCoin({}));

获取主动买入/卖出情况

GET /api/v5/rubik/stat/taker-volume

console.info(await api.get_api_v5_rubik_stat_takerVolume({ccy: "", instType: "", begin: "", end: "", period: ""}));

获取杠杆多空比

GET /api/v5/rubik/stat/margin/loan-ratio

console.info(await api.get_api_v5_rubik_stat_margin_loanRatio({ccy: "", begin: "", end: "", period: ""}));

获取合约多空持仓人数比

GET /api/v5/rubik/stat/contracts/long-short-account-ratio

console.info(await api.get_api_v5_rubik_stat_contracts_longShortAccountRatio({
    ccy: "",
    begin: "",
    end: "",
    period: ""
}));

获取合约持仓量及交易量

GET /api/v5/rubik/stat/contracts/open-interest-volume

console.info(await api.get_api_v5_rubik_stat_contracts_openInterestVolume({ccy: "", begin: "", end: "", period: ""}));

看涨/看跌期权合约 持仓总量比/交易总量比

GET /api/v5/rubik/stat/option/open-interest-volume-ratio

console.info(await api.get_api_v5_rubik_stat_option_openInterestVolumeRate({ccy: "", period: ""}));

看涨看跌持仓总量及交易总量(按到期日分)

GET /api/v5/rubik/stat/option/open-interest-volume-expiry

console.info(await api.get_api_v5_rubik_stat_option_openInterestVolumeExpiry({ccy: "", period: ""}));

看涨看跌持仓总量及交易总量(按执行价格分)

GET /api/v5/rubik/stat/option/open-interest-volume-strike

console.info(await api.get_api_v5_rubik_stat_option_openInterestVolumeStrike({ccy: "", expTime: "", period: ""}));

看跌/看涨期权合约 主动买入/卖出量

GET /api/v5/rubik/stat/option/taker-block-volume

console.info(await api.get_api_v5_rubik_stat_option_takerBlockVolume({ccy: "", period: ""}));

Status

Status

GET /api/v5/system/status

console.info(await api.get_api_v5_system_status({}));