yhtx
Version:
HTX API
66 lines (44 loc) • 1.12 kB
Markdown
Simple HTX (HTX.com, previouly Huobi.pro) api for Node.js to access REST API.
## Usage example 1 (api class)
```
const api = require('yhtx')
let acc = new api(<apiKey>, <secret>);
async function test(){
let r = await acc.get('/v1/account/accounts')
console.log(r)
}
test()
```
```
const {call} = require('yhtx')
let apiKey = <apiKey>;
let secret = <secret>;
async function test(){
let data = {}
let r = await call('/v1/account/accounts', {apiKey, secret, data})
console.log(r)
}
test()
```
```
npm i yhtx
```
function call(path, {data, apiKey, secret, method} )
- path = eg: "/v5/account/wallet-balance" [ref](https://bybit-exchange.github.io/docs/api-explorer/v5/account/wallet)
- apiKey = Bybit apiKey
- secret = Bybit api secret
- optional
- data = params to be passed in, eg: {symbol:'BTC'}
- method = "GET" (default) OR "POST"
```
api.get(path[, data])
api.post(path[, data])
```
- data (optional) = refer above
return object (result from HTX api)