Bitcoin Forum
November 15, 2024, 01:53:29 AM *
News: Check out the artwork 1Dq created to commemorate this forum's 15th anniversary
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Simple MtGox Ticker  (Read 1729 times)
nitrous (OP)
Sr. Member
****
Offline Offline

Activity: 246
Merit: 250


View Profile
April 11, 2013, 02:21:40 AM
 #1

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

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 Smiley


Donations: 1Q2EN7TzJ6z82xvmQrRoQoMf3Tf4rMCyvL
MtGox API v2 Unofficial Documentation: https://bitbucket.org/nitrous/mtgox-api/overview
MtGox API v2 Unofficial Documentation Forum Thread: https://bitcointalk.org/index.php?topic=164404.0
Clark
Hero Member
*****
Offline Offline

Activity: 548
Merit: 502


So much code.


View Profile WWW
April 11, 2013, 03:25:06 AM
 #2

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)

nitrous (OP)
Sr. Member
****
Offline Offline

Activity: 246
Merit: 250


View Profile
April 11, 2013, 03:35:48 AM
 #3

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).

Donations: 1Q2EN7TzJ6z82xvmQrRoQoMf3Tf4rMCyvL
MtGox API v2 Unofficial Documentation: https://bitbucket.org/nitrous/mtgox-api/overview
MtGox API v2 Unofficial Documentation Forum Thread: https://bitcointalk.org/index.php?topic=164404.0
nitrous (OP)
Sr. Member
****
Offline Offline

Activity: 246
Merit: 250


View Profile
April 12, 2013, 12:58:23 PM
 #4

The ticker now supports choosing different currencies:



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



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.

Donations: 1Q2EN7TzJ6z82xvmQrRoQoMf3Tf4rMCyvL
MtGox API v2 Unofficial Documentation: https://bitbucket.org/nitrous/mtgox-api/overview
MtGox API v2 Unofficial Documentation Forum Thread: https://bitcointalk.org/index.php?topic=164404.0
nitrous (OP)
Sr. Member
****
Offline Offline

Activity: 246
Merit: 250


View Profile
April 12, 2013, 05:10:12 PM
 #5

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 Smiley

Donations: 1Q2EN7TzJ6z82xvmQrRoQoMf3Tf4rMCyvL
MtGox API v2 Unofficial Documentation: https://bitbucket.org/nitrous/mtgox-api/overview
MtGox API v2 Unofficial Documentation Forum Thread: https://bitcointalk.org/index.php?topic=164404.0
nitrous (OP)
Sr. Member
****
Offline Offline

Activity: 246
Merit: 250


View Profile
April 17, 2013, 09:45:30 PM
 #6

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)

Donations: 1Q2EN7TzJ6z82xvmQrRoQoMf3Tf4rMCyvL
MtGox API v2 Unofficial Documentation: https://bitbucket.org/nitrous/mtgox-api/overview
MtGox API v2 Unofficial Documentation Forum Thread: https://bitcointalk.org/index.php?topic=164404.0
TimJBenham
Sr. Member
****
Offline Offline

Activity: 280
Merit: 250


View Profile
April 20, 2013, 02:32:45 AM
 #7

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?

You are a warlord in the outskirts of the known world struggling to establish a kingdom in the wild lands.
Dorpsgek
Newbie
*
Offline Offline

Activity: 49
Merit: 0


View Profile
April 20, 2013, 03:41:16 AM
 #8

Works awesome! Thanks nitrous!
nitrous (OP)
Sr. Member
****
Offline Offline

Activity: 246
Merit: 250


View Profile
April 20, 2013, 07:36:38 AM
 #9

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), 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.

Donations: 1Q2EN7TzJ6z82xvmQrRoQoMf3Tf4rMCyvL
MtGox API v2 Unofficial Documentation: https://bitbucket.org/nitrous/mtgox-api/overview
MtGox API v2 Unofficial Documentation Forum Thread: https://bitcointalk.org/index.php?topic=164404.0
nitrous (OP)
Sr. Member
****
Offline Offline

Activity: 246
Merit: 250


View Profile
April 20, 2013, 07:39:43 AM
 #10

Works awesome! Thanks nitrous!

Glad you like it  Grin

Donations: 1Q2EN7TzJ6z82xvmQrRoQoMf3Tf4rMCyvL
MtGox API v2 Unofficial Documentation: https://bitbucket.org/nitrous/mtgox-api/overview
MtGox API v2 Unofficial Documentation Forum Thread: https://bitcointalk.org/index.php?topic=164404.0
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!