Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
**/

// Import the RestClient and WebsocketClient from the published version of this SDK, installed via NPM (npm install gateio-api)
import { RestClient, WebsocketClient } from 'gateio-api';
import { RestClient, WebsocketClient } from '../../../src/index.js';

// Define the account object with API key and secret
const account = {
Expand Down Expand Up @@ -68,7 +68,7 @@ async function subscribePrivateWs() {

return true;
} catch (e) {
console.error(`Req error: `, e);
console.error('Req error: ', e);
throw e;
}
}
Expand All @@ -82,7 +82,7 @@ async function main() {
const balances = await gateRestClient.getFuturesAccount({ settle: 'usdt' });

// total usdt balance
const usdtBalance = Number(balances.total);
// const usdtBalance = Number(balances.total);

// available usdt balance
const availableBalance = Number(balances.available);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { RestClient } from '../../src'; // For an easy demonstration, import from the src dir. Normally though, see below to import from the npm installed version instead.
import { RestClient } from '../../../src/index.js'; // For an easy demonstration, import from the src dir. Normally though, see below to import from the npm installed version instead.
// import { RestClient } from 'gateio-api'; // Import the RestClient from the published version of this SDK, installed via NPM (npm install gateio-api)

// Define the account object with API key and secret
Expand All @@ -22,7 +22,7 @@ async function getFuturesBalances() {

console.log('Response: ', result); // Log the response to the console
} catch (e) {
console.error(`Error in execution: `, e); // Log any errors that occur
console.error('Error in execution: ', e); // Log any errors that occur
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { RestClient } from '../../src'; // For an easy demonstration, import from the src dir. Normally though, see below to import from the npm installed version instead.
import { RestClient } from '../../../src/index.js'; // For an easy demonstration, import from the src dir. Normally though, see below to import from the npm installed version instead.
// import { RestClient } from 'gateio-api'; // Import the RestClient from the published version of this SDK, installed via NPM (npm install gateio-api)

// Define the account object with API key and secret
Expand Down Expand Up @@ -31,7 +31,7 @@ async function getFuturesOrders() {
});
console.log('finishedOrders: ', finishedOrders); // Log the response to the console
} catch (e) {
console.error(`Error in execution: `, e); // Log any errors that occur
console.error('Error in execution: ', e); // Log any errors that occur
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { RestClient } from '../../src'; // For an easy demonstration, import from the src dir. Normally though, see below to import from the npm installed version instead.
import { RestClient } from '../../../src/index.js'; // For an easy demonstration, import from the src dir. Normally though, see below to import from the npm installed version instead.
// import { RestClient } from 'gateio-api'; // Import the RestClient from the published version of this SDK, installed via NPM (npm install gateio-api)

// Define the account object with API key and secret
Expand Down Expand Up @@ -30,7 +30,7 @@ async function getFuturesTicker() {
});
console.log('ticker: ', ticker); // Log the response to the console
} catch (e) {
console.error(`Error in execution: `, e); // Log any errors that occur
console.error('Error in execution: ', e); // Log any errors that occur
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { RestClient } from '../../src'; // For an easy demonstration, import from the src dir. Normally though, see below to import from the npm installed version instead.
import { RestClient } from '../../../src/index.js'; // For an easy demonstration, import from the src dir. Normally though, see below to import from the npm installed version instead.
// import { RestClient } from 'gateio-api'; // Import the RestClient from the published version of this SDK, installed via NPM (npm install gateio-api)

// Define the account object with API key and secret
Expand Down Expand Up @@ -28,7 +28,7 @@ async function submitFuturesOrder() {

console.log('Response: ', result); // Log the response to the console
} catch (e) {
console.error(`Error in execution: `, e); // Log any errors that occur
console.error('Error in execution: ', e); // Log any errors that occur
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { RestClient } from '../../src'; // For an easy demonstration, import from the src dir. Normally though, see below to import from the npm installed version instead.
import { RestClient } from '../../../src/index.js'; // For an easy demonstration, import from the src dir. Normally though, see below to import from the npm installed version instead.
// import { RestClient } from 'gateio-api'; // Import the RestClient from the published version of this SDK, installed via NPM (npm install gateio-api)

// Define the account object with API key and secret
Expand Down Expand Up @@ -28,7 +28,7 @@ async function submitFuturesOrder() {

console.log('Response: ', result); // Log the response to the console
} catch (e) {
console.error(`Error in execution: `, e); // Log any errors that occur
console.error('Error in execution: ', e); // Log any errors that occur
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { RestClient } from '../../src/index.js'; // For an easy demonstration, import from the src dir. Normally though, see below to import from the npm installed version instead.
import { RestClient } from '../../../src/index.js'; // For an easy demonstration, import from the src dir. Normally though, see below to import from the npm installed version instead.
// import { RestClient } from 'gateio-api'; // Import the RestClient from the published version of this SDK, installed via NPM (npm install gateio-api)

// Define the account object with API key and secret
Expand Down Expand Up @@ -46,7 +46,7 @@ async function submitFuturesOrder() {

console.log('Response: ', result); // Log the response to the console
} catch (e) {
console.error(`Error in execution: `, e); // Log any errors that occur
console.error('Error in execution: ', e); // Log any errors that occur
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { RestClient } from '../../src'; // For an easy demonstration, import from the src dir. Normally though, see below to import from the npm installed version instead.
import { RestClient } from '../../../src/index.js'; // For an easy demonstration, import from the src dir. Normally though, see below to import from the npm installed version instead.
// import { RestClient } from 'gateio-api'; // Import the RestClient from the published version of this SDK, installed via NPM (npm install gateio-api)

// Define the account object with API key and secret
Expand All @@ -21,7 +21,7 @@ async function getSpotBalances() {
const balances = await gateRestClient.getSpotAccounts();
console.log('Response: ', balances); // Log the response to the console
} catch (e) {
console.error(`Error in execution: `, e); // Log any errors that occur
console.error('Error in execution: ', e); // Log any errors that occur
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { RestClient } from '../../src'; // For an easy demonstration, import from the src dir. Normally though, see below to import from the npm installed version instead.
import { RestClient } from '../../../src/index.js'; // For an easy demonstration, import from the src dir. Normally though, see below to import from the npm installed version instead.
// import { RestClient } from 'gateio-api'; // Import the RestClient from the published version of this SDK, installed via NPM (npm install gateio-api)

// Define the account object with API key and secret
Expand All @@ -24,7 +24,7 @@ async function getSpotCandles() {
});
console.log('Response: ', balances); // Log the response to the console
} catch (e) {
console.error(`Error in execution: `, e); // Log any errors that occur
console.error('Error in execution: ', e); // Log any errors that occur
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { RestClient } from '../../src'; // For an easy demonstration, import from the src dir. Normally though, see below to import from the npm installed version instead.
import { RestClient } from '../../../src/index.js'; // For an easy demonstration, import from the src dir. Normally though, see below to import from the npm installed version instead.
// import { RestClient } from 'gateio-api'; // Import the RestClient from the published version of this SDK, installed via NPM (npm install gateio-api)

// Define the account object with API key and secret
Expand Down Expand Up @@ -31,7 +31,7 @@ async function getSpotOrders() {
});
console.log('finishedOrders: ', finishedOrders); // Log the response to the console
} catch (e) {
console.error(`Error in execution: `, e); // Log any errors that occur
console.error('Error in execution: ', e); // Log any errors that occur
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { RestClient } from '../../src'; // For an easy demonstration, import from the src dir. Normally though, see below to import from the npm installed version instead.
import { RestClient } from '../../../src/index.js'; // For an easy demonstration, import from the src dir. Normally though, see below to import from the npm installed version instead.
// import { RestClient } from 'gateio-api'; // Import the RestClient from the published version of this SDK, installed via NPM (npm install gateio-api)

// Define the account object with API key and secret
Expand Down Expand Up @@ -27,7 +27,7 @@ async function getSpotTicker() {
const allTickers = await gateRestClient.getSpotTicker();
console.log('Response: ', allTickers); // Log the response to the console
} catch (e) {
console.error(`Error in execution: `, e); // Log any errors that occur
console.error('Error in execution: ', e); // Log any errors that occur
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { RestClient } from '../../src'; // For an easy demonstration, import from the src dir. Normally though, see below to import from the npm installed version instead.
import { RestClient } from '../../../src/index.js'; // For an easy demonstration, import from the src dir. Normally though, see below to import from the npm installed version instead.
// import { RestClient } from 'gateio-api'; // Import the RestClient from the published version of this SDK, installed via NPM (npm install gateio-api)

// Define the account object with API key and secret
Expand Down Expand Up @@ -29,7 +29,7 @@ async function submitSpotOrder() {

console.log('Response: ', result); // Log the response to the console
} catch (e) {
console.error(`Error in execution: `, e); // Log any errors that occur
console.error('Error in execution: ', e); // Log any errors that occur
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { RestClient } from '../../src/index.js'; // For an easy demonstration, import from the src dir. Normally though, see below to import from the npm installed version instead.
import { RestClient } from '../../../src/index.js'; // For an easy demonstration, import from the src dir. Normally though, see below to import from the npm installed version instead.
// import { RestClient } from 'gateio-api'; // Import the RestClient from the published version of this SDK, installed via NPM (npm install gateio-api)

// Define the account object with API key and secret
Expand Down Expand Up @@ -28,7 +28,7 @@ async function submitSpotOrder() {

console.log('Response: ', result); // Log the response to the console
} catch (e) {
console.error(`Error in execution: `, e); // Log any errors that occur
console.error('Error in execution: ', e); // Log any errors that occur
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { WebsocketAPIClient, WS_KEY_MAP } from '../src/index.js';
import { WebsocketAPIClient, WS_KEY_MAP } from '../../../src/index.js';
// import { LogParams, WebsocketClient } from 'gateio-api'; // normally you should install this module via npm: `npm install gateio-api`

const account = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable @typescript-eslint/no-unused-vars */

import { LogParams, WebsocketClient } from '../src/index.js';
import { LogParams, WebsocketClient } from '../../../src/index.js';
// import { LogParams, WebsocketClient } from 'gateio-api'; // normally you should install this module via npm: `npm install gateio-api`

const account = {
Expand Down Expand Up @@ -226,7 +226,7 @@ async function start() {

console.log(new Date(), 'Result: ', getStatus);
} catch (e) {
console.error(`WS API Error: `, e);
console.error('WS API Error: ', e);
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable @typescript-eslint/no-unused-vars */

import { LogParams, WebsocketClient } from '../src/index.js';
import { LogParams, WebsocketClient } from '../../../src/index.js';
// import { LogParams, WebsocketClient } from 'gateio-api'; // normally you should install this module via npm: `npm install gateio-api`

// eslint-disable-next-line @typescript-eslint/no-unused-vars
Expand Down Expand Up @@ -215,7 +215,7 @@ async function start() {
// console.error(`exception ws api call, get spot order status: `, e);
// });
} catch (e) {
console.error(`WS API Error: `, e);
console.error('WS API Error: ', e);
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable @typescript-eslint/no-unused-vars */
import { LogParams, WebsocketClient, WsTopicRequest } from '../src/index.js';
import { LogParams, WebsocketClient, WsTopicRequest } from '../../src/index.js';
// import { LogParams, WebsocketClient, WsTopicRequest } from 'gateio-api'; // normally you should install this module via npm: `npm install gateio-api`

const account = {
Expand Down Expand Up @@ -107,7 +107,7 @@ async function start() {
'perpFuturesUSDTV4',
);
} catch (e) {
console.error(`Req error: `, e);
console.error('Req error: ', e);
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable @typescript-eslint/no-unused-vars */
import { LogParams, WebsocketClient, WsTopicRequest } from '../src/index.js';
import { LogParams, WebsocketClient, WsTopicRequest } from '../../src/index.js';
// import { LogParams, WebsocketClient, WsTopicRequest } from 'gateio-api'; // normally you should install this module via npm: `npm install gateio-api`

// eslint-disable-next-line @typescript-eslint/no-unused-vars
Expand Down Expand Up @@ -126,7 +126,7 @@ async function start() {
'spotV4',
);
} catch (e) {
console.error(`Req error: `, e);
console.error('Req error: ', e);
}
}

Expand Down
4 changes: 2 additions & 2 deletions examples/ws-public.ts → examples/Websocket/ws-public.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import { WebsocketClient, WsTopicRequest } from '../src/index.js';
import { WebsocketClient, WsTopicRequest } from '../../src/index.js';
// import { LogParams, WebsocketClient, WsTopicRequest } from 'gateio-api'; // normally you should install this module via npm: `npm install gateio-api`

// const customLogger = {
Expand Down Expand Up @@ -97,7 +97,7 @@ async function start() {
// 'spotV4',
// );
} catch (e) {
console.error(`Req error: `, e);
console.error('Req error: ', e);
}
}

Expand Down
Loading