Coin amount alert

stable
By mimaflexi in Miscellaneous Published June 2024 👁 525 views 💬 0 comments

Description

http://127.0.0.1:8090/Public/Scripts/7b077bd3ed774a1cb968a02a299f23e4
HaasScript
-- coin amount alert
-- Author: MiMaFlexi

--[[

It monitors balance of selected coin, and when it falls/rise below/above the specified limit, 
the script will notify via Discord/Telegram about the current balance on the account.

dependencies: CC_broadcast (https://www.haasscripts.com/t/lightly-extended-broadcast/)

]]

HideTradeAmountSettings()
HideOrderSettings()

local cfCoinToWatch = Input("What coin to watch", "BNB")
local cfBiggerSmaller =  InputOptions("If amount is", "smaller than", {"smaller than", "bigger than"})
local cfMinAmount = Input("amount", 0.5)
local cfName = Input("Name of account", "", "this will be in broadcast")
local cfBroadcastTo = InputOptions("Broadcast to","all",{"all", "discord", "telegram"},"Where to broadcast")

if not init then 
    init = true 
else
OptimizedForInterval(0, function()
    local currentAmount = BalanceAmount(AccountGuid(),cfCoinToWatch,PriceMarket())
    local msg = "--"
    local shortMsg = "ok"
    if  (
            cfBiggerSmaller == "smaller than" and 
            cfMinAmount > currentAmount
        )
        or 
        (
            cfBiggerSmaller == "bigger than" and 
            cfMinAmount < currentAmount
        )
        then             
            if cfBiggerSmaller == "smaller than" 
                then 
                    msg = "Low amount of" 
                    shortMsg = "!! LOW BALANCE !!"
            elseif cfBiggerSmaller == "bigger than" 
                then 
                    msg = "High amount of"
                    shortMsg = "!! HIGH BALANCE !!"
            end
            CC_broadcast(msg.." "..cfCoinToWatch..". account: "..cfName..", current amount: "..currentAmount..", trigger amount: "..cfMinAmount,false,"all")
            CustomReport("balance",shortMsg,"Status",true)
        else 
            Log("current amount is ok ("..currentAmount.." "..cfCoinToWatch..")")
            CustomReport("balance",shortMsg,"Status",true)
    end
end)
end

0 Comments

Sign in to leave a comment.

No comments yet. Be the first!