In the current implementation on the strategy card grid and in the price tooltip, we show 6 decimal places if the price is less than 1 and 2 decimal places if the price is 1 or greater. This creates a precision issue, as some prices display only 2 decimal places, while showing the differences between these prices requires exposing more decimal places.
Example
Strategy overview card
Price tooltip
Therefore in cases when the price grid is very narrow and requires the 3rd, 4th, 5th or 6th decimal to indicate difference, we would like to increase decimal visibility and show higher precision prices.
Implementation:
Note that the below logic should be applied to the following:
price values on the grid
buy and sell price tooltips
Steps to Determine Decimal Places:
NOTE: we should
IF maxSell - minBuy >1,
[True] display 2 decimals. //this will allow gaps of more than 1 unit to display 2 decimals which is sufficient
[False] else, display 6 decimal after the last non zero value //this will allow to display small gaps with high precision while applying the subscript if needed.
Examples
Given the strategy overview card grid and sell price tooltip examples in the overview section
maxSell: 1.000500000000000672293211306007000873418655194639054916625613448333785358652768944304238066464084981
trimMaxSell = apply subscript rule on the number: 1.000500
minBuy: 0.999499999999995715780598558949538517518149610577459147388312832305246047326363623142242431640625
trimMinBuy = apply subscript rule on the number: 0.999499
Strategy overview card current display:
Price points: 0.999531, 0.999844, 1.00, 1.00
Market price: 1.00
After applying the new logic:
IF trimMaxSell - trimMinBuy > 1 -> 1.000500 - 0.999499 > 1 -> 0.001001 > 1 -> FALSE
- False means display 6 decimals
- Price points: 0.999531, 0.999844, 1.000157, 1.000470
- Market price: 1.000287
- Tool tip Min price: 0.9996
- Tool tip Max price: 1.000515
- Marginal price: 0.999601
example 2:
MaxSell: 0.000001220940000000008086519912133522506399816617167150749792984412588073873640980634536939227676159288583
trimMaxSell = apply subscript rule on the number: 0.00000122094
minBuy: 0.0000011876018281898164606504723305566401008793488147663452991764643229544162750244140625
trimMinBuy = apply subscript rule on the number: 0.00000118760
After applying the new logic:
IF trimMaxSell - trimMinBuy > 1 -> 0.00000122094 - 0.00000118760 > 1 -> 0.00000003334 > 1 -> FALSE
- False means display 6 decimals after the first non zero value
Overview
In the current implementation on the strategy card grid and in the price tooltip, we show 6 decimal places if the price is less than 1 and 2 decimal places if the price is 1 or greater. This creates a precision issue, as some prices display only 2 decimal places, while showing the differences between these prices requires exposing more decimal places.
Example
Strategy overview card
Price tooltip
Therefore in cases when the price grid is very narrow and requires the 3rd, 4th, 5th or 6th decimal to indicate difference, we would like to increase decimal visibility and show higher precision prices.
Implementation:
Note that the below logic should be applied to the following:
Steps to Determine Decimal Places:
NOTE: we should IF maxSell - minBuy >1, [True] display 2 decimals. //this will allow gaps of more than 1 unit to display 2 decimals which is sufficient [False] else, display 6 decimal after the last non zero value //this will allow to display small gaps with high precision while applying the subscript if needed.