Intersango: Difference between revisions
No edit summary |
|||
Line 51: | Line 51: | ||
See the [https://intersango.com/api.php API page] for more info. | See the [https://intersango.com/api.php API page] for more info. | ||
Streaming API code example: | |||
<source lang="python"> | |||
# expected message types are | |||
# "orderbook", "depth", "trade", "ping" | |||
import socket, json | |||
s = socket.create_connection(('db.intersango.com', 1337)) | |||
b = '' | |||
while True: | |||
b += s.recv(8192) | |||
while '\r\n' in b: | |||
i = b.find('\r\n') | |||
m = b[:i].strip() | |||
b = b[i+2:] | |||
m = json.loads(m) | |||
print m | |||
</source> | |||
Trading API: | |||
<source lang="python"> | <source lang="python"> | ||
import httplib | import httplib |
Revision as of 00:07, 26 November 2012
A exchange offering multiple trading markets for trading bitcoins against multiple currencies.
Traders add funds and then place orders to buy and sell. Intersango acts as an escrow. The site charges no trading fees.
Bitcoin Consultancy operates the exchange.
Intersango has a trading API
Trading
Buying
A buy order is executed partially or in full when the price bid can be matched against a sell order that is at or below the bid amount.
Selling
A sell order is executed partially or in full when the price asked can be matched against a buy order that is at or above the ask amount.
No Fee (for a limited time).
Adding Funds
BTC
There are no fees incurred when when transferring bitcoins for deposit. Funds are available once confirmed (4 confirms), a process that can take roughly forty minutes.
EUR
The exchange accepts SEPA bank transfers for deposit. A 5 PLN fee is taken by the bank. No additional fees is taken.
PLN
The exchange accepts polish bank transfers for deposit. There are no fees.
GBP
The exchange no longer supports GBP transfers. There is no ETA for this feature's return.
Withdrawing Funds
BTC
Bitcoins may be withdrawn at no charge.
EUR
Withdrawals as SEPA transfers. A fee of 5 PLN is taken by the bank. No additional fee is charged.
PLN
Withdrawals as standard polish PLN bank transfers.
GBP
The exchange no longer supports GBP transfers. There is no ETA for this feature's return.
API
See the API page for more info.
Streaming API code example:
# expected message types are
# "orderbook", "depth", "trade", "ping"
import socket, json
s = socket.create_connection(('db.intersango.com', 1337))
b = ''
while True:
b += s.recv(8192)
while '\r\n' in b:
i = b.find('\r\n')
m = b[:i].strip()
b = b[i+2:]
m = json.loads(m)
print m
Trading API:
import httplib
import urllib
import json
class Intersango:
ORDER_QUEUED = 'queued'
ORDER_OPEN = 'open'
ORDER_EXPIRED = 'expired'
ORDER_CANCELLED = 'cancelled'
ORDER_FULFILLED = 'fulfilled'
BUY = 'false'
SELL = 'true'
def __init__(self, api_key):
self.connection = httplib.HTTPSConnection('intersango.com')
self.api_key = api_key
def make_request(self, page, params={}):
headers = {"Content-type": "application/x-www-form-urlencoded",
"Connection": "Keep-Alive", "Keep-Alive": 30,
"Accept": "text/plain"}
if type(params) == dict:
params['api_key'] = self.api_key
elif type(params) == list:
params.append(('api_key', self.api_key))
else:
raise TypeError('Unknown parameter list type')
params = urllib.urlencode(params)
base_url = '/api/authenticated/v0.1/%s.php'%page
self.connection.request('POST', base_url, params, headers)
response = self.connection.getresponse()
if response.status == 404:
return None
return json.loads(response.read())
def accounts(self):
return self.make_request('listAccounts')
def orders(self, account_id, states=[], last_order_id=None):
params = [('account_id', account_id)]
for state in states:
params.append(('states[]', state))
if last_order_id is not None:
params.append(('last_order_id', last_order_id))
return self.make_request('listOrders', params)
def deposits(self, account_id):
return self.make_request('listDeposits', {'account_id': account_id})
def withdrawals(self, account_id):
return self.make_request('listWithdrawalRequests',
{'account_id': account_id})
def place_limit_order(self, quantity, rate, is_selling, base_id, quote_id):
params = {'quantity': quantity, 'rate': rate, 'selling': is_selling,
'base_account_id': base_id, 'quote_account_id': quote_id}
return self.make_request('placeLimitOrder', params)
def cancel_order(self, account_id, order_id):
params = {'account_id': account_id, 'order_id': order_id}
return self.make_request('requestCancelOrder', params)
def cancel_withdrawal(self, account_id, withdrawal_request_id):
params = {'account_id': account_id,
'withdrawal_request_id': withdrawal_request_id}
return self.make_request('cancelWithdrawalRequest', params)
Example usage:
intersango = Intersango('3223kdkk323h32kj3hkj23233j')
print 'Accounts: ', intersango.accounts()
print 'Orders: ', \
intersango.orders(411289412410,
[Intersango.ORDER_CANCELLED, Intersango.ORDER_FULFILLED])
print 'Deposits: ', intersango.deposits(861502532543)
print 'Withdrawals: ', intersango.withdrawals(702703681384)
intersango.place_limit_order('1', '2.0', Intersango.BUY,
861502521543, 411982412410)
intersango.cancel_order(412989412410, 21724)
History
The service was launched on July 6, 2011[1]. The Intersango open source software that the exchange runs on was announced on March 17, 2011[2]. In September, 2011 the exchange began using a new version of the Intersango open source exchange project with two currency markets (BTC/EUR, BTC/USD) live under the Intersango brand and plans made for the third (BTC/GBP) when Britcoin accounts are migrated at a future date.
On October 9, 2012, the exchange announced imminent plans to shutter its BTC/USD market.
See Also
External Links
- Intersango EUR exchange website
- Intersango exchange project on Gitorious