Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,8 @@ client
});
```

WebSocket TestNet: set `useTestnet: true` on `WebsocketClient`.

See [RestClient](./src/RestClient.ts) for further information, or the [examples](./examples/) for lots of usage examples.

## WebSockets
Expand Down
8 changes: 3 additions & 5 deletions docs/GATE_SDK_QUICKSTART_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -1738,11 +1738,9 @@ Gate TestNet is a separate environment with separate credentials. Use it for all
| REST API | `https://api-testnet.gateapi.io/api/v4` |
| Spot WebSocket | `wss://ws-testnet.gate.com/v4/ws/spot` |
| USDT perpetual WebSocket | `wss://ws-testnet.gate.com/v4/ws/futures/usdt` |
| Options WebSocket | `wss://ws-testnet.gate.com/v4/ws/options` |

Set the REST API host with `baseUrl` and the WebSocket host with `wsUrl`. Prefer explicit hosts for TestNet examples:

- Spot WebSocket TestNet is not wired through `useTestnet: true` in this SDK. The Spot testnet map entry is a stub (`NoTestnetForSpotWebsockets!`), so set `wsUrl` to the Spot TestNet host above.
- For Futures-only REST TestNet, the SDK also accepts `baseUrlKey: 'futuresTestnet'`, which resolves to `https://fx-api-testnet.gateio.ws/api/v4`. The Global TestNet REST host in the table is the host used by the Spot and Futures order examples in this guide.
For WebSocket TestNet, set `useTestnet: true`.

```javascript
import { RestClient, WebsocketClient } from 'gateio-api';
Expand All @@ -1756,7 +1754,7 @@ const rest = new RestClient({
const spotWs = new WebsocketClient({
apiKey: process.env.GATE_TESTNET_API_KEY,
apiSecret: process.env.GATE_TESTNET_API_SECRET,
wsUrl: 'wss://ws-testnet.gate.com/v4/ws/spot',
useTestnet: true,
});
```

Expand Down
896 changes: 448 additions & 448 deletions docs/endpointFunctionList.md

Large diffs are not rendered by default.

19 changes: 1 addition & 18 deletions examples/Rest/futures/testnet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,7 @@ const account = {
const gateRestClient = new RestClient({
apiKey: account.key,
apiSecret: account.secret,
/**
* To use a different base URL, use the baseUrl key. The SDK uses the live environment by default:
* baseUrlKey: 'live',
*'https://api.gateio.ws/api/v4'
* But you can force it to use any of the available environments. Examples below.
*/

/*
* Futures TestNet trading:
* 'https://fx-api-testnet.gateio.ws/api/v4'
*/
baseUrlKey: 'futuresTestnet',

/**
* Futures live trading alternative (futures only):
* 'https://fx-api.gateio.ws/api/v4'
*/
// baseUrlKey: 'futuresLiveAlternative'
baseUrl: 'https://api-testnet.gateapi.io/api/v4',
});

async function submitFuturesOrder() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { RestClient } from 'gateio-api';

// This example shows how to call this Gate.io API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "gateio-api" for Gate.io exchange
// This Gate.io API SDK is available on npm via "npm install gateio-api"
// ENDPOINT: /futures/{settle}/price_orders/amend
// ENDPOINT: /futures/{settle}/price_orders/amend/{order_id}
// METHOD: PUT
// PUBLIC: NO

Expand Down
Loading
Loading