JSPM

  • Created
  • Published
  • Downloads 3528
  • Score
    100M100P100Q113260F
  • License MIT

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

Package Exports

  • okx-api
  • okx-api/lib/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (okx-api) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

okx-api

Tests npm version npm size npm downloads last commit CodeFactor

WARNING: This package is still early beta! Expect breaking changes until this sees a major release.

If you want to stay informed when this may be ready for testing, please get in touch via telegram.

Node.js connector for the okx APIs and WebSockets, with TypeScript & browser support.

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.

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.