liquibook icon indicating copy to clipboard operation
liquibook copied to clipboard

Issue in usage of fill_cost when quantity is in decimal places.

Open Gordon-TheTurtle opened this issue 5 years ago • 0 comments

In cb_order_fill callback:

Cost fill_cost = cb.price * cb.quantity;
Both price and quantity have been multiplied their respective precisions to convert to int64_t: i.e. price = 100.00 USD -> 10000, quantity 5.00 -> 500

so according to the formula fill_cost is 10000 * 500 -> 5000000 or 50000.00 which is wrong,

Correct fill_cost = 100.00 * 5.00 = 500.00

It would be better to not calculate fill_cost as there is no need for it in liquibook and save computation.

Gordon-TheTurtle avatar Jun 22 '19 09:06 Gordon-TheTurtle