Observed since 20 Oct, 22:28 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
Library for retrieving and syncing a remote orderbook locally
Package to help fetch orders from a remote source (Standard Relayer API, Mesh) and keep the local orderbook synced and up-to-date.
Supported Order Providers:
yarn add @0x/orderbook
Import
import { Orderbook } from '@0x/orderbook';
or
var Orderbook = require('@0x/orderbook').Orderbook;
If your project is in TypeScript, add the following to your tsconfig.json:
"compilerOptions": {
"typeRoots": ["node_modules/@0x/typescript-typings/types", "node_modules/@types"],
}
// Create an orderbook for makerAssetData, takerAssetData using the SRA Polling Order Provider
// This Provider polls the SRA endpoint automatically every 5 seconds on the supplied asset pairs
const orderbook = Orderbook.getOrderbookForPollingProvider({
httpEndpoint: 'https://sra.0x.org/v2',
pollingIntervalMs: 5000,
});
const orders = await orderbook.getOrdersAsync(makerAssetData, takerAssetData);
// Create an orderbook for makerAssetData, takerAssetData using the SRA Websocket Order Provider
// This provider subscribes via websocket to receive order updates on the supplied asset pairs
const orderbook = Orderbook.getOrderbookForWebsocketProvider({
httpEndpoint: 'https://sra.0x.org/v2',
websocketEndpoint: 'wss://ws.sra.0x.org',
});
const orders = await orderbook.getOrdersAsync(makerAssetData, takerAssetData);
// Create an orderbook for makerAssetData, takerAssetData using the Mesh Order Provider
// This provider subscribes via websocket to receive order updates on all orders stored in Mesh
const orderbook = Orderbook.getOrderbookForMeshProvider({
websocketEndpoint: 'wss://MESH_ENDPOINT',
});
const orders = await orderbook.getOrdersAsync(makerAssetData, takerAssetData);
We welcome improvements and fixes from the wider community! To report bugs within this package, please create an issue in this repository.
Please read our contribution guidelines before getting started.
If you don't have yarn workspaces enabled (Yarn < v1.0) - enable them:
yarn config set workspaces-experimental true
Then install dependencies
yarn install
To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:
PKG=@0x/orderbook yarn build
Or continuously rebuild on change:
PKG=@0x/orderbook yarn watch
yarn clean
yarn lint
yarn test
Download counts and popularity will appear here as the collector receives them.
| Version | Published | Direct dependencies | Open version |
|---|---|---|---|
| 2.2.7Registry latest | 15 Jul 2020 | 19 | |
| 2.2.6 | 24 Jun 2020 | 19 | |
| 2.2.5 | 3 Mar 2020 | 19 | |
| 2.2.4 | 27 Feb 2020 | 19 | |
| 2.2.3 | 26 Feb 2020 | 19 | |
| 2.2.2 | 25 Feb 2020 | 19 | |
| 2.2.1 | 15 Feb 2020 | 19 | |
| 2.2.0 | 8 Feb 2020 | 19 | |
| 2.1.2 | 6 Feb 2020 | 19 | |
| 2.1.1 | 4 Feb 2020 | 19 | |
| 2.1.0 | 22 Jan 2020 | 19 | |
| 2.0.1 | 6 Jan 2020 | 19 | |
| 2.0.0 | 17 Dec 2019 | 19 | |
| 1.0.1 | 9 Dec 2019 | 19 | |
| 1.0.0 | 2 Dec 2019 | 19 | |
| 0.1.0-beta.4 | 2 Dec 2019 | 19 | |
| 0.1.0-beta.3 | 20 Nov 2019 | 19 | |
| 0.1.0-beta.2 | 17 Nov 2019 | 17 | |
| 0.1.0-beta.1 | 7 Nov 2019 | 15 | |
| 0.1.0-beta.0 | 3 Oct 2019 | 15 |
This describes our collected data; it is not a security assessment.
Observed since 20 Oct, 22:28 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package:7912dceb1e0b59fbeff71356ae71851b43b819e19061be073232e98f679148d7