Bitcoin Forum

Economy => Trading Discussion => Topic started by: nitrous on April 11, 2013, 02:21:40 AM



Title: Simple MtGox Ticker
Post by: nitrous on April 11, 2013, 02:21:40 AM
It seems that every time MtGox gets hit hard, so do most other Bitcoin related sites, making it hard to monitor the bitcoin exchange world. But the website going down doesn't always mean the API is down, so I quickly pulled together this simple GUI ticker in python:

https://bitbucket.org/nitrous/simple-mtgox-ticker/overview (https://bitbucket.org/nitrous/simple-mtgox-ticker/overview)

It isn't my best code, but it works and gives you the current bid and ask price, as well as current lag. It tries to poll the server every 2 seconds, and if there's an error it won't lose the current information. Also, if you want help developing with the MtGox API, take a look at api.py - I'm developing a more advanced library for easy python access to MtGox, but in the meantime I stripped it down to the bare essentials with this project, so it should be helpful in conjunction with my v2 API documentation to see how accessing the API works.

To start, just run
Code:
pythonw ticker.pyw

  • If you want a different currency, just change it in ticker.pyw
  • Make sure you have python and Tkinter installed
  • You don't need an API key or secret to use this service

Note that under high load, the API is not always available, but when it is, you should at least be able to get the basic information, hope this helps :)

https://bitbucket.org/nitrous/simple-mtgox-ticker/raw/master/screenshot.png


Title: Re: Simple MtGox Ticker
Post by: Clark on April 11, 2013, 03:25:06 AM
I don't think the ticker API updates at more than 10s intervals. You might just be getting redundant data if you poll every 2 seconds. (Or risk being blocked by anti-DDOS stuff)


Title: Re: Simple MtGox Ticker
Post by: nitrous on April 11, 2013, 03:35:48 AM
I don't think the ticker API updates at more than 10s intervals. You might just be getting redundant data if you poll every 2 seconds. (Or risk being blocked by anti-DDOS stuff)

Well my ticker seems to get updates at more than 10s intervals, and I haven't got any trouble with anti-DDoS yet, but I updated it to check every 3s instead just in case. Any longer seems to be too slow, at least for me, but anyone who uses it is free to change the request time by changing the rate variable on line 7 in ticker.pyw (it is the number of seconds between requests).


Title: Re: Simple MtGox Ticker
Post by: nitrous on April 12, 2013, 12:58:23 PM
The ticker now supports choosing different currencies:

https://bitbucket.org/nitrous/simple-mtgox-ticker/raw/master/screenshot-2.png https://bitbucket.org/nitrous/simple-mtgox-ticker/raw/master/screenshot-3.png

If you want to set it up as a standalone mac application without py2app or equivalent, just open automator and do the following:

https://bitbucket.org/nitrous/simple-mtgox-ticker/raw/master/screenshot-automator.png

EDIT: If you want to run more than one at a time, you should reduce the rate of each ticker, otherwise you may get banned from using the API by the anti-DDoS protection.


Title: Re: Simple MtGox Ticker
Post by: nitrous on April 12, 2013, 05:10:12 PM
Text is now also formatted, so there are up and down arrows to tell you what's happening to the price, not just what it is now :)
https://bitbucket.org/nitrous/simple-mtgox-ticker/raw/master/screenshot-4.png


Title: Re: Simple MtGox Ticker
Post by: nitrous on April 17, 2013, 09:45:30 PM
The ticker now uses the new MtGox ticker_fast method to be more reliable and provide more rapid updates (lag updates less often, however, as it is not cached AFAIK)


Title: Re: Simple MtGox Ticker
Post by: TimJBenham on April 20, 2013, 02:32:45 AM
The ticker now uses the new MtGox ticker_fast method to be more reliable and provide more rapid updates (lag updates less often, however, as it is not cached AFAIK)

How often can we call ticker_fast without getting into trouble?


Title: Re: Simple MtGox Ticker
Post by: Dorpsgek on April 20, 2013, 03:41:16 AM
Works awesome! Thanks nitrous!


Title: Re: Simple MtGox Ticker
Post by: nitrous on April 20, 2013, 07:36:38 AM
The ticker now uses the new MtGox ticker_fast method to be more reliable and provide more rapid updates (lag updates less often, however, as it is not cached AFAIK)

How often can we call ticker_fast without getting into trouble?

There's little information, but according to the original reddit thread (http://www.reddit.com/r/Bitcoin/comments/1c9npl/mtgox_fast_ticker_last_only_no_rate_limit_1second (http://www.reddit.com/r/Bitcoin/comments/1c9npl/mtgox_fast_ticker_last_only_no_rate_limit_1second)), there's no limit as the method is cached. Still, I'm not requesting more than twice per second with the app. I think for anything faster, the streaming API needs to be used.


Title: Re: Simple MtGox Ticker
Post by: nitrous on April 20, 2013, 07:39:43 AM
Works awesome! Thanks nitrous!

Glad you like it  ;D