diff --git a/examples/futures-balance-trade.ts b/examples/Rest/futures/futures-balance-trade.ts similarity index 96% rename from examples/futures-balance-trade.ts rename to examples/Rest/futures/futures-balance-trade.ts index f784622..1883a1b 100644 --- a/examples/futures-balance-trade.ts +++ b/examples/Rest/futures/futures-balance-trade.ts @@ -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 = { @@ -68,7 +68,7 @@ async function subscribePrivateWs() { return true; } catch (e) { - console.error(`Req error: `, e); + console.error('Req error: ', e); throw e; } } @@ -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); diff --git a/examples/futures/getBalances.ts b/examples/Rest/futures/getBalances.ts similarity index 80% rename from examples/futures/getBalances.ts rename to examples/Rest/futures/getBalances.ts index 82942a2..fc01216 100644 --- a/examples/futures/getBalances.ts +++ b/examples/Rest/futures/getBalances.ts @@ -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 @@ -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 } } diff --git a/examples/futures/getOrders.ts b/examples/Rest/futures/getOrders.ts similarity index 85% rename from examples/futures/getOrders.ts rename to examples/Rest/futures/getOrders.ts index a2da624..07be711 100644 --- a/examples/futures/getOrders.ts +++ b/examples/Rest/futures/getOrders.ts @@ -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 @@ -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 } } diff --git a/examples/futures/getTickers.ts b/examples/Rest/futures/getTickers.ts similarity index 84% rename from examples/futures/getTickers.ts rename to examples/Rest/futures/getTickers.ts index 7806f93..04c8ac8 100644 --- a/examples/futures/getTickers.ts +++ b/examples/Rest/futures/getTickers.ts @@ -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 @@ -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 } } diff --git a/examples/futures/submitLimitOrder.ts b/examples/Rest/futures/submitLimitOrder.ts similarity index 83% rename from examples/futures/submitLimitOrder.ts rename to examples/Rest/futures/submitLimitOrder.ts index d934457..3c84e20 100644 --- a/examples/futures/submitLimitOrder.ts +++ b/examples/Rest/futures/submitLimitOrder.ts @@ -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 @@ -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 } } diff --git a/examples/futures/submitMarketOrder.ts b/examples/Rest/futures/submitMarketOrder.ts similarity index 83% rename from examples/futures/submitMarketOrder.ts rename to examples/Rest/futures/submitMarketOrder.ts index b4d8349..967c2ca 100644 --- a/examples/futures/submitMarketOrder.ts +++ b/examples/Rest/futures/submitMarketOrder.ts @@ -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 @@ -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 } } diff --git a/examples/futures/testnet.ts b/examples/Rest/futures/testnet.ts similarity index 87% rename from examples/futures/testnet.ts rename to examples/Rest/futures/testnet.ts index 3cbf8b5..8fb22c4 100644 --- a/examples/futures/testnet.ts +++ b/examples/Rest/futures/testnet.ts @@ -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 @@ -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 } } diff --git a/examples/spot/getBalances.ts b/examples/Rest/spot/getBalances.ts similarity index 79% rename from examples/spot/getBalances.ts rename to examples/Rest/spot/getBalances.ts index 1189f14..724be49 100644 --- a/examples/spot/getBalances.ts +++ b/examples/Rest/spot/getBalances.ts @@ -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 @@ -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 } } diff --git a/examples/spot/getCandles.ts b/examples/Rest/spot/getCandles.ts similarity index 80% rename from examples/spot/getCandles.ts rename to examples/Rest/spot/getCandles.ts index 74b59c6..5f65a84 100644 --- a/examples/spot/getCandles.ts +++ b/examples/Rest/spot/getCandles.ts @@ -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 @@ -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 } } diff --git a/examples/spot/getOrders.ts b/examples/Rest/spot/getOrders.ts similarity index 85% rename from examples/spot/getOrders.ts rename to examples/Rest/spot/getOrders.ts index 1adc617..54e8c28 100644 --- a/examples/spot/getOrders.ts +++ b/examples/Rest/spot/getOrders.ts @@ -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 @@ -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 } } diff --git a/examples/spot/getTickers.ts b/examples/Rest/spot/getTickers.ts similarity index 82% rename from examples/spot/getTickers.ts rename to examples/Rest/spot/getTickers.ts index 565fdf2..43a4035 100644 --- a/examples/spot/getTickers.ts +++ b/examples/Rest/spot/getTickers.ts @@ -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 @@ -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 } } diff --git a/examples/spot/submitLimitOrder.ts b/examples/Rest/spot/submitLimitOrder.ts similarity index 84% rename from examples/spot/submitLimitOrder.ts rename to examples/Rest/spot/submitLimitOrder.ts index 7f65151..8601795 100644 --- a/examples/spot/submitLimitOrder.ts +++ b/examples/Rest/spot/submitLimitOrder.ts @@ -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 @@ -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 } } diff --git a/examples/spot/submitMarketOrder.ts b/examples/Rest/spot/submitMarketOrder.ts similarity index 83% rename from examples/spot/submitMarketOrder.ts rename to examples/Rest/spot/submitMarketOrder.ts index 2fbaebc..9254a00 100644 --- a/examples/spot/submitMarketOrder.ts +++ b/examples/Rest/spot/submitMarketOrder.ts @@ -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 @@ -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 } } diff --git a/examples/ws-api-client.ts b/examples/Websocket/WS-API/ws-api-client.ts similarity index 99% rename from examples/ws-api-client.ts rename to examples/Websocket/WS-API/ws-api-client.ts index ec85aa8..ba1f9f9 100644 --- a/examples/ws-api-client.ts +++ b/examples/Websocket/WS-API/ws-api-client.ts @@ -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 = { diff --git a/examples/ws-private-perp-futures-wsapi.ts b/examples/Websocket/WS-API/ws-private-perp-futures-wsapi.ts similarity index 98% rename from examples/ws-private-perp-futures-wsapi.ts rename to examples/Websocket/WS-API/ws-private-perp-futures-wsapi.ts index bfa6561..76f28ab 100644 --- a/examples/ws-private-perp-futures-wsapi.ts +++ b/examples/Websocket/WS-API/ws-private-perp-futures-wsapi.ts @@ -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 = { @@ -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); } } diff --git a/examples/ws-private-spot-wsapi.ts b/examples/Websocket/WS-API/ws-private-spot-wsapi.ts similarity index 98% rename from examples/ws-private-spot-wsapi.ts rename to examples/Websocket/WS-API/ws-private-spot-wsapi.ts index 75a8092..b36f5c0 100644 --- a/examples/ws-private-spot-wsapi.ts +++ b/examples/Websocket/WS-API/ws-private-spot-wsapi.ts @@ -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 @@ -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); } } diff --git a/examples/ws-private-perp-futures.ts b/examples/Websocket/ws-private-perp-futures.ts similarity index 96% rename from examples/ws-private-perp-futures.ts rename to examples/Websocket/ws-private-perp-futures.ts index 604f85f..1d69b1b 100644 --- a/examples/ws-private-perp-futures.ts +++ b/examples/Websocket/ws-private-perp-futures.ts @@ -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 = { @@ -107,7 +107,7 @@ async function start() { 'perpFuturesUSDTV4', ); } catch (e) { - console.error(`Req error: `, e); + console.error('Req error: ', e); } } diff --git a/examples/ws-private-spot.ts b/examples/Websocket/ws-private-spot.ts similarity index 96% rename from examples/ws-private-spot.ts rename to examples/Websocket/ws-private-spot.ts index 59d9671..76df020 100644 --- a/examples/ws-private-spot.ts +++ b/examples/Websocket/ws-private-spot.ts @@ -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 @@ -126,7 +126,7 @@ async function start() { 'spotV4', ); } catch (e) { - console.error(`Req error: `, e); + console.error('Req error: ', e); } } diff --git a/examples/ws-public.ts b/examples/Websocket/ws-public.ts similarity index 96% rename from examples/ws-public.ts rename to examples/Websocket/ws-public.ts index cb52c7a..39324cc 100644 --- a/examples/ws-public.ts +++ b/examples/Websocket/ws-public.ts @@ -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 = { @@ -97,7 +97,7 @@ async function start() { // 'spotV4', // ); } catch (e) { - console.error(`Req error: `, e); + console.error('Req error: ', e); } }