You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-Robust WebSocket integration with configurable connection heartbeats & automatic reconnect then resubscribe workflows.
31
34
- Event driven messaging.
32
-
- Smart websocket persistence
35
+
- Smart websocket persistence with automatic reconnection handling.
33
36
- Automatically handle silent websocket disconnections through timed heartbeats, including the scheduled 24hr disconnect.
34
37
- Automatically handle listenKey persistence and expiration/refresh.
35
38
- Emit `reconnected` event when dropped connection is restored.
36
-
- Websocket API for Gate.com Spot, Margin, Perpetual Futures & Delivery Futures.
39
+
- Support for Gate.com Spot, Margin, Perpetual Futures, Delivery Futures & Options.
40
+
- WebSocket API for Gate.com Spot, Margin, Perpetual Futures & Delivery Futures.
37
41
- Automatic connectivity via existing WebsocketClient, just call sendWSAPIRequest to trigger a request.
38
42
- Automatic authentication, just call sendWSAPIRequest with channel & parameters.
39
43
- Choose between two interfaces for WS API communication:
40
44
- Event-driven interface, fire & forget via sendWSAPIRequest and receive async replies via wsClient's event emitter.
41
45
- Promise-driven interface, simply use the WebsocketAPIClient for a REST-like experience. Use the WebSocket API like a REST API! See [examples/ws-api-client.ts](./examples/ws-api-client.ts) for a demonstration.
46
+
- Heavy automated end-to-end testing with real API calls.
42
47
- Proxy support via axios integration.
43
48
- Active community support & collaboration in telegram: [Node.js Algo Traders](https://t.me/nodetraders).
44
49
50
+
## Table of Contents
51
+
52
+
-[Installation](#installation)
53
+
-[Examples](#examples)
54
+
-[Issues & Discussion](#issues--discussion)
55
+
-[Related Projects](#related-projects)
56
+
-[Documentation](#documentation)
57
+
-[Structure](#structure)
58
+
-[Usage](#usage)
59
+
-[REST API Client](#rest-api)
60
+
-[WebSocket Client](#websockets)
61
+
-[WebSocket Data Streams](#websocket-data-streams)
62
+
-[WebSocket API](#websocket-api)
63
+
-[Event Driven API](#event-driven-api)
64
+
-[REST-like API](#rest-like-api)
65
+
-[Customise Logging](#customise-logging)
66
+
-[LLMs & AI](#use-with-llms--ai)
67
+
-[Contributions & Thanks](#contributions--thanks)
68
+
45
69
## Installation
46
70
47
71
`npm install --save gateio-api`
48
72
73
+
## Examples
74
+
75
+
Refer to the [examples](./examples) folder for implementation demos, including:
76
+
77
+
-**REST API Examples**: spot trading, futures trading, account management
78
+
-**WebSocket Examples**: public market data streams, private account data, WebSocket API usage
-**Futures Trading**: perpetual and delivery futures examples
81
+
-**WebSocket API**: both event-driven and promise-driven approaches
82
+
49
83
## Issues & Discussion
50
84
51
85
- Issues? Check the [issues tab](https://github.com/tiagosiebler/gateio-api/issues).
@@ -76,9 +110,16 @@ Check out my related JavaScript/TypeScript/Node.js projects:
76
110
77
111
## Documentation
78
112
79
-
Most methods accept JS objects. These can be populated using parameters specified by gateio's API documentation.
113
+
Most methods accept JS objects. These can be populated using parameters specified by Gate.com's API documentation, or check the type definition in each class within this repository.
114
+
115
+
### API Documentation Links
80
116
81
117
-[Gate.com/gate.io API Documentation](https://www.gate.com/docs/developers/apiv4/en/)
-[REST Endpoint Function List](./docs/endpointFunctionList.md)
83
124
-[TSDoc Documentation (autogenerated using typedoc)](https://tsdocs.dev/docs/gateio-api)
84
125
@@ -93,11 +134,13 @@ This project uses typescript. Resources are stored in 2 key structures:
93
134
94
135
# Usage
95
136
96
-
Create API credentials
137
+
Create API credentials on Gate.com's website:
97
138
98
139
-[Gate.com API Key Management](https://www.gate.com/myaccount/api_key_manage)
99
140
100
-
### REST API
141
+
## REST API
142
+
143
+
The SDK provides a unified `RestClient` for all Gate.com trading products including Spot, Margin, Perpetual Futures, Delivery Futures, and Options. This single client handles all REST API operations across all trading markets.
101
144
102
145
To use any of Gate.com's REST APIs in JavaScript/TypeScript/Node.js, import (or require) the `RestClient`:
103
146
@@ -138,6 +181,19 @@ See [RestClient](./src/RestClient.ts) for further information, or the [examples]
138
181
139
182
## WebSockets
140
183
184
+
All WebSocket functionality is supported via the unified `WebsocketClient`. This client handles all Gate.com WebSocket streams with automatic connection management and reconnection.
185
+
186
+
Key WebSocket features:
187
+
188
+
- Event driven messaging
189
+
- Smart WebSocket persistence with automatic reconnection
190
+
- Heartbeat mechanisms to detect disconnections
191
+
- Automatic resubscription after reconnection
192
+
- Support for all Gate.com trading products (Spot, Margin, Futures, Options)
193
+
- WebSocket API support for real-time trading operations
194
+
195
+
### WebSocket Data Streams
196
+
141
197
All available WebSockets can be used via a shared `WebsocketClient`. The WebSocket client will automatically open/track/manage connections as needed. Each unique connection (one per server URL) is tracked using a WsKey (each WsKey is a string - see [WS_KEY_MAP](src/lib/websocket/websocket-util.ts) for a list of supported values).
142
198
143
199
Any subscribe/unsubscribe events will need to include a WsKey, so the WebSocket client understands which connection the event should be routed to. See examples below or in the [examples](./examples/) folder on GitHub.
0 commit comments