feat(): update basic spot/futures examples with initial types

This commit is contained in:
Tiago Siebler
2023-11-14 12:15:26 +00:00
parent b1b3ee926e
commit ea8fac777e
19 changed files with 499 additions and 63 deletions

View File

@@ -1,14 +1,14 @@
import { SpotClient, WebsocketClient } from '../src/index';
import { RestClientV2, WebsocketClient } from '../src/index';
// or
// import { SpotClient } from 'bitget-api';
// import { RestClientV2 } from 'bitget-api';
// read from environmental variables
const API_KEY = process.env.API_KEY_COM;
const API_SECRET = process.env.API_SECRET_COM;
const API_PASS = process.env.API_PASS_COM;
const client = new SpotClient({
const client = new RestClientV2({
apiKey: API_KEY,
apiSecret: API_SECRET,
apiPass: API_PASS,
@@ -20,7 +20,7 @@ const client = new SpotClient({
/** This is a simple script wrapped in a immediately invoked function expression, designed to check for any available BTC balance and immediately sell the full amount for USDT */
(async () => {
try {
console.log(await client.getApiKeyInfo());
console.log(await client.getSpotAccount());
} catch (e) {
console.error('request failed: ', e);
}