@melonproject/exchange-aggregator
Aggregates orderbooks across various exchanges.
Last updated a year ago by fubhy .
GPL-3.0 · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @melonproject/exchange-aggregator 
SYNC missed versions from official npm registry.

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);

Current Tags

  • 0.1.20                                ...           latest (a year ago)

42 Versions

  • 0.1.20                                ...           a year ago
  • 0.1.19                                ...           a year ago
  • 2.0.0-alpha2                                ...           a year ago
  • 2.0.0-alpha1                                ...           a year ago
  • 1.0.6                                ...           a year ago
  • 1.0.5                                ...           a year ago
  • 1.0.4                                ...           a year ago
  • 1.0.3                                ...           a year ago
  • 1.0.2                                ...           a year ago
  • 1.0.1                                ...           a year ago
  • 1.0.0                                ...           a year ago
  • 0.1.18                                ...           a year ago
  • 0.1.17                                ...           a year ago
  • 0.1.16                                ...           2 years ago
  • 0.1.15                                ...           2 years ago
  • 0.1.14                                ...           2 years ago
  • 0.1.13                                ...           2 years ago
  • 0.1.12                                ...           2 years ago
  • 0.1.11                                ...           2 years ago
  • 0.1.10                                ...           2 years ago
  • 0.1.9                                ...           2 years ago
  • 0.1.8                                ...           2 years ago
  • 0.1.7                                ...           2 years ago
  • 0.1.6                                ...           2 years ago
  • 0.1.5                                ...           2 years ago
  • 0.1.4                                ...           2 years ago
  • 0.1.3                                ...           2 years ago
  • 0.1.2                                ...           2 years ago
  • 0.1.1                                ...           2 years ago
  • 0.1.0                                ...           2 years ago
  • 0.0.12                                ...           2 years ago
  • 0.0.11                                ...           2 years ago
  • 0.0.10                                ...           2 years ago
  • 0.0.9                                ...           2 years ago
  • 0.0.8                                ...           2 years ago
  • 0.0.7                                ...           2 years ago
  • 0.0.6                                ...           2 years ago
  • 0.0.5                                ...           2 years ago
  • 0.0.4                                ...           2 years ago
  • 0.0.3                                ...           2 years ago
  • 0.0.2                                ...           2 years ago
  • 0.0.1                                ...           2 years ago
Maintainers (2)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (7)
Dev Dependencies (20)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |