gateio-api 1.2.3 → 1.2.5
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 +71 -9
- package/llms.txt +11574 -0
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -20,32 +20,66 @@
|
|
|
20
20
|
|
|
21
21
|
Updated & performant JavaScript & Node.js SDK for the Gate.com (gate.io) REST APIs and WebSockets:
|
|
22
22
|
|
|
23
|
+
- Professional, robust & performant Gate.com SDK with extensive production use in live trading environments.
|
|
23
24
|
- Extensive integration with Gate.com (Gate.io) REST APIs and WebSockets.
|
|
24
|
-
- TypeScript support (with type declarations for most API requests & responses).
|
|
25
|
+
- Complete TypeScript support (with type declarations for most API requests & responses).
|
|
26
|
+
- Strongly typed requests and responses.
|
|
27
|
+
- Automated end-to-end tests ensuring reliability.
|
|
28
|
+
- Actively maintained with a modern, promise-driven interface.
|
|
25
29
|
- Gate.com REST APIs for Gate.com Spot, Margin, Perpetual Futures, Delivery Futures, Options & Announcements APIs.
|
|
30
|
+
- Unified RestClient for all Gate.com trading products.
|
|
26
31
|
- Strongly typed on most requests and responses.
|
|
27
|
-
- Extremely robust & performant JavaScript/Node.js Gate.com SDK.
|
|
28
|
-
- Actively maintained with a modern, promise-driven interface.
|
|
29
32
|
- Support for seamless API authentication for private Gate.com REST API and WebSocket calls.
|
|
30
|
-
-
|
|
33
|
+
- 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
|
-
-
|
|
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
|
|
79
|
+
- **Spot Trading**: comprehensive spot market examples
|
|
80
|
+
- **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
|
|
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/)
|
|
118
|
+
- [Spot Trading API](https://www.gate.com/docs/developers/apiv4/en/#spot-new)
|
|
119
|
+
- [Margin Trading API](https://www.gate.com/docs/developers/apiv4/en/#margin-new)
|
|
120
|
+
- [Futures Trading API](https://www.gate.com/docs/developers/apiv4/en/#futures-new)
|
|
121
|
+
- [Options Trading API](https://www.gate.com/docs/developers/apiv4/en/#options-new)
|
|
122
|
+
- [WebSocket API](https://www.gate.com/docs/developers/apiv4/en/#websocket-api)
|
|
82
123
|
- [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
|
-
|
|
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.
|
|
@@ -375,6 +431,12 @@ DefaultLogger.silly = () => {};
|
|
|
375
431
|
const ws = new WebsocketClient({ key: 'xxx', secret: 'yyy' }, DefaultLogger);
|
|
376
432
|
```
|
|
377
433
|
|
|
434
|
+
## Use with LLMs & AI
|
|
435
|
+
|
|
436
|
+
This SDK includes a bundled `llms.txt` file in the root of the repository. If you're developing with LLMs, use the included `llms.txt` with your LLM - it will significantly improve the LLMs understanding of how to correctly use this SDK.
|
|
437
|
+
|
|
438
|
+
This file contains AI optimised structure of all the functions in this package, and their parameters for easier use with any learning models or artificial intelligence.
|
|
439
|
+
|
|
378
440
|
---
|
|
379
441
|
|
|
380
442
|
<!-- template_contributions -->
|