8000 GitHub - dylanbienenstock/exchange-network: Provides classes and types for reconstructing multiple limit order books across multiple exchanges
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Provides classes and types for reconstructing multiple limit order books across multiple exchanges

Notifications You must be signed in to change notification settings

dylanbienenstock/exchange-network

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@dbstock/exchange-network

Dependencies Status Build Status Coverage Status

Provides classes and types for reconstructing multiple limit order books across multiple exchanges.

This project is very new and very incomplete but fully usable in its current state.

  • Use npm run build to build the project using the Typescript compiler.
  • Use npm test to run unit tests with Alsatian.
  • Use npm run coverage to generate coverage reports using Istanbul.

Usage 📈

let network = new ExchangeNetwork();
let exchange = network.addExchange("Coinbase Pro");
let pair = { base: "BTC", quote: "USD" };
let market = exchange.addMarket(pair);

// The following 4 function calls do the same thing

network.recordOrder({
    exchangeName: "Coinbase Pro",
    pair: pair,
    side: Side.Bid,
    price: 4000,
    amount: 0.275
});

exchange.recordOrder({
    pair: pair,
    side: Side.Bid,
    price: 4100,
    amount: 1.655
});

market.orderBook.record({
    side: Side.Bid,
    price: 4200,
    amount: 2.3
});

market.orderBook.bids.record({
    price: 4300,
    amount: 1.705
});


let allBids = market.orderBook.bids.toArray();
let bestBid = network.getBestBidFor(pair);

console.log("All bids ⮯ \n", allBids);
console.log("\nBest bid ⮯");
console.log("Exchange name:", bestBid.exchange.name);
console.log("Price:", bestBid.price);
console.log("Amount:", bestBid.amount);

Output

All bids ⮯ 
 [ { price: 4000, amount: [ 0.275 ] },
  { price: 4100, amount: [ 1.655 ] },
  { price: 4200, amount: [ 2.3 ] },
  { price: 4300, amount: [ 1.705 ] } ]

Best bid ⮯
Exchange name: Coinbase Pro
Price: 4300
Amount: 1.705

About

Provides classes and types for reconstructing multiple limit order books across multiple exchanges

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0