Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ Complete & robust JavaScript & Node.js SDK for the HTX REST APIs and WebSockets:
## Table of Contents

- [Installation](#installation)
- [Why not raw ws?](#why-not-raw-ws)
- [Examples](#examples)
- [Issues & Discussion](#issues--discussion)
- [Related Projects](#related-projects)
Expand All @@ -70,10 +71,24 @@ Complete & robust JavaScript & Node.js SDK for the HTX REST APIs and WebSockets:

## Installation

`npm install --save @siebly/htx-api`
```bash
npm install --save @siebly/htx-api
```

Install **`@siebly/htx-api`**. That is the package name for this SDK. The unscoped npm package `htx-api` is a different package (a stale 0.0.9 pre-release).

Node.js usage requires Node 22.13.0 or newer. Browser applications should follow the public-data and credential-safety guidance below.

## Why not raw ws?

A raw `ws` socket still has to gzip-decode HTX frames, answer ping/pong, sign private auth, reconnect, and resubscribe. `WebsocketClient` does that and emits typed events.

```javascript
import { WebsocketClient, WS_KEY_MAP } from '@siebly/htx-api';
const ws = new WebsocketClient();
ws.subscribe('market.btcusdt.ticker', WS_KEY_MAP.spotPublic);
```

## Examples

Refer to the [examples](./examples) folder for implementation demos, including:
Expand Down
763 changes: 382 additions & 381 deletions docs/endpointFunctionList.md

Large diffs are not rendered by default.

22 changes: 22 additions & 0 deletions examples/apidoc/FuturesClient/getMultiAssetFundingRateHistory.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { FuturesClient } from '@siebly/htx-api';
// or, if require is preferred:
// const { FuturesClient } = require('@siebly/htx-api');

// This example shows how to call this HTX API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "@siebly/htx-api" for HTX exchange
// This HTX API SDK is available on npm via "npm install @siebly/htx-api"
// ENDPOINT: /v5/market/funding_rate_history
// METHOD: GET
// PUBLIC: YES

const client = new FuturesClient({
apiKey: 'insert_api_key_here',
apiSecret: 'insert_api_secret_here',
});

client.getMultiAssetFundingRateHistory(params)
.then((response) => {
console.log(response);
})
.catch((error) => {
console.error(error);
});
Loading
Loading