Bitcoin Forum
September 29, 2025, 09:35:17 AM *
News: Latest Bitcoin Core release: 29.0 [Torrent]
 
  Home Help Search Login Register More  
  Show Posts
Pages: [1] 2 3 4 5 6 7 8 9 »
1  Economy / Games and rounds / Re: DirectBet Basketball Prediction Game *** Win Free Bets ! *** Free to Enter ! on: January 07, 2017, 02:51:19 AM
Memphis Grizzlies 110 @ 113 Golden State Warriors
2  Economy / Games and rounds / Re: DirectBet Basketball Prediction Game *** Win Free Bets ! *** Free to Enter ! on: December 17, 2016, 12:18:05 AM
Charlotte Hornets 101 @ 104 Boston Celtics
3  Economy / Trading Discussion / Re: MtGox API version 2: Unofficial Documentation on: August 02, 2013, 02:10:45 PM
I've compiled some information about the socket api here https://bitbucket.org/nitrous/mtgox-api/src/master/socket?at=master with example python code.

Thanks! tested and it works for me. Here is a minimalist sample that works on python3. There are a lot of changes needed for python3, including frequently converting str to bytes, incompatible urlencode() and lack of urllib2. This example uses python-requests to shorten the code in attempt to manifest the security measurement:
Code:
import hmac, base64, hashlib, urllib, time, requests

base = 'https://data.mtgox.com/api/2/'
key = ""
sec = ""

def request(get_or_post, path, inp={}):

    def sign(path, data): # not used by any other functions
        return hmac.new(base64.b64decode(bytes(sec, 'UTF-8')),
            bytes(path+chr(0)+data, 'UTF-8'), hashlib.sha512)

    if get_or_post == 'get':
        return requests.get(base+path)

    inp[u'tonce'] = str(int(time.time()*1e6))
    post_data = urllib.parse.urlencode(inp)
    headers = {
        'Content-Type': 'application/x-www-form-urlencoded',
        'Rest-Key': key,
        'Rest-Sign': base64.b64encode(sign(path, post_data).digest())
    }
    return requests.post(base+path, data = post_data, headers = headers)

# example: get
#r = request('get', 'BTCUSD/money/ticker_fast')
#print(r.text)

# example: post
#r = request('post', 'BTCUSD/money/info')
#print(r.text)

# example: post with params (use your own order ID here)
#data = {'order': 'd5111d57-c495-48a0-923d-59b729dba331', 'type':'ask'}
#r = request('post', 'BTCUSD/money/order/result', data)
#print(r.text)

Output (activated the last most-complicated example)
Code:
!python3 /tmp/test.py
[No se ha escrito nada al disco desde el último cambio]
{"result":"success","data":{"order_id":"d5111d57-c495-48a0-923d-59b729dba331","trades":[{"trade_id":"1373688054789976","primary":"Y","currency":"USD","type":"ask
","properties":"limit","item":"BTC","amount":{"value":"0.01000000","value_int":"1000000","display":"0.01000000\u00a0BTC","display_short":"0.01\u00a0BTC","currenc
y":"BTC"},"price":{"value":"91.89874","value_int":"9189874","display":"$91.89874","display_short":"$91.90","currency":"USD"},"spent":{"value":"0.91899","value_in
t":"91899","display":"$0.91899","display_short":"$0.92","currency":"USD"},"date":"2013-07-13 04:00:54"}],"total_amount":{"value":"0.01000000","value_int":"100000
0","display":"0.01000000\u00a0BTC","display_short":"0.01\u00a0BTC","currency":"BTC"},"total_spent":{"value":"0.91899","value_int":"91899","display":"$0.91899","d
isplay_short":"$0.92","currency":"USD"},"avg_cost":{"value":"91.89900","value_int":"9189900","display":"$91.89900","display_short":"$91.90","currency":"USD"}}}

Hi, Currently trying this code. Works well with get but when I try send I get syntax error at this line:
    inp[u'tonce'] = str(int(time.time()*1e6))

why is that? I'm using python3.2 @ linux mint
4  Economy / Service Discussion / Re: Bitcoincard.org - bad start on: September 26, 2012, 02:59:30 PM
isn't gavin and other pretty trustworthy people behind that project?
5  Bitcoin / Bitcoin Discussion / Re: If Pirate Runs: The Danger of one entity with 500K BTC on: August 21, 2012, 07:56:12 AM
^^^
Word. Bitcoin truly need to be stress tested. Pirate is doing us all a favour.
6  Other / Beginners & Help / Re: How can I get listed on the Bitcoin-OTC? on: August 18, 2012, 12:04:09 PM
You have to use the good old SASL identification method.


Here's some good links:
http://blog.freenode.net/2010/01/connecting-to-freenode-using-tor-sasl/
https://itnomad.wordpress.com/2006/10/11/tor-howto-accessing-freenode-via-tor-step-by-step-for-windows/
https://wiki.archlinux.org/index.php/Tor
7  Other / Beginners & Help / Re: How can I get listed on the Bitcoin-OTC? on: August 18, 2012, 11:38:02 AM
Start here: http://wiki.bitcoin-otc.com/wiki/Main_Page and don't be a scammer.  Cool
8  Other / Beginners & Help / Re: Why are newbies treated like scum here? on: August 10, 2012, 08:12:01 PM
Are you serious? Take a look around here. Even though the legitimate restrictions on newly registered people there is still a massive amount of worthless posting and trolling.
9  Economy / Goods / Re: Bitcoin Banknotes on: August 08, 2012, 09:24:22 PM
Nice!
10  Bitcoin / Bitcoin Discussion / Re: arXiv Silk Road Study on: August 04, 2012, 08:58:11 PM
Very interesting. Thank you for sharing.
11  Economy / Service Discussion / Re: Why trust GLBSE? on: July 29, 2012, 04:48:32 PM
Becuase Nefario is one sexy and trustworthy biatch.  Cool
12  Economy / Securities / Re: [GLBSE] Bitcoin Racing Syndicate on: July 15, 2012, 10:54:58 AM
I have to say that the idea is very appealing.
13  Economy / Currency exchange / Re: I want to buy 1 litecoin on: July 06, 2012, 09:42:48 AM
Funds are on their way!

LZ6akBAYBCHS7dQZ7cMfvzsUeDKkASinBb
14  Economy / Currency exchange / I want to buy 1 litecoin on: July 05, 2012, 07:45:45 PM
I can pay with btc.
15  Alternate cryptocurrencies / Announcements (Altcoins) / Re: [ANN] Litecoin - a lite version of Bitcoin. Launched! on: July 04, 2012, 12:40:10 PM
Does exist any binary (.deb?) version yet? I'm apparently to retarded to compile it myself.  Cool
16  Bitcoin / Bitcoin Discussion / Re: So why would you want to be the paypal of bitcoin? on: July 03, 2012, 09:45:24 PM
word
17  Other / Beginners & Help / Re: Death of Bitcoins on: June 16, 2012, 09:00:13 AM
Why is that a problem?
Since every single bitcoin is high divisible I can't see the problem.

Btw. This has been discussed tons of times before.
18  Bitcoin / Electrum / Re: [ANNOUNCE] Electrum - a new thin client on: June 15, 2012, 10:44:38 AM
When I run Electrum I get the following error:
Connected to ecdsa.org:50001
received error: {u'id': 4, u'error': u'limit reached'}

What in the what now?

I added a limit on the number of transactions that can be returned on requested addresses.
it is a DOS prevention measure.
the limit is probably too low. I will raise it if necessary.

I have received 109 transactions on one specific address and about ~120 in total. And now I get the error all the time. What should I do in order to be able to access the coins connected to that address? And what happens if more transactions are sent to that address now when I have reached the limit?
19  Bitcoin / Electrum / Re: [ANNOUNCE] Electrum - a new thin client on: June 14, 2012, 09:55:08 AM
When I run Electrum I get the following error:
Connected to ecdsa.org:50001
received error: {u'id': 4, u'error': u'limit reached'}

What in the what now?
20  Economy / Goods / WTB: 4 or 2GB micro sd card on: June 02, 2012, 04:12:53 PM
Can anyone sell me a (cheap?) 4GB or 2GB micro SD card for btc?
I live in Sweden. Send me a pm if you have an offer.
Pages: [1] 2 3 4 5 6 7 8 9 »
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!