okx-node
v1.0.1
Published
A template for creating npm packages using TypeScript and VSCode
Downloads
8
Maintainers
Readme
okx-node
My awesome module
Install
npm install okx-node
Usage
import { OkxRestClient, OkxWebSocketClient } from 'okx-node';
const okxRestClient = new OkxRestClient(
{
apiKey: API_KEY,
apiPass: PASSPHRASE,
apiSecret: SECRET_KEY,
},
MARKET
);
const okxWsClient = OkxWebSocketClient.getInstance({
apiKey: API_KEY,
passphrase: PASSPHRASE,
secretKey: SECRET_KEY,
market: MARKET,
});
void okxRestClient.getPositions().then(data => console.log(data));
void okxRestClient
.getIndexTickers({ instId: 'BTC-USDT' })
.then(data => console.log(data));
const channel = 'index-candle15m';
const eventName = `push-${channel}` as const;
const args: WsPublicChannelArgInstId[] = [
{
channel,
instId: 'BTC-USDT',
},
];
okxWsClient.subscribe({
op: 'subscribe',
args,
});
okxWsClient.on(eventName, data => console.log(data));
Browser Usage
Need to install events
package.
npm install events -s
Use Case
- okx-app Crypto Master