Author

Topic: [REQUEST] Alarm for Mt gox Lag (Read 1075 times)

hero member
Activity: 535
Merit: 500
March 31, 2013, 03:09:56 PM
#6
got u
newbie
Activity: 46
Merit: 0
March 30, 2013, 05:44:21 PM
#5
1A1dhB53bFh2n11VJG8kt6SawY5b7Biuzb

Thanks
hero member
Activity: 535
Merit: 500
March 30, 2013, 11:32:41 AM
#4
thanks a lot mrlithium post your address and ill hook you up. jp i hope you'll keep your offer on the table because i still may be interested since you are offering additional functionality.
newbie
Activity: 46
Merit: 0
March 30, 2013, 05:06:42 AM
#3
#!/usr/bin/env python
#Alarm lag#
# Created 3/30/2013

import urllib2
import json
import winsound         #plays beeps for alerts
import time

from decimal import Decimal as D    #renamed to D for simplicity.

url = "https://data.mtgox.com/api/1/generic/order/lag"
req = urllib2.Request(url)

threshhold = raw_input("Lag Alarm Threshhold? (in seconds):  ")
threshhold = int(threshhold)
delaytime = raw_input("How often do you want to check? (in seconds):  ")
delaytime = int(delaytime)
while True:                                 #infinite loop
    resp = urllib2.urlopen(req)
    data = json.load(resp)

    lag = D(str(data["return"]["lag_secs"]))

    if lag >= D(threshhold):
        while True:
            for x in range(2,25):           # create a sequence of beeps
                winsound.Beep(x*100,100)    # each beep is at x*100hz for 100ms
            time.sleep(5)                   # repeat the alarm every 5 seconds
    print "The lag was normal. %s seconds" % lag
    time.sleep(delaytime)                   # pause for however long specified


Just download python 2.7.3, save the above script and run the script from the windows command prompt. (ie: python mtgox_alarm.py)
newbie
Activity: 29
Merit: 0
March 29, 2013, 11:21:45 PM
#2
I'll take that on, it sounds pretty straightforward.  I'm sending you a private message to discuss details.
hero member
Activity: 535
Merit: 500
March 29, 2013, 09:35:07 AM
#1
can anyone take the api information for lag and set up an alarm to go off if it gets above a certain time? This doesnt seem too difficult but i will offer a .1btc bounty
Jump to: