@kaiko-data/sdk-node 1.33.1 → 1.34.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +81 -0
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="https://www.kaiko.com/assets/sites/1/2025/10/kaiko-logo-rgb_color.svg" alt="Kaiko" width="300">
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
# @kaiko-data/sdk-node
|
|
6
|
+
|
|
7
|
+
Node.js client library for the Kaiko gRPC API. This SDK provides auto-generated gRPC stubs for streaming cryptocurrency market data.
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install @kaiko-data/sdk-node
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Requirements
|
|
16
|
+
|
|
17
|
+
- Node.js 20+
|
|
18
|
+
- A valid Kaiko API key
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
```javascript
|
|
23
|
+
const grpc = require("@grpc/grpc-js");
|
|
24
|
+
const { StreamTradesServiceV1Client } = require("@kaiko-data/sdk-node/sdk/sdk_grpc_pb");
|
|
25
|
+
const { StreamTradesRequestV1 } = require("@kaiko-data/sdk-node/sdk/stream/trades_v1/request_pb");
|
|
26
|
+
const { InstrumentCriteria } = require("@kaiko-data/sdk-node/sdk/core/instrument_criteria_pb");
|
|
27
|
+
|
|
28
|
+
const channel = new grpc.ChannelCredentials.createSsl();
|
|
29
|
+
const client = new StreamTradesServiceV1Client("gateway-v0-grpc.kaiko.ovh:443", channel);
|
|
30
|
+
|
|
31
|
+
const metadata = new grpc.Metadata();
|
|
32
|
+
metadata.add("authorization", "Bearer <YOUR_API_KEY>");
|
|
33
|
+
|
|
34
|
+
const criteria = new InstrumentCriteria();
|
|
35
|
+
criteria.setExchange("cbse");
|
|
36
|
+
criteria.setInstrumentClass("spot");
|
|
37
|
+
criteria.setCode("btc-usd");
|
|
38
|
+
|
|
39
|
+
const request = new StreamTradesRequestV1();
|
|
40
|
+
request.setInstrumentCriteria(criteria);
|
|
41
|
+
|
|
42
|
+
const stream = client.subscribe(request, metadata);
|
|
43
|
+
|
|
44
|
+
stream.on("data", (response) => {
|
|
45
|
+
console.log("Trade:", response.toObject());
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
stream.on("error", (err) => {
|
|
49
|
+
console.error("Stream error:", err);
|
|
50
|
+
});
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Available Services
|
|
54
|
+
|
|
55
|
+
All services expose a `subscribe` method that returns a server-side stream.
|
|
56
|
+
|
|
57
|
+
| Service | Description |
|
|
58
|
+
|---------|-------------|
|
|
59
|
+
| `StreamTradesServiceV1` | Real-time trades |
|
|
60
|
+
| `StreamMarketUpdateServiceV1` | Market updates |
|
|
61
|
+
| `StreamAggregatedQuoteServiceV2` | Aggregated quotes |
|
|
62
|
+
| `StreamAggregatedPriceServiceV1` | Aggregated prices |
|
|
63
|
+
| `StreamAggregatedStatePriceServiceV1` | Aggregated state prices |
|
|
64
|
+
| `StreamAggregatesOHLCVServiceV1` | OHLCV aggregates |
|
|
65
|
+
| `StreamAggregatesVWAPServiceV1` | VWAP aggregates |
|
|
66
|
+
| `StreamAggregatesSpotExchangeRateV2ServiceV1` | Spot exchange rates |
|
|
67
|
+
| `StreamAggregatesSpotDirectExchangeRateV2ServiceV1` | Direct exchange rates |
|
|
68
|
+
| `StreamOrderbookL2ServiceV1` | Level 2 order book |
|
|
69
|
+
| `StreamOrderbookL2ReplayServiceV1` | Level 2 order book replay |
|
|
70
|
+
| `StreamIndexServiceV1` | Index values |
|
|
71
|
+
| `StreamIndexMultiAssetsServiceV1` | Multi-asset index values |
|
|
72
|
+
| `StreamIndexForexRateServiceV1` | Index forex rates |
|
|
73
|
+
| `StreamCompositeIndicesServiceV1` | Composite indices |
|
|
74
|
+
| `StreamConstantDurationIndicesServiceV1` | Constant duration indices |
|
|
75
|
+
| `StreamExoticIndicesServiceV1` | Exotic indices |
|
|
76
|
+
| `StreamDerivativesInstrumentMetricsServiceV1` | Derivatives instrument metrics |
|
|
77
|
+
| `StreamIvSviParametersServiceV1` | IV SVI parameters |
|
|
78
|
+
|
|
79
|
+
## Examples
|
|
80
|
+
|
|
81
|
+
For more complete examples, see the [kaiko-sdk-examples](https://github.com/kaikodata/kaiko-sdk-examples) repository.
|