0.1.20 • Published 5 years ago
@melonproject/exchange-aggregator v0.1.20
Exchange aggregator
Installation
# With yarn
yarn add @melonproject/exchange-aggregator
# With npm
npm install @melonproject/exchange-aggregator
Usage example
Please note, that not all asset pairs are available on all exchanges.
import { createToken } from '@melonproject/token-math';
import { Network, exchanges, aggregateOrders, createOrderbook } from '@melonproject/exchange-aggregator';
const options = {
network: Network.MAINNET,
pair: {
// The token pair is used for constructing the proper
// requests (e.g. endpoint urls) and calculations in
// token-math.
base: createToken('ZRX', undefined, 18),
quote: createToken('WETH', undefined, 18),
},
};
const environment = constructEnvironment({
endpoint: 'ws://localhost:8545',
});
const promises = await Promise.all([
exchanges.radarrelay.fetch(options),
// Some exchanges require extra configuration.
exchanges.oasisdex.fetch({
...options,
environment,
}),
]);
// Concatenate the api responses into a single array.
const orders = [].concat(...promises);
// Aggregate all orders into a sorted orderbook with
// cummulative volume information.
const orderbook = createOrderbook(options, orders);
0.1.20
5 years ago
0.1.19
5 years ago
2.0.0-alpha2
5 years ago
2.0.0-alpha1
5 years ago
1.0.6
5 years ago
1.0.5
5 years ago
1.0.4
5 years ago
1.0.3
5 years ago
1.0.2
5 years ago
1.0.1
5 years ago
1.0.0
5 years ago
0.1.18
5 years ago
0.1.17
5 years ago
0.1.16
5 years ago
0.1.15
5 years ago
0.1.14
5 years ago
0.1.13
5 years ago
0.1.12
5 years ago
0.1.11
5 years ago
0.1.10
5 years ago
0.1.9
5 years ago
0.1.8
5 years ago
0.1.7
5 years ago
0.1.6
5 years ago
0.1.5
5 years ago
0.1.4
5 years ago
0.1.3
5 years ago
0.1.2
5 years ago
0.1.1
5 years ago
0.1.0
5 years ago
0.0.12
5 years ago
0.0.11
5 years ago
0.0.10
5 years ago
0.0.9
5 years ago
0.0.8
5 years ago
0.0.7
5 years ago
0.0.6
5 years ago
0.0.5
5 years ago
0.0.4
5 years ago
0.0.3
5 years ago
0.0.2
5 years ago
0.0.1
5 years ago