Author

Topic: Intersango API python interface (Read 2236 times)

legendary
Activity: 965
Merit: 1000
June 15, 2012, 06:17:15 AM
#18
Note to myself....must add a line: if( highest_bid( "Intersango").getUser().equals( "toffoo")) { break; } ... Wink
sr. member
Activity: 463
Merit: 252
June 14, 2012, 07:18:20 PM
#17
This is a very basic framework for the intersango API in python.

Cool ... maybe now someone can code up even more bots to outbid me by 0.0001 BTC every time I leave an order on that exchange

lol..
sr. member
Activity: 408
Merit: 261
June 14, 2012, 10:34:55 AM
#16
This is a very basic framework for the intersango API in python.

Cool ... maybe now someone can code up even more bots to outbid me by 0.0001 BTC every time I leave an order on that exchange
sr. member
Activity: 463
Merit: 252
June 13, 2012, 10:38:43 PM
#15
Does anyone know the format of the last_trade_date parameter? microseconds since the GMT epoch (1.1.1970) , or so?

Seconds since epoch as an integer (no microsecond precision).
legendary
Activity: 965
Merit: 1000
June 13, 2012, 11:17:08 AM
#14
Does anyone know the format of the last_trade_date parameter? microseconds since the GMT epoch (1.1.1970) , or so?
sr. member
Activity: 463
Merit: 252
October 13, 2011, 06:30:54 PM
#13
I have updated the example to include support for FOK and IOC orders.
legendary
Activity: 1232
Merit: 1076
October 01, 2011, 10:36:34 PM
#12
OK, I have done that. You might want to add a notice somewhere that your site is only designed (at the moment) for US customers, so others don't get in the same situation that I am in.

Where did you get that idea? Our offices are in London, and we have accounts for British GBP, European EURO and Polish Zloty.

Info: https://intersango.com/fees.php

We aren't allowed to let people easily convert between funds as that's forex trading.
My mistake. I got the impression that withdrawals were only possible via Dwolla.

Is it possible for me to deposit USD (and not EUR) to my Intersango account via a European bank transfer (SEPA)?

It should be possible, but you'll need to pay the bank's conversion fees. Email [email protected] and they'll fill you. List your country and bank name and they should be able to guide you through.

legendary
Activity: 980
Merit: 1008
October 01, 2011, 11:43:22 AM
#11
OK, I have done that. You might want to add a notice somewhere that your site is only designed (at the moment) for US customers, so others don't get in the same situation that I am in.

Where did you get that idea? Our offices are in London, and we have accounts for British GBP, European EURO and Polish Zloty.

Info: https://intersango.com/fees.php

We aren't allowed to let people easily convert between funds as that's forex trading.
My mistake. I got the impression that withdrawals were only possible via Dwolla.

Is it possible for me to deposit USD (and not EUR) to my Intersango account via a European bank transfer (SEPA)?
sr. member
Activity: 463
Merit: 252
September 29, 2011, 01:37:03 PM
#10
I've updated the example to show filtering for the listOrders call
legendary
Activity: 1232
Merit: 1076
September 29, 2011, 08:53:29 AM
#9
OK, I have done that. You might want to add a notice somewhere that your site is only designed (at the moment) for US customers, so others don't get in the same situation that I am in.

Where did you get that idea? Our offices are in London, and we have accounts for British GBP, European EURO and Polish Zloty.

Info: https://intersango.com/fees.php

We aren't allowed to let people easily convert between funds as that's forex trading.
legendary
Activity: 980
Merit: 1008
September 29, 2011, 01:13:25 AM
#8
OK, I have done that. You might want to add a notice somewhere that your site is only designed (at the moment) for US customers, so others don't get in the same situation that I am in.
legendary
Activity: 1232
Merit: 1076
September 29, 2011, 12:08:35 AM
#7
runeks, you should open a ticket on Intersango by emailing [email protected] and then someone will respond to solve your issue. It's better that way as we can better track tasks and assign them to the correct people appropriately.
sr. member
Activity: 463
Merit: 252
September 29, 2011, 12:00:23 AM
#6
We can probably accommodate you, of course it depends on what you can accept.

Make a proposal and we'll think about it.
legendary
Activity: 980
Merit: 1008
September 28, 2011, 11:47:01 PM
#5
Ah, cool, thanks.

I assume you have something to do with Intersango because of your signature. So I'll ask you my important question.

I just transferred some Bitcoins to Intersango and purchased some US dollars for them. Now I have some US dollars in my account, but since I am not allowed to register an account at Dwolla (they only accept US citizens as account holders) I don't have a way to withdraw the money.

Is there no way for me to get my money back from you?
sr. member
Activity: 463
Merit: 252
September 28, 2011, 11:42:35 PM
#4
What is the account_id? Is it the e-mail address associated with an account?

account_id is the account number found on the accounts page, they're also available via the listAccounts.php API call.
legendary
Activity: 980
Merit: 1008
September 28, 2011, 11:27:03 PM
#3
What is the account_id? Is it the e-mail address associated with an account?
legendary
Activity: 1204
Merit: 1000
฿itcoin: Currency of Resistance!
September 25, 2011, 01:23:50 AM
#2
Hi!!

 This https://intersango.com/ is open sourced too?!?!?!

Best!
Thiago
sr. member
Activity: 463
Merit: 252
September 23, 2011, 03:51:01 PM
#1
This is a very basic framework for the intersango API in python.

Edit: updated to support states filter for orders
Edit: added support for fill or kill and immediate or cancel orders

Code:
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)
Jump to: