live-order-board-crypto-inc
v2.0.1
Published
The Cyrto Inc. 'Live Order Board' supports Placing BUY/ SELL order, CANCEL order & View the top 10 orders.
Downloads
25
Maintainers
Readme
Live order board
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.
Install
npm i live-order-board-crypto-inc
Place order
You can send order request to BUY or SELL crypto. E.g.
{
userId: 'user 1',
coinType: 'Bitcoin',
orderQuantity: 100,
pricePerCoin: '£40',
orderType: 'Buy',
}
Orders summary
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.
Usage
Place Order
import { placeOrder } from 'live-order-board-crypto-inc';
const orderId = placeOrder({
userId: 'user 1',
coinType: 'Bitcoin',
orderQuantity: 100,
pricePerCoin: '£40',
orderType: 'Buy',
});
Cancel Order
import { cancelOrder } from 'live-order-board-crypto-inc';
cancelOrder('orderId');
Orders Summary
import { getOrdersSummary } from 'live-order-board-crypto-inc';
getOrdersSummary(count);
"count" is optional. Default order summary count is 10.