mirror of
https://github.com/discountry/ritmex-bot.git
synced 2026-09-11 09:18:08 +00:00
commit
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
// Example code in typescript
|
||||
// Based on /examples/js/fetch-okex-futures.js
|
||||
|
||||
import * as ccxt from 'ccxt';
|
||||
const log = require('ololog');
|
||||
|
||||
const fetchFutures = async () => {
|
||||
const exchange = new ccxt.bitmex();
|
||||
exchange.markets = await exchange.loadMarkets(true);
|
||||
|
||||
for (let symbol in exchange.markets) {
|
||||
log('----------------------------------------------------');
|
||||
log(`symbol = ${symbol}`);
|
||||
try {
|
||||
const market = exchange.markets[symbol];
|
||||
if (market['future']) {
|
||||
const ticker = await exchange.fetchTicker(symbol);
|
||||
log('----------------------------------------------------');
|
||||
log(symbol, ticker);
|
||||
await (ccxt as any).sleep(exchange.rateLimit); // Missing type information.
|
||||
}
|
||||
} catch (error) {
|
||||
log('error =', error);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
fetchFutures();
|
||||
Reference in New Issue
Block a user