@@ -34,6 +34,16 @@ function Round(num)
3434 return string.format (' %.' .. idp .. ' f' , num )
3535end
3636
37+ function RoundWithPrecision (num , idp )
38+ if num == ' ' then
39+ return num
40+ end
41+
42+ num = tonumber (num )
43+
44+ return string.format (' %.' .. idp .. ' f' , num )
45+ end
46+
3747function RoundPercent (num )
3848 if num == ' ' then
3949 return num
6777function OnRequestParsed ()
6878 local MeasureCoinLastUpdated = SKIN :GetMeasure (' MeasureCoinLastUpdated' )
6979 local date = MeasureCoinLastUpdated :GetStringValue ()
80+ local coinSymbol = SKIN :GetMeasure (' MeasureCoinSymbol' ):GetStringValue ()
7081
82+ -- Set icon based on the symbol
83+ SKIN :Bang (' !SetOption' , ' MeterIcon' , ' ImageName' , ' #@#icons/' .. coinSymbol .. ' .png' )
84+
7185 -- Set formatted date
7286 SKIN :Bang (' !SetOption' , ' MeasureCoinLastUpdatedFormatted' , ' String' , FormatDate (date ))
7387
@@ -83,6 +97,30 @@ function OnRequestParsed()
8397
8498 local MeasureCoinChange7D = SKIN :GetMeasure (' MeasureCoinChange7D' )
8599 SKIN :Bang (' !SetOption' , ' MeasureCoinChange7DRounded' , ' String' , RoundPercent (MeasureCoinChange7D :GetStringValue ()))
100+
101+ assetsOwned = tonumber (SKIN :GetVariable (' AssetsOwned' ))
102+ assetsValue = tonumber (SKIN :GetVariable (' AssetsValue' ))
103+
104+ if assetsOwned then
105+ currency = SKIN :GetVariable (' Currency' )
106+
107+ -- Set assets owned and total current value
108+ SKIN :Bang (' !SetOption' , ' MeasureAssetsOwned' , ' String' , assetsOwned .. ' ' .. coinSymbol .. ' | ' .. currency .. ' ' .. Round (assetsOwned * tonumber (MeasureCoinPrice :GetStringValue ())))
109+ SKIN :Bang (' !ShowMeter' , ' MeterAssetsOwned' )
110+
111+ -- If assets value is set also show profit percent
112+ if assetsValue then
113+ assetsProfit = assetsOwned * tonumber (MeasureCoinPrice :GetStringValue ()) - assetsValue
114+ assetsIncrease = (assetsProfit / assetsValue ) * 100
115+
116+ SKIN :Bang (' !SetOption' , ' MeasureAssetsIncrease' , ' String' , currency .. ' ' .. RoundWithPrecision (assetsProfit , 2 ) .. ' | ' .. RoundPercent (assetsIncrease ) .. ' %' )
117+ SKIN :Bang (' !SetOption' , ' MeterAssetsIncrease' , ' FontColor' , ' 5eb160' )
118+ if assetsProfit < 0 then
119+ SKIN :Bang (' !SetOption' , ' MeterAssetsIncrease' , ' FontColor' , ' ff4b48' )
120+ end
121+ SKIN :Bang (' !ShowMeter' , ' MeterAssetsIncrease' )
122+ end
123+ end
86124end
87125
88126function GetTimezoneDiff ()
0 commit comments