कीमत की जानकारी टेलीग्राम पर भेजें

लेखक:घास, दिनांक: 2018-11-09 15:55:30
टैगःअध्ययनपुश संदेश

शिक्षा की रणनीतिः जब सिक्का की कीमत सेट मूल्य से ऊपर या नीचे हो जाती है, तो स्वचालित रूप से एक संदेश को WeChat पर धक्का दिया जाता है। न्यूनतम धक्का अंतराल सेट किया जा सकता है।

जब मुद्रा की कीमत सेट मूल्य से अधिक या कम होती है, तो एक संदेश स्वचालित रूप से वीचैट या टेलीग्राम पर धकेल दिया जाता है। न्यूनतम धक्का अंतराल सेट किया जा सकता है।


/*
This stragegy will sent a message to your telegram when the price is higher or lower than
the set price.
All stragegy must has a main function as the entrance.
*/
function main() {
     //change symbol,will cover the default exchange which was set when start a bot.Currency is a strategy arguments
    exchange.IO("currency", Currency)   
    var lastPushTime = 0    //the variable of last push timestamp.
    while(true){    //run a infinite loop, which is the basic structure
        var ticker = _C(exchange.GetTicker) // for information about GetTicker, check on https://fmz-docs.readthedocs.io/en/latest/code_Instruction/Market%20API.html#getticker
        if(ticker.Last > UpPrice || ticker.Last < LowPrice){    //ticker.Last represents the last deal price
            if(Date.now() - lastPushTime > 300*1000){    //only push once in 5 mins, Date.now() return ms.
                lastPushTime = Date.now()    //update lastPushTime
                Log(Currency, 'Price is: ', ticker.Last, '@')    //Log the price on the bot's page and sent the message. '@' in the end means push message
            }
        }
        Log(Currency, 'Price is: ', ticker.Last) //just log the price
        Sleep(Interval*1000)    //check the last price again after Interval seconds
    }
}

संबंधित

अधिक

एक सुपरमैन थ्रेशोल्ड बनायाक्यों रोबोट चल रहा है और जांचकर्ताओं के साथ संवाद नहीं कर रहा है?

परिश्रम करनाविदेशी मित्रों को पढ़ने में आसानी के लिए अंग्रेजी शीर्षक जोड़ने की सिफारिश की गई है

निगरानी करनाजब समीक्षा की गई, तो प्लेटफॉर्म का चयन कैसे किया गया, छोटा सफेद थोड़ा आक्रामक था।

घासमैं नहीं कर सकता, मैं कीमतों को आगे बढ़ाने के लिए वापस परीक्षण करना चाहता हूं।