I have been trying to figure out how to pass my parameters for the bid ask url to the MTGox V1 API with no luck. Here is the code I am using. I have also tried to define the parameters within the class query function with no success as of yet. Any help would be appreciated.
GOX_secret = removed
GOX_key = removed
from hashlib import sha512
from hmac import HMAC
from base64 import b64decode, b64encode
from urllib import urlencode
from time import time
import requests
url = "
https://data.mtgox.com/api/1/BTCUSD/private/order/add?type=bid&amount_int=010000000&price_int=1099489" #this does not work
class MTGox:
def __init__(self, key, secret):
self.key = key
self.secret = b64decode(secret)
def query(self, path, args={}, param={}):
args['nonce'] = int(time()*100000)
sign = b64encode(str(HMAC(self.secret, urlencode(args), sha512).digest()))
print sign
headers = {
'User-Agent': 'BitcoinTalk',
'Rest-Key': self.key,
'Rest-Sign': sign
}
print url
r = requests.post(url,data=args, headers=headers)
print r.text
m = MTGox(GOX_key,GOX_secret)
m.query("")