param { * } valueNow param { * } value24HoursAgo param { * } value48HoursAgo export const get2DayChange = ( valueNow , value24HoursAgo , value48HoursAgo ) : [ number , number ] => { const currentChange = parseFloat ( valueNow ) - parseFloat ( value24HoursAgo ) ; const previousChange = parseFloat ( value24HoursAgo ) - parseFloat ( value48HoursAgo ) ; const adjustedPercentChange = ( ( currentChange - previousChange ) / previousChange ) * 100 ; if ( isNaN ( adjustedPercentChange ) || ! isFinite ( adjustedPercentChange ) ) { return [ currentChange , 0 ] ; } return [ currentChange , adjustedPercentChange ] ; } ; param { * } valueNow param { * } value24HoursAgo export const getPercentChange = ( valueNow , value24HoursAgo ) : number => { if ( valueNow && value24HoursAgo ) { const change = ( ( parseFloat ( valueNow ) - parseFloat ( value24HoursAgo ) ) / parseFloat ( value24HoursAgo ) ) * 100 ; if ( isFinite ( change ) ) return change ; } return 0 ; } ;