# About

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()
```

## Usage example 2 (call function)

```
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()
```

## Installation

```

npm i yhtx

```

## Parameters (call function)

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"

## Parameters (api function)

```

api.get(path[, data])
api.post(path[, data])

```

- data (optional) = refer above

## return

return object (result from HTX api)
