forked from tiagosiebler/binance
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrest-spot-public.ts
36 lines (31 loc) · 1011 Bytes
/
rest-spot-public.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import { MainClient } from '../src/index';
// or
// import { MainClient } from 'binance';
const client = new MainClient({
// Optional (default: false) - when true, response strings are parsed to floats (only for known keys).
// beautifyResponses: true,
});
(async () => {
try {
// console.log(
// 'getAvgPrice: ',
// await client.getAvgPrice({ symbol: 'BTCUSDT' }),
// );
// console.log(
// 'getExchangeInfo: ',
// JSON.stringify(await client.getExchangeInfo(), null, 2),
// );
const oneTicker = await client.get24hrChangeStatististics({
symbol: 'BTCUSDT',
});
console.log('getTickers', oneTicker);
const manyTickers = await client.get24hrChangeStatististics({
symbols: ['BTCUSDT', 'ETHUSDT'],
});
console.log('getTickers many', manyTickers);
const allTickers = await client.get24hrChangeStatististics();
console.log('getTickers all', allTickers);
} catch (e) {
console.error('request failed: ', e);
}
})();