feat(): update basic spot/futures examples with initial types
This commit is contained in:
@@ -1,14 +1,14 @@
|
||||
import { FuturesClient, 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 FuturesClient({
|
||||
const client = new RestClientV2({
|
||||
apiKey: API_KEY,
|
||||
apiSecret: API_SECRET,
|
||||
apiPass: API_PASS,
|
||||
@@ -21,15 +21,14 @@ const client = new FuturesClient({
|
||||
(async () => {
|
||||
try {
|
||||
const now = new Date();
|
||||
const toTime = new Date(now.getTime() - 24 * 60 * 60 * 1000);
|
||||
const fromTime = new Date(now.getTime() - 24 * 60 * 60 * 1000);
|
||||
|
||||
console.log(
|
||||
await client.getAccountBill({
|
||||
symbol: 'BTCUSDT_UMCBL',
|
||||
marginCoin: 'USDT',
|
||||
startTime: now.getTime() + '', // should be sent as a string
|
||||
endTime: toTime.getTime() + '', // should be sent as a string
|
||||
pageSize: 100,
|
||||
await client.getFuturesAccountBills({
|
||||
productType: 'USDT-FUTURES',
|
||||
startTime: fromTime.getTime() + '', // should be sent as a string
|
||||
endTime: now.getTime() + '', // should be sent as a string
|
||||
limit: '100',
|
||||
}),
|
||||
);
|
||||
} catch (e) {
|
||||
|
||||
Reference in New Issue
Block a user