Live order board is Javascript/ typescript utility library that provides helper functions to place, cancel crypto orders. Also, you can get your all orders summary.
Live order board example.
npm i live-order-board-crypto-inc
You can send order request to BUY or SELL crypto. E.g.
{
userId: 'user 1',
coinType: 'Bitcoin',
orderQuantity: 100,
pricePerCoin: '£40',
orderType: 'Buy',
}
You can view top 10 orders in summary. Orders summary is organised using following assumptions:
- Buy orders are organised in
DESC
order ofpricePerCoin
. - Sell orders are organised in
ASC
order ofpricePerCoin
. - Orders of same
pricePerCoin
andcoinType
are merged usingorderQuantity
for both buy & sell orders.
**NOTE: In requirement document it has been mentioned to merge orders using pricePerCoin
. But, I've considered merging them using both pricePerCoin
& coinType
. This can be change by making simple change in createOrdersSummary
function.
import { placeOrder } from 'live-order-board-crypto-inc';
const orderId = placeOrder({
userId: 'user 1',
coinType: 'Bitcoin',
orderQuantity: 100,
pricePerCoin: '£40',
orderType: 'Buy',
});
import { cancelOrder } from 'live-order-board-crypto-inc';
cancelOrder('orderId');
import { getOrdersSummary } from 'live-order-board-crypto-inc';
getOrdersSummary(count);
"count" is optional. Default order summary count is 10.