coinrayjs
Official JavaScript / TypeScript client for Coinray.io. It gives you real-time market data (tickers, trades, order book, candles) over WebSockets, historical candle history, and authenticated trading against the exchanges Coinray aggregates.
npm install coinrayjs
# or
yarn add coinrayjs
:::info Paid product Coinray API access requires a paid plan (you need a token), and the trading order builders require an additional paid addon. See Getting started for details. :::
import Coinray from "coinrayjs";
const coinray = new Coinray(token, {
apiEndpoint: "https://gateway.coinray.eu",
orderEndpoint: "https://gateway.coinray.eu",
websocketEndpoint: "wss://gateway.coinray.eu/v1",
});
const handle = coinray.subscribeTrades(
{coinraySymbol: "BINA_BTC_USDT"},
({trades}) => console.log(trades),
);
Where to go next
- Getting started — install, authenticate, and manage the connection lifecycle.
- Real-time market data — subscribe to tickers, trades, order book, and candles.
- Historical candles — fetch OHLC history for charts and backtests.
- Trading & accounts — wrap API keys, place/cancel orders, read balances and positions. (order builders are a paid addon)
- API Reference — generated from the TypeScript types.
- Playground — run live API calls from your browser with your own token.
Two ways to use the client
| Use the... | When |
|---|---|
Coinray client directly | You want fine-grained control over individual subscriptions and calls. |
CoinrayCache | You want exchanges + markets loaded and kept fresh for you, with a CurrentMarket helper per symbol. |
Most apps start with CoinrayCache for discovery (exchanges/markets) and use the underlying
Coinray client for streaming and trading.
:::note Coinray symbols
Markets are addressed by a coinray symbol: EXCHANGE_BASE_QUOTE, e.g. BINA_BTC_USDT
(Binance BTC priced in USDT). You can discover valid symbols via CoinrayCache.
:::