It was the Bitcointalk forum that inspired us to create Bitcointalksearch.org - Bitcointalk is an excellent site that should be the default page for anybody dealing in cryptocurrency, since it is a virtual gold-mine of data. However, our experience and user feedback led us create our site; Bitcointalk's search is slow, and difficult to get the results you need, because you need to log in first to find anything useful - furthermore, there are rate limiters for their search functionality.
The aim of our project is to create a faster website that yields more results and faster without having to create an account and eliminate the need to log in - your personal data, therefore, will never be in jeopardy since we are not asking for any of your data and you don't need to provide them to use our site with all of its capabilities.
We created this website with the sole purpose of users being able to search quickly and efficiently in the field of cryptocurrency so they will have access to the latest and most accurate information and thereby assisting the crypto-community at large.
import httplib
import urllib
import json
import decimal
import threading
import socket
class intersango:
version = "0.1"
good_til_cancelled = 'gtc'
fill_or_kill = 'fok'
immediate_or_cancel = 'ioc'
def __init__(self,api_key):
self.api_key=api_key
self.connection = None
def connect(self):
if self.connection is None:
self.connection = httplib.HTTPSConnection('intersango.com')
def make_request(self,call_name,params):
params.append(('api_key',self.api_key))
body = urllib.urlencode(params)
self.connect()
try:
self.connection.putrequest('POST','/api/authenticated/v'+self.version+'/'+call_name+'.php')
self.connection.putheader('Connection','Keep-Alive')
self.connection.putheader('Keep-Alive','30')
self.connection.putheader('Content-type','application/x-www-form-urlencoded')
self.connection.putheader('Content-length',len(body))
self.connection.endheaders()
self.connection.send(body)
response = self.connection.getresponse()
return json.load(response)
except httplib.HTTPException:
self.connection = None
return False
except socket.error:
self.connection = None
return False
def list_accounts(self):
return self.make_request('listAccounts',dict())
def list_orders(self,account_id,last_order_id=None,states=None):
params = [('account_id',account_id)]
if last_order_id is not None:
params.append(('last_order_id',last_order_id))
if states is not None:
for state in states:
params.append(('states[]',state))
return self.make_request('listOrders',params)
def list_deposits(self,account_id):
return self.make_request('listDeposits',[('account_id',account_id)])
def list_withdrawal_requests(self,account_id):
return self.make_request('listWithdrawalRequests',[('account_id',account_id)])
def place_limit_order(self,quantity,rate,selling,base_account_id,quote_account_id,order_type=good_til_cancelled):
params = []
assert type(quantity) == decimal.Decimal
assert type(rate) == decimal.Decimal
params.append(('quantity',quantity))
params.append(('rate',rate))
params.append(('selling',str(selling).lower()))
params.append(('base_account_id',base_account_id))
params.append(('quote_account_id',quote_account_id))
params.append(('type',order_type))
return self.make_request('placeLimitOrder',params)
def request_cancel_order(self,account_id,order_id):
return self.make_request('requestCancelOrder',[('account_id',account_id),('order_id',order_id)])
b = intersango('your api key goes here')
b.place_limit_order(decimal.Decimal('10'),decimal.Decimal('2.49051'),True,1,2,intersango.immediate_or_cancel)