Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
aggregator-cexio
Advanced tools
The official Node.js client for aggregator.cex.io API (https://docs-aggregator.cex.io)
npm install aggregator-cexio
const { RestClient } = require('aggregator-cexio')
const defaultClient = new RestClient()
const authenticatedClient = new RestClient(apiKey, apiSecret, options)
Arguments for RestClient are optional. For private actions you need to obtain apiKey + apiSecret pair from your manager.
apiKey
string - Api key for specific account.apiSecret
string - Api secret for specific account.options
object - Additional settings for client.Available client options described below, they all are optional:
apiLimit
integer - Rate limit value for apiKey, default is 300.
Client will check requests count and prevent from spam the server. You can ask to increase this limit.timeout
integer - Request timeout in milliseconds, default is 30000.rejectUnauthorized
boolean - This option useful when you test demo env, default: true.apiUrl
string - Can be changed to test your bot on demo environment.
default is 'https://rest-aggregator.cex.io/'To make a public request use async callPublic(action, params)
method.
This method return Promise
which resolves with server response.
If some error was occured then method rejects with status code and error description.
For more details check api refference.
const { RestClient } = require('aggregator-cexio')
const client = new RestClient()
client.callPublic('get_demo_order_book')
.then(res => console.log(res))
.catch(err => console.error(err))
{ error: 'Bad Request', statusCode: 400 }
{ error: 'Unexpected error', statusCode: 500 }
To make private api calls use async callPrivate(action, params)
. It's similar to public method but requires apiKey
and apiSecret
arguments to client initialization. Each private request is signed with HMAC sha256
so if key is incorrect or signature is wrong client will return rejected promise with error like this { error: 'Authorization Failed', statusCode: 401 }
const { RestClient } = require('aggregator-cexio')
const key = '_account_api_key_'
const secret = '_account_api_secret_'
const action = 'get_my_trading_conditions'
const params = {
pairs: ['BTC-USD']
}
const client = new RestClient(key, secret)
client.callPrivate(action, params)
.then(res => console.log(res))
.catch(err => console.error(err))
Success response example:
{ ok: 'ok', data: { ... } }
const { WebsocketClient } = require('aggregator-cexio')
const ws = new WebsocketClient(apiKey, apiSecret, options)
To init the WebsocketClient you must pass apiKey
and apiSecret
arguments. You can obtain them from your manager.
apiKey
string - Api key for specific account.apiSecret
string - Api secret for specific account.options
object - Additional settings for client.Available client options described below, they all are optional:
wsReplyTimeout
integer - Request timeout in milliseconds, default is 30000.rejectUnauthorized
boolean - This option useful when you test demo env, default: true.apiUrl
string - Can be changed to test your bot on demo environment.
default is 'https://ws-aggregator.cex.io/'To send request to the server you need to connect and auth first. Everything is under the hood and all you need is call async ws.connect()
method. After that you can invoke async ws.callPrivate(action, params)
method which returns Promise
with server response.
If some error was occured then method rejects with status code and error description.
const { WebsocketClient } = require('aggregator-cexio')
const ws = new WebsocketClient(apiKey, apiSecret, options)
await ws.connect() // connect and auth on the server
const res = await ws.callPrivate(action, params)
console.log('result:', res)
ws.disconnect() // close connection
The WebsocketClient allows you to receive updates. At the now available two types of updates account_update
and executionReport
. You can get more detail about them in documentation.
const { WebsocketClient } = require('aggregator-cexio')
const ws = new WebsocketClient(apiKey, apiSecret)
ws.connect()
.then(() => {
ws.subscribe('executionReport', (msg) => {
console.log('executionReport:', msg)
})
ws.subscribe('account_update', (msg) => {
console.log('account_update:', msg)
})
})
.catch(err => console.error(err))
FAQs
nodejs client for aggregator.cex.io
The npm package aggregator-cexio receives a total of 28 weekly downloads. As such, aggregator-cexio popularity was classified as not popular.
We found that aggregator-cexio demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.