Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

okx-api

Package Overview
Dependencies
Maintainers
1
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

okx-api

Node.js connector for OKX REST APIs and WebSockets, with TypeScript & integration tests.

  • 0.0.6
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.1K
increased by11.7%
Maintainers
1
Weekly downloads
 
Created
Source

Node.js & Typescript OKX (OKEX) API SDK

E2E Tests npm downloads npm version npm size last commit CodeFactor

connector logo

Node.js connector for the OKX APIs and WebSockets:

  • Complete integration with all OKX APIs.
  • WebSocket support coming soon.
  • TypeScript support (with type declarations for most API requests & responses).
  • Over 100 end-to-end tests making real API calls & WebSocket connections, validating any changes before they reach npm.
  • Coming soon: robust WebSocket integration with configurable connection heartbeats & automatic reconnect then resubscribe workflows.
  • Browser support (via webpack bundle - see "Browser Usage" below).

Beta Release

  • REST APIs are fully integrated with end to end test coverage
  • WebSocket support is coming soon.

Installation

npm install --save okx-api

Issues & Discussion

Documentation

Most methods accept JS objects. These can be populated using parameters specified by okx's API documentation, or check the type definition in the rest-client class methods.

Structure

This project uses typescript. Resources are stored in 3 key structures:

  • src - the whole connector written in typescript
  • lib - the javascript version of the project (compiled from typescript). This should not be edited directly, as it will be overwritten with each release. This is also the version published to npm.
  • dist - the packed bundle of the project for use in browser environments (manual, using webpack).
  • examples - some implementation examples & demonstrations. Contributions are welcome!

Usage

Create API credentials at okx

REST Client

Requests & Responses

  • If your IDE doesn't have IntelliSense, check the rest-client.ts for a list of methods, params & return types.
  • Requests follow the same ordering and format as the categories in the API docs.
  • Responses are parsed automatically for less nesting. Error responses are thrown in full:
    • If the response looks successful (HTTP 200 and "code" in the response body === "0"), only the data property is directly (without the code, data & msg properties).
    • If the response looks like an error (HTTP error OR the "code" property in the response does not equal "0"), the full response is thrown (including code and msg properties). See the interface for APIResponse.

Browser Usage

Build a bundle using webpack:

  • npm install
  • npm build
  • npm pack

The bundle can be found in dist/. Altough usage should be largely consistent, smaller differences will exist. Documentation is still TODO.


Contributions & Thanks

Donations

tiagosiebler

Support my efforts to make algo trading accessible to all - register with my referral links:

Or buy me a coffee using any of these:

  • BTC: 1C6GWZL1XW3jrjpPTS863XtZiXL1aTK7Jk
  • ETH (ERC20): 0xd773d8e6a50758e1ada699bb6c4f98bb4abf82da

Contributions & Pull Requests

Contributions are encouraged, I will review any incoming pull requests. See the issues tab for todo items.

Star History

Star History Chart

Keywords

FAQs

Package last updated on 24 Nov 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc