Skip to content

OkEx rest/websocket client with normalization inspired by CCXT

Notifications You must be signed in to change notification settings

quadency/quad-okex-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

71 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

quad-okex-client

Client to allow easier access to OKEx's rest and websocket api. We are using V1 because documentation for V3 is incomplete and/or has imcomplete data. For example, the ticker ws stream does not have 24h change or a way to calculate the data. We will implement V3 as the documentation becomes more clear or when OKEx starts it's migration.

* There are a handlful of assets that have been normalized to ccxt's library.

Rest Example

import okex from 'quad-okex-client';

// For authenticated endpoints, provide object of credentials.  
// This is not required for public rest endpoints
const exchangeClient = new okex.RestClient({
  apiKey: 'your api key',
  secret: 'your secret',
  password: 'your passphrase',
});

// if using a proxy, set proxy value
if (PROXY_HOST) {
  exchangeClient.proxy = 'http://yourproxyhost';
}
const allMyOrderForBTCUSDT = await exchangeClient.fetchOrders('BTC-USDT')

Websocket Example

import okex from 'quad-okex-client';

// For authenticated endpoints, provide object of credentials.  
// This is not required for public rest endpoints
const exchangeClient = new okex.WebsocketClient({
  apiKey: 'your api key',
  secret: 'your secret',
  password: 'your passphras',
});

exchangeClient.subscribeBalance((balanceUpdate)=>{
  console.log('My balance update:', balanceUpdate);
});