0bps

Strategy vault / Tools & templates

BTC LTC Address Monitoring SMS Notification

There are new transactions, please be reminded immediately

Author
Zero
Complexity
Intermediate · 53 lines
Parameters
7

There are new transactions, please be reminded immediately

Parameters

NameDefaultWhat it controls
Type0Type: BTC | LTC
Addr1LuckyY9fRzcJre7aou7ZhWVXktxjjBb9SAddress
Interval3Polling Interval
EnableSMSfalseEnable SMS notifications
SMSUser***SMSBao username
SMSPass***SMS MD5 password
PhoneNum1111Receive SMS mobile number

Source JavaScript

var LastMsg = "";
function SMSSend(msg) {
    if (msg == LastMsg) {
        return true;
    }
    Log('SMS:', msg);
    LastMsg = msg;
    var ret = false;
    var phones = PhoneNum.split(',');
    for (var i = 0; i < phones.length; i++) {
        ret = HttpQuery("http://www.smsbao.com/sms?u=" + encodeURIComponent(SMSUser) + "&p=" + SMSPass.toUpperCase() + "&m=" + phones[i] + "&c=" + encodeURIComponent(msg)) == "0";
        if (ret) {
            Log("SMS Notification", phones[i], "Success");
        } else {
            Log("SMS Notification", phones[i], "Failed");
        }
    }
    return ret;
}

function main() {
    var url = "http://open.qukuai.com/address/" + Addr + "?key=2ejf4jgfNoya8Y3GnQf68e4J23HherpUh1&limit=1";
    if (Type == 1) {
        url += "&ltc=true";
    }
    var lt = "";
    Log("Monitor: ", Addr, Type == 0 ? 'BTC' : 'LTC');
    if (EnableSMS) {
        if (!SMSSend("Strategy started successfully")) {
            return false;
        }
    }
    while (true) {
        try {
            var res = HttpQuery(url);
            if (res) {
                var obj = JSON.parse(res);
                if (typeof(obj.t0) !='undefined' && obj.t0.length > 0) {
                    if (obj.t0.toString() != lt) {
                        if (lt != "") {
                            LogProfit(obj.balance, obj.received);
                            if (EnableSMS) SMSSend('New Transaction, Current Balance: ' + obj.balance/100000000 + 'Total Received: ' + obj.received/100000000);
                        }
                        lt = obj.t0.toString();
                    }
                }
            }
        } catch(e) {
            Log(e);
        }
        Sleep(Interval*1000);
    }
}

Published by Zero on the FMZ strategy square · last modified 2014-11-07. Collected in the Quant Trading Vault. Unvalidated research: re-test with your own data and costs before trusting it.

Build this with AgenKit

A spec is not a trading system. Paste this into your coding agent and AgenKit runs a specialist team — architecture, test-first build, risk gates, review — with paper trading on by default.

in Claude Code, Cursor, Codex & 4 more
/agenkit build a tested, production-ready module from strategies/BTC-LTC-Address-Monitoring-SMS-Notification.md
  1. npx agenkit install engineering-kit in your project
  2. Paste the command into your agent and approve each phase
  3. Get tests, backtest, risk controls and a paper-trading switch

Understand it first

Before you run this, read the lesson behind the idea and how to backtest it honestly. Specs like this one are the survivors of an unknown number of trials; deflate their results accordingly.

Related specs

esc

Try , , or .

↑↓ move↵ open