# HTX API

> Returns HTX spot market data: tickers, symbols, order books, recent trades and candles.

Category: Finance & Crypto. Region: global. 11 endpoints at `https://api.hoshime.com/v1/htx/<endpoint>`, `GET` with query parameters, answering `{data, meta}` (see https://hoshime.com/docs/responses.md). Reference: https://hoshime.com/docs/platforms/htx
## GET /v1/htx/ticker

Last price, best bid and ask and 24-hour statistics of one symbol.

Scope: `social:read` · Units: 1 · Cached: 1 min

| Parameter | Type | Required | Description |
|---|---|---|---|
| `symbol` | string | yes | Trading pair in lower case, such as btcusdt. (e.g. btcusdt) |
| `tunnel` | string | no | Id or name of one of your tunnels: the call reads the source from the machine that runs `hoshime tunnel`, through its own connection. Fails with 409 tunnel_unavailable when no machine is connected. Cannot be combined with proxy. |
| `proxy` | string | no | Your own http:// or https:// proxy, such as http://user:pass@proxy.example.com:8080, on a public address. The call reads the source only through it. |
| `profileId` | string | no | Browser profile whose login the call sends (its cookies), so the source answers as that account. Without tunnel or proxy it leaves through the profile's own residential IP. Needs the browser:read scope. Data read logged in is for your account only. |

Response data fields: `ask` (string), `askSize` (string), `bid` (string), `bidSize` (string), `change` (string), `changePercent` (string), `high` (string), `low` (string), `open` (string), `price` (string), `quoteVolume` (string), `symbol` (string), `trades` (integer (int64)), `updatedAt` (string), `volume` (string)

```bash
curl "https://api.hoshime.com/v1/htx/ticker?symbol=btcusdt" -H "Authorization: Bearer $HOSHIME_TOKEN"
```

## GET /v1/htx/symbols

The spot symbols HTX lists, sorted by name, optionally of one quote currency.

Scope: `social:read` · Units: 1 · Cached: 60 min · Paginated: cursor

| Parameter | Type | Required | Description |
|---|---|---|---|
| `quote` | string | no | Only symbols quoted in this currency, such as usdt. Omit it for all symbols. |
| `tunnel` | string | no | Id or name of one of your tunnels: the call reads the source from the machine that runs `hoshime tunnel`, through its own connection. Fails with 409 tunnel_unavailable when no machine is connected. Cannot be combined with proxy. |
| `proxy` | string | no | Your own http:// or https:// proxy, such as http://user:pass@proxy.example.com:8080, on a public address. The call reads the source only through it. |
| `profileId` | string | no | Browser profile whose login the call sends (its cookies), so the source answers as that account. Without tunnel or proxy it leaves through the profile's own residential IP. Needs the browser:read scope. Data read logged in is for your account only. |

Response data fields: `apiTrading` (boolean), `baseCurrency` (string), `quoteCurrency` (string), `state` (string), `symbol` (string)

```bash
curl "https://api.hoshime.com/v1/htx/symbols" -H "Authorization: Bearer $HOSHIME_TOKEN"
```

## GET /v1/htx/orderbook

The best bids and asks of one symbol, with the step-0 (finest) price grouping.

Scope: `social:read` · Units: 1

| Parameter | Type | Required | Description |
|---|---|---|---|
| `symbol` | string | yes | Trading pair in lower case, such as btcusdt. (e.g. btcusdt) |
| `depth` | integer | no | Levels per side, from 1 to 20. (default 10) |
| `tunnel` | string | no | Id or name of one of your tunnels: the call reads the source from the machine that runs `hoshime tunnel`, through its own connection. Fails with 409 tunnel_unavailable when no machine is connected. Cannot be combined with proxy. |
| `proxy` | string | no | Your own http:// or https:// proxy, such as http://user:pass@proxy.example.com:8080, on a public address. The call reads the source only through it. |
| `profileId` | string | no | Browser profile whose login the call sends (its cookies), so the source answers as that account. Without tunnel or proxy it leaves through the profile's own residential IP. Needs the browser:read scope. Data read logged in is for your account only. |

Response data fields: `asks` (Level[]), `asks[].price` (string), `asks[].size` (string), `bids` (Level[]), `bids[].price` (string), `bids[].size` (string), `symbol` (string), `updatedAt` (string)

```bash
curl "https://api.hoshime.com/v1/htx/orderbook?symbol=btcusdt" -H "Authorization: Bearer $HOSHIME_TOKEN"
```

## GET /v1/htx/trades

The most recent trades of one symbol, newest first.

Scope: `social:read` · Units: 1 · Cached: 1 min · Paginated: cursor

| Parameter | Type | Required | Description |
|---|---|---|---|
| `symbol` | string | yes | Trading pair in lower case, such as btcusdt. (e.g. btcusdt) |
| `limit` | integer | no | Items per page, 1 to 2000. (default 50) |
| `tunnel` | string | no | Id or name of one of your tunnels: the call reads the source from the machine that runs `hoshime tunnel`, through its own connection. Fails with 409 tunnel_unavailable when no machine is connected. Cannot be combined with proxy. |
| `proxy` | string | no | Your own http:// or https:// proxy, such as http://user:pass@proxy.example.com:8080, on a public address. The call reads the source only through it. |
| `profileId` | string | no | Browser profile whose login the call sends (its cookies), so the source answers as that account. Without tunnel or proxy it leaves through the profile's own residential IP. Needs the browser:read scope. Data read logged in is for your account only. |

Response data fields: `id` (string), `price` (string), `side` (string), `size` (string), `tradedAt` (string)

```bash
curl "https://api.hoshime.com/v1/htx/trades?symbol=btcusdt" -H "Authorization: Bearer $HOSHIME_TOKEN"
```

## GET /v1/htx/candles

Klines (candles) of one symbol, newest first.

Scope: `social:read` · Units: 1 · Cached: 5 min · Paginated: cursor

| Parameter | Type | Required | Description |
|---|---|---|---|
| `symbol` | string | yes | Trading pair in lower case, such as btcusdt. (e.g. btcusdt) |
| `period` | string | no | Candle length, such as 1min, 60min or 1day. (one of 1min, 5min, 15min, 30min, 60min, 4hour, 1day, 1week, 1mon; default 60min) |
| `limit` | integer | no | Items per page, 1 to 2000. (default 100) |
| `tunnel` | string | no | Id or name of one of your tunnels: the call reads the source from the machine that runs `hoshime tunnel`, through its own connection. Fails with 409 tunnel_unavailable when no machine is connected. Cannot be combined with proxy. |
| `proxy` | string | no | Your own http:// or https:// proxy, such as http://user:pass@proxy.example.com:8080, on a public address. The call reads the source only through it. |
| `profileId` | string | no | Browser profile whose login the call sends (its cookies), so the source answers as that account. Without tunnel or proxy it leaves through the profile's own residential IP. Needs the browser:read scope. Data read logged in is for your account only. |

Response data fields: `close` (string), `high` (string), `low` (string), `open` (string), `openedAt` (string), `quoteVolume` (string), `trades` (integer (int64)), `volume` (string)

```bash
curl "https://api.hoshime.com/v1/htx/candles?symbol=btcusdt" -H "Authorization: Bearer $HOSHIME_TOKEN"
```

## GET /v1/htx/tickers

Last price, best bid and ask and 24-hour statistics of every HTX spot symbol, optionally of one quote currency.

Scope: `social:read` · Units: 1 · Paginated: cursor

| Parameter | Type | Required | Description |
|---|---|---|---|
| `quote` | string | no | Only symbols quoted in this currency, such as usdt or btc. Omit it for every symbol. |
| `tunnel` | string | no | Id or name of one of your tunnels: the call reads the source from the machine that runs `hoshime tunnel`, through its own connection. Fails with 409 tunnel_unavailable when no machine is connected. Cannot be combined with proxy. |
| `proxy` | string | no | Your own http:// or https:// proxy, such as http://user:pass@proxy.example.com:8080, on a public address. The call reads the source only through it. |
| `profileId` | string | no | Browser profile whose login the call sends (its cookies), so the source answers as that account. Without tunnel or proxy it leaves through the profile's own residential IP. Needs the browser:read scope. Data read logged in is for your account only. |

Response data fields: `ask` (string), `bid` (string), `change` (string), `changePercent` (string), `count` (integer (int64)), `high` (string), `low` (string), `open` (string), `price` (string), `symbol` (string), `updatedAt` (string), `volume` (string), `volumeQuote` (string)

```bash
curl "https://api.hoshime.com/v1/htx/tickers" -H "Authorization: Bearer $HOSHIME_TOKEN"
```

## GET /v1/htx/serverTime

HTX server time in Unix milliseconds and RFC 3339.

Scope: `social:read` · Units: 1

| Parameter | Type | Required | Description |
|---|---|---|---|
| `tunnel` | string | no | Id or name of one of your tunnels: the call reads the source from the machine that runs `hoshime tunnel`, through its own connection. Fails with 409 tunnel_unavailable when no machine is connected. Cannot be combined with proxy. |
| `proxy` | string | no | Your own http:// or https:// proxy, such as http://user:pass@proxy.example.com:8080, on a public address. The call reads the source only through it. |
| `profileId` | string | no | Browser profile whose login the call sends (its cookies), so the source answers as that account. Without tunnel or proxy it leaves through the profile's own residential IP. Needs the browser:read scope. Data read logged in is for your account only. |

Response data fields: `serverAt` (string)

```bash
curl "https://api.hoshime.com/v1/htx/serverTime" -H "Authorization: Bearer $HOSHIME_TOKEN"
```

## GET /v1/htx/currencies

Currencies of HTX with their networks and their deposit and withdrawal status, optionally of one currency.

Scope: `social:read` · Units: 1 · Cached: 60 min · Paginated: cursor

| Parameter | Type | Required | Description |
|---|---|---|---|
| `currency` | string | no | One currency such as btc. Omit it for every currency. |
| `tunnel` | string | no | Id or name of one of your tunnels: the call reads the source from the machine that runs `hoshime tunnel`, through its own connection. Fails with 409 tunnel_unavailable when no machine is connected. Cannot be combined with proxy. |
| `proxy` | string | no | Your own http:// or https:// proxy, such as http://user:pass@proxy.example.com:8080, on a public address. The call reads the source only through it. |
| `profileId` | string | no | Browser profile whose login the call sends (its cookies), so the source answers as that account. Without tunnel or proxy it leaves through the profile's own residential IP. Needs the browser:read scope. Data read logged in is for your account only. |

Response data fields: `chains` (CurrencyChain[]), `chains[].chain` (string), `chains[].depositStatus` (string), `chains[].fullName` (string), `chains[].minDepositAmount` (string), `chains[].withdrawStatus` (string), `currency` (string)

```bash
curl "https://api.hoshime.com/v1/htx/currencies" -H "Authorization: Bearer $HOSHIME_TOKEN"
```

## GET /v1/htx/swapContracts

The USDT-margined swap contracts HTX lists, sorted by contract code, optionally of one base symbol such as BTC.

Scope: `social:read` · Units: 1 · Cached: 60 min · Paginated: cursor

| Parameter | Type | Required | Description |
|---|---|---|---|
| `symbol` | string | no | Base symbol of the contracts, such as BTC. Empty lists every contract. (e.g. BTC) |
| `tunnel` | string | no | Id or name of one of your tunnels: the call reads the source from the machine that runs `hoshime tunnel`, through its own connection. Fails with 409 tunnel_unavailable when no machine is connected. Cannot be combined with proxy. |
| `proxy` | string | no | Your own http:// or https:// proxy, such as http://user:pass@proxy.example.com:8080, on a public address. The call reads the source only through it. |
| `profileId` | string | no | Browser profile whose login the call sends (its cookies), so the source answers as that account. Without tunnel or proxy it leaves through the profile's own residential IP. Needs the browser:read scope. Data read logged in is for your account only. |

Response data fields: `contract` (string), `contractSize` (string), `listed` (string), `priceTick` (string), `symbol` (string)

```bash
curl "https://api.hoshime.com/v1/htx/swapContracts?symbol=BTC" -H "Authorization: Bearer $HOSHIME_TOKEN"
```

## GET /v1/htx/swapFundingRate

The funding rate of one swap contract: the rate of the current funding period, its estimate for the next and the times.

Scope: `social:read` · Units: 1 · Cached: 1 min

| Parameter | Type | Required | Description |
|---|---|---|---|
| `contract` | string | yes | Swap contract code, such as BTC-USDT. (e.g. BTC-USDT) |
| `tunnel` | string | no | Id or name of one of your tunnels: the call reads the source from the machine that runs `hoshime tunnel`, through its own connection. Fails with 409 tunnel_unavailable when no machine is connected. Cannot be combined with proxy. |
| `proxy` | string | no | Your own http:// or https:// proxy, such as http://user:pass@proxy.example.com:8080, on a public address. The call reads the source only through it. |
| `profileId` | string | no | Browser profile whose login the call sends (its cookies), so the source answers as that account. Without tunnel or proxy it leaves through the profile's own residential IP. Needs the browser:read scope. Data read logged in is for your account only. |

Response data fields: `contract` (string), `estimatedRate` (string), `fundingAt` (string), `fundingRate` (string), `nextFundingAt` (string), `symbol` (string)

```bash
curl "https://api.hoshime.com/v1/htx/swapFundingRate?contract=BTC-USDT" -H "Authorization: Bearer $HOSHIME_TOKEN"
```

## GET /v1/htx/swapOpenInterest

The open interest of one swap contract: contracts held open, base-symbol amount and value in USDT.

Scope: `social:read` · Units: 1 · Cached: 1 min

| Parameter | Type | Required | Description |
|---|---|---|---|
| `contract` | string | yes | Swap contract code, such as BTC-USDT. (e.g. BTC-USDT) |
| `tunnel` | string | no | Id or name of one of your tunnels: the call reads the source from the machine that runs `hoshime tunnel`, through its own connection. Fails with 409 tunnel_unavailable when no machine is connected. Cannot be combined with proxy. |
| `proxy` | string | no | Your own http:// or https:// proxy, such as http://user:pass@proxy.example.com:8080, on a public address. The call reads the source only through it. |
| `profileId` | string | no | Browser profile whose login the call sends (its cookies), so the source answers as that account. Without tunnel or proxy it leaves through the profile's own residential IP. Needs the browser:read scope. Data read logged in is for your account only. |

Response data fields: `amount` (string), `contract` (string), `symbol` (string), `value` (string), `volume` (integer (int64))

```bash
curl "https://api.hoshime.com/v1/htx/swapOpenInterest?contract=BTC-USDT" -H "Authorization: Bearer $HOSHIME_TOKEN"
```
