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
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
- Issues? Check the issues tab.
- Discuss & collaborate with other node devs? Join our Node.js Algo Traders engineering community on telegram.
Related projects
- Try my connectors:
- Try my misc utilities:
- Check out my examples:
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 thecode
,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
andmsg
properties). See the interface for APIResponse.
- If the response looks successful (HTTP 200 and "code" in the response body === "0"), only the
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.