Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- tell application "JSON Helper"
- --Monitor the amount of SC owned
- set walletWithoutSiaMining to 0
- set binance to 0
- set siaMiningData to fetch JSON from "http://mining.luxor.tech/API/SC/user/ff2412ae9d0b15b6005a79f1143dd5eea02ee60b8baa544666124ce44fc770a08e15b461c747/" with cleaning feed
- set siaMiningTotalPaid to (total_payouts) of siaMiningData as real
- set siaMiningBalance to (balance) of siaMiningData as real
- set totalSC to walletWithoutSiaMining + binance + siaMiningTotalPaid + siaMiningBalance
- set binanceScBtcData to fetch JSON from "https://www.binance.com/api/v3/ticker/price?symbol=SCBTC" with cleaning feed
- set binanceScBtcPrice to price of binanceScBtcData as real
- set binanceBtcUsdtData to fetch JSON from "https://www.binance.com/api/v3/ticker/price?symbol=BTCUSDT" with cleaning feed
- set binanceBtcUsdtPrice to price of binanceBtcUsdtData as real
- set dollarPriceOfSc to binanceScBtcPrice * binanceBtcUsdtPrice
- set totalSC to (my number_to_string(totalSC))
- set totalSC to round (totalSC * 10000)
- set totalPriceOfMySC to round (totalSC * dollarPriceOfSc)
- set totalDelimitedSC to do shell script "echo " & totalSC & " | perl -lpe'1 while s/^([-+]?\\d+)(\\d{3})/$1,$2/'"
- return ("" & totalDelimitedSC & " SC ($" & totalPriceOfMySC & ")")
- end tell
- on number_to_string(this_number)
- set this_number to this_number as string
- if this_number contains "E+" then
- set x to the offset of "." in this_number
- set y to the offset of "+" in this_number
- set z to the offset of "E" in this_number
- set the decimal_adjust to characters (y - (length of this_number)) thru ¬
- -1 of this_number as string as number
- if x is not 0 then
- set the first_part to characters 1 thru (x - 1) of this_number as string
- else
- set the first_part to ""
- end if
- set the second_part to characters (x + 1) thru (z - 1) of this_number as string
- set the converted_number to the first_part
- repeat with i from 1 to the decimal_adjust
- try
- set the converted_number to the converted_number & character i of the second_part
- on error
- set the converted_number to the converted_number & "0"
- end try
- end repeat
- return the converted_number
- else
- return this_number
- end if
- end number_to_string
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement