Bitcoin Forum
December 14, 2024, 05:44:59 AM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: [REQUEST] Alarm for Mt gox Lag  (Read 1078 times)
podizzle (OP)
Hero Member
*****
Offline Offline

Activity: 535
Merit: 500



View Profile
March 29, 2013, 02:35:07 PM
 #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
J.P. Larocque
Newbie
*
Offline Offline

Activity: 29
Merit: 0


View Profile
March 30, 2013, 04:21:45 AM
 #2

I'll take that on, it sounds pretty straightforward.  I'm sending you a private message to discuss details.
mrlithium
Newbie
*
Offline Offline

Activity: 46
Merit: 0


View Profile
March 30, 2013, 10:06:42 AM
Last edit: April 08, 2013, 06:39:13 AM by mrlithium
 #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)
podizzle (OP)
Hero Member
*****
Offline Offline

Activity: 535
Merit: 500



View Profile
March 30, 2013, 04:32:41 PM
 #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.
mrlithium
Newbie
*
Offline Offline

Activity: 46
Merit: 0


View Profile
March 30, 2013, 10:44:21 PM
 #5

1A1dhB53bFh2n11VJG8kt6SawY5b7Biuzb

Thanks
podizzle (OP)
Hero Member
*****
Offline Offline

Activity: 535
Merit: 500



View Profile
March 31, 2013, 08:09:56 PM
 #6

got u
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!