coinbase-api 1.1.0 → 1.1.2
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 -20
- package/llms.txt +10153 -0
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -20,26 +20,62 @@
|
|
|
20
20
|
|
|
21
21
|
Updated & performant JavaScript & Node.js SDK for the Coinbase REST APIs and WebSockets:
|
|
22
22
|
|
|
23
|
-
-
|
|
24
|
-
|
|
25
|
-
- [Coinbase
|
|
26
|
-
- [Coinbase
|
|
27
|
-
- [Coinbase
|
|
28
|
-
- [Coinbase
|
|
29
|
-
- [Coinbase
|
|
30
|
-
-
|
|
23
|
+
- Professional, robust & performant Coinbase SDK with extensive production use in live trading environments.
|
|
24
|
+
- Complete integration with all Coinbase APIs - supports both retail and institutional REST clients and WebSockets:
|
|
25
|
+
- [Coinbase Advanced Trade](https://docs.cdp.coinbase.com/advanced-trade/docs/welcome) - Modern trading platform
|
|
26
|
+
- [Coinbase App](https://docs.cdp.coinbase.com/coinbase-app/docs/welcome) - Consumer mobile/web application
|
|
27
|
+
- [Coinbase Exchange](https://docs.cdp.coinbase.com/exchange/docs/welcome) - Professional trading platform
|
|
28
|
+
- [Coinbase International Exchange](https://docs.cdp.coinbase.com/intx/docs/welcome) - International institutional trading
|
|
29
|
+
- [Coinbase Prime](https://docs.cdp.coinbase.com/prime/docs/welcome) - Institutional custody and trading
|
|
30
|
+
- [Coinbase Commerce](https://docs.cdp.coinbase.com/commerce-onchain/docs/welcome) - Payments and commerce solutions
|
|
31
|
+
- Complete TypeScript support (with type declarations for most API requests & responses).
|
|
32
|
+
- Strongly typed requests and responses.
|
|
33
|
+
- Automated end-to-end tests ensuring reliability.
|
|
34
|
+
- Actively maintained with a modern, promise-driven interface.
|
|
31
35
|
- Supports both ECDSA and ED25519 API keys with automatic key type detection.
|
|
32
|
-
- TypeScript support (with type declarations for most API requests & responses)
|
|
33
36
|
- Robust WebSocket integration with configurable connection heartbeats & automatic reconnect then resubscribe workflows.
|
|
37
|
+
- Event driven messaging.
|
|
38
|
+
- Smart WebSocket persistence with automatic reconnection handling.
|
|
39
|
+
- Emit `reconnected` event when dropped connection is restored.
|
|
40
|
+
- Support for both public and private WebSocket streams across all platforms.
|
|
34
41
|
- Automatically supports both ESM and CJS projects.
|
|
35
42
|
- Proxy support via axios integration.
|
|
43
|
+
- Heavy automated end-to-end testing with real API calls.
|
|
36
44
|
- Active community support & collaboration in telegram: [Node.js Algo Traders](https://t.me/nodetraders).
|
|
37
45
|
- Extensive examples for interacting with the Coinbase API offering in Node.js/JavaScript/TypeScript: [/examples/](./examples).
|
|
38
46
|
|
|
47
|
+
## Table of Contents
|
|
48
|
+
|
|
49
|
+
- [Installation](#installation)
|
|
50
|
+
- [Examples](#examples)
|
|
51
|
+
- [Issues & Discussion](#issues--discussion)
|
|
52
|
+
- [Related Projects](#related-projects)
|
|
53
|
+
- [Documentation](#documentation)
|
|
54
|
+
- [Structure](#structure)
|
|
55
|
+
- [Usage](#usage)
|
|
56
|
+
- [REST API Clients](#rest-api)
|
|
57
|
+
- [CBAdvancedTradeClient](#cbadvancedtradeclient)
|
|
58
|
+
- [CBAppClient](#cbappclient)
|
|
59
|
+
- [CBExchangeClient](#cbexchangeclient)
|
|
60
|
+
- [CBInternationalClient](#cbinternationalclient)
|
|
61
|
+
- [CBPrimeClient](#cbprimeclient)
|
|
62
|
+
- [CBCommerceClient](#cbcommerceclient)
|
|
63
|
+
- [WebSocket Client](#websockets)
|
|
64
|
+
- [Public WebSocket Streams](#public-websocket)
|
|
65
|
+
- [Private WebSocket Streams](#private-websocket)
|
|
66
|
+
- [WebSocket Event Handling](#listening-and-subscribing-to-websocket-events)
|
|
67
|
+
- [Customise Logging](#customise-logging)
|
|
68
|
+
- [LLMs & AI](#use-with-llms--ai)
|
|
69
|
+
- [Contributions & Thanks](#contributions--thanks)
|
|
70
|
+
|
|
39
71
|
## Installation
|
|
40
72
|
|
|
41
73
|
`npm install --save coinbase-api`
|
|
42
74
|
|
|
75
|
+
## Examples
|
|
76
|
+
|
|
77
|
+
Refer to the [examples](./examples) folder for implementation examples.
|
|
78
|
+
|
|
43
79
|
## Issues & Discussion
|
|
44
80
|
|
|
45
81
|
- Issues? Check the [issues tab](https://github.com/tiagosiebler/coinbase-api/issues).
|
|
@@ -70,11 +106,18 @@ Check out my related JavaScript/TypeScript/Node.js projects:
|
|
|
70
106
|
|
|
71
107
|
## Documentation
|
|
72
108
|
|
|
73
|
-
Most methods accept JS objects. These can be populated using parameters specified by Coinbase's API documentation.
|
|
109
|
+
Most methods accept JS objects. These can be populated using parameters specified by Coinbase's API documentation, or check the type definition in each class within this repository.
|
|
74
110
|
|
|
75
|
-
|
|
111
|
+
### API Documentation Links
|
|
112
|
+
|
|
113
|
+
- [Coinbase Developer Platform - Product APIs](https://docs.cdp.coinbase.com/product-apis/docs/welcome)
|
|
114
|
+
- [Advanced Trade API](https://docs.cdp.coinbase.com/advanced-trade/docs/welcome)
|
|
115
|
+
- [Coinbase App API](https://docs.cdp.coinbase.com/coinbase-app/docs/welcome)
|
|
116
|
+
- [Exchange API](https://docs.cdp.coinbase.com/exchange/docs/welcome)
|
|
117
|
+
- [International Exchange API](https://docs.cdp.coinbase.com/intx/docs/welcome)
|
|
118
|
+
- [Prime API](https://docs.cdp.coinbase.com/prime/docs/welcome)
|
|
119
|
+
- [Commerce API](https://docs.cdp.coinbase.com/commerce-onchain/docs/welcome)
|
|
76
120
|
- [REST Endpoint Function List](./docs/endpointFunctionList.md)
|
|
77
|
-
<!-- - [TSDoc Documentation (autogenerated using typedoc)](https://tsdocs.dev/docs/coinbase-api) -->
|
|
78
121
|
|
|
79
122
|
## Structure
|
|
80
123
|
|
|
@@ -87,11 +130,13 @@ This project uses typescript. Resources are stored in 2 key structures:
|
|
|
87
130
|
|
|
88
131
|
# Usage
|
|
89
132
|
|
|
90
|
-
Create API credentials
|
|
133
|
+
Create API credentials on Coinbase's website:
|
|
91
134
|
|
|
92
135
|
- [Coinbase API Key Management](https://www.coinbase.com/settings/api)
|
|
93
136
|
|
|
94
|
-
|
|
137
|
+
## REST API
|
|
138
|
+
|
|
139
|
+
The SDK provides dedicated REST clients for each of Coinbase's API groups. Each client is designed for specific use cases and user types:
|
|
95
140
|
|
|
96
141
|
To use any of Coinbase's REST APIs in JavaScript/TypeScript/Node.js, import (or require) the client you want to use. We currently support the following clients:
|
|
97
142
|
|
|
@@ -119,7 +164,7 @@ const advancedTradeCdpAPIKey = {
|
|
|
119
164
|
'-----BEGIN EC PRIVATE KEY-----\nADFGHmkgnjdfg16k165kuu1kdtyudtyjdtyjytj/ADFGHmkgnjdfg16k165kuu1kdtyudtyjdtyjytj+oAoGCCqGSM49\nAwEHoUQDQgAEhtAep/ADFGHmkgnjdfg16k165kuu1kdtyudtyjdtyjytj+bzduY3iYXEmj/KtCk\nADFGHmkgnjdfg16k165kuu1kdtyudtyjdtyjytj\n-----END EC PRIVATE KEY-----\n',
|
|
120
165
|
};
|
|
121
166
|
|
|
122
|
-
/*
|
|
167
|
+
/*
|
|
123
168
|
* You can add ECDSA keys like the example above, or ED25519 keys like the example below.
|
|
124
169
|
* Client will recognize both types of keys automatically.
|
|
125
170
|
* ED25519:
|
|
@@ -127,7 +172,7 @@ const advancedTradeCdpAPIKey = {
|
|
|
127
172
|
* name: 'your-api-key-id',
|
|
128
173
|
* privateKey: 'yourExampleApiSecretEd25519Version==',
|
|
129
174
|
* }
|
|
130
|
-
*/
|
|
175
|
+
*/
|
|
131
176
|
|
|
132
177
|
const client = new CBAdvancedTradeClient({
|
|
133
178
|
// Either pass the full JSON object that can be downloaded when creating your API keys
|
|
@@ -168,7 +213,7 @@ const CBAppKeys = {
|
|
|
168
213
|
'-----BEGIN EC PRIVATE KEY-----\nADFGHmkgnjdfg16k165kuu1kdtyudtyjdtyjytj/ADFGHmkgnjdfg16k165kuu1kdtyudtyjdtyjytj+oAoGCCqGSM49\nAwEHoUQDQgAEhtAep/ADFGHmkgnjdfg16k165kuu1kdtyudtyjdtyjytj+bzduY3iYXEmj/KtCk\nADFGHmkgnjdfg16k165kuu1kdtyudtyjdtyjytj\n-----END EC PRIVATE KEY-----\n',
|
|
169
214
|
};
|
|
170
215
|
|
|
171
|
-
/*
|
|
216
|
+
/*
|
|
172
217
|
* You can add ECDSA keys like the example above, or ED25519 keys like the example below.
|
|
173
218
|
* Client will recognize both types of keys automatically.
|
|
174
219
|
* ED25519:
|
|
@@ -176,7 +221,7 @@ const CBAppKeys = {
|
|
|
176
221
|
* name: 'your-api-key-id',
|
|
177
222
|
* privateKey: 'yourExampleApiSecretEd25519Version==',
|
|
178
223
|
* }
|
|
179
|
-
*/
|
|
224
|
+
*/
|
|
180
225
|
|
|
181
226
|
const client = new CBAppClient({
|
|
182
227
|
// Either pass the full JSON object that can be downloaded when creating your API keys
|
|
@@ -320,7 +365,7 @@ const advancedTradeCdpAPIKey = {
|
|
|
320
365
|
'-----BEGIN EC PRIVATE KEY-----\nADFGHmkgnjdfg16k165kuu1kdtyudtyjdtyjytj/ADFGHmkgnjdfg16k165kuu1kdtyudtyjdtyjytj+oAoGCCqGSM49\nAwEHoUQDQgAEhtAep/ADFGHmkgnjdfg16k165kuu1kdtyudtyjdtyjytj+bzduY3iYXEmj/KtCk\nADFGHmkgnjdfg16k165kuu1kdtyudtyjdtyjytj\n-----END EC PRIVATE KEY-----\n',
|
|
321
366
|
};
|
|
322
367
|
|
|
323
|
-
/*
|
|
368
|
+
/*
|
|
324
369
|
* You can add ECDSA keys like the example above, or ED25519 keys like the example below.
|
|
325
370
|
* Client will recognize both types of keys automatically.
|
|
326
371
|
* ED25519:
|
|
@@ -328,7 +373,7 @@ const advancedTradeCdpAPIKey = {
|
|
|
328
373
|
* name: 'your-api-key-id',
|
|
329
374
|
* privateKey: 'yourExampleApiSecretEd25519Version==',
|
|
330
375
|
* }
|
|
331
|
-
*/
|
|
376
|
+
*/
|
|
332
377
|
|
|
333
378
|
const client = new WebsocketClient({
|
|
334
379
|
// Either pass the full JSON object that can be downloaded when creating your API keys
|
|
@@ -496,6 +541,12 @@ const ws = new WebsocketClient(
|
|
|
496
541
|
);
|
|
497
542
|
```
|
|
498
543
|
|
|
544
|
+
## Use with LLMs & AI
|
|
545
|
+
|
|
546
|
+
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.
|
|
547
|
+
|
|
548
|
+
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.
|
|
549
|
+
|
|
499
550
|
---
|
|
500
551
|
|
|
501
552
|
<!-- template_contributions -->
|