Skip to content

boblancer/exchange

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Boblancer Exchange Engine

Zipmex code challenge

Installation

Run with docker

  docker build -t boblancer-zipmex .
  docker run boblancer-zipmex:latest

Library (npm)

  • Mocha, Sinon (Testing)
  • sorted-btree (B+ tree for internal storage)

Testing and validation

  to debug the application you may add console log to the new test function

taken from tests/matching_engine/order_book.ts:30

describe('OrderBook local integration(input.json output.json)', function() {
	const input: {[key: string]: any} = require('./input.json');
	const output: {[key: string]: any} = require('./output.json');

	it('input 1 from input.json return correct output.json', function() {
		let book = new OrderBook();
		createOrderFromJson(input[0].orders, book)
		const expected: OrderBookResponse = output[0]

		let result = JSON.stringify(book.listOrder())
		console.log(result)
		assert.equal(result, JSON.stringify(expected));
	});
	it('input 2 from input.json return correct output.json', function() {
		let book = new OrderBook();
		createOrderFromJson(input[1].orders, book)
		const expected: OrderBookResponse = output[1]

		let result = JSON.stringify(book.listOrder())
		assert.equal(result, JSON.stringify(expected));
	});

	it('input 3 from input.json return correct output.json', function() {
		let book = new OrderBook();
		createOrderFromJson(input[2].orders, book)
		const expected: OrderBookResponse = output[2]

		let result = JSON.stringify(book.listOrder())
		assert.equal(result, JSON.stringify(expected));
	});

	it('input 4 from input.json return correct output.json', function() {
		let book = new OrderBook();
		createOrderFromJson(input[3].orders, book)
		const expected: OrderBookResponse = output[3]

		let result = JSON.stringify(book.listOrder())
		assert.equal(result, JSON.stringify(expected));
	});
	});
});

image

Internal Reference

Flowchart

image

Operation runtime complexity currently in use

Operation Cost Used In
Insert O(log n) _createNewOrder()
Delete(Root) O(t log n) _fillOrder()
Find(Root) O(1) _fillOrder() & _processOrder()

Internal data storage

image

References

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published