phantomcircuit (OP)
|
|
September 23, 2011, 08:51:01 PM Last edit: October 13, 2011, 11:28:35 PM by phantomcircuit |
|
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 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)
|
|
|
|
|
|
|
There are several different types of Bitcoin clients. The most secure are full nodes like Bitcoin Core, which will follow the rules of the network no matter what miners do. Even if every miner decided to create 1000 bitcoins per block, full nodes would stick to the rules and reject those blocks.
|
|
|
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
|
ThiagoCMC
Legendary
Offline
Activity: 1204
Merit: 1000
฿itcoin: Currency of Resistance!
|
|
September 25, 2011, 06:23:50 AM |
|
Hi!! This https://intersango.com/ is open sourced too?!?!?! Best! Thiago
|
|
|
|
runeks
Legendary
Offline
Activity: 980
Merit: 1008
|
|
September 29, 2011, 04:27:03 AM |
|
What is the account_id? Is it the e-mail address associated with an account?
|
|
|
|
phantomcircuit (OP)
|
|
September 29, 2011, 04:42:35 AM |
|
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.
|
|
|
|
runeks
Legendary
Offline
Activity: 980
Merit: 1008
|
|
September 29, 2011, 04:47:01 AM |
|
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?
|
|
|
|
phantomcircuit (OP)
|
|
September 29, 2011, 05:00:23 AM |
|
We can probably accommodate you, of course it depends on what you can accept.
Make a proposal and we'll think about it.
|
|
|
|
genjix
Legendary
Offline
Activity: 1232
Merit: 1072
|
|
September 29, 2011, 05:08:35 AM |
|
runeks, you should open a ticket on Intersango by emailing support@intersango.com 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.
|
|
|
|
runeks
Legendary
Offline
Activity: 980
Merit: 1008
|
|
September 29, 2011, 06:13:25 AM |
|
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.
|
|
|
|
genjix
Legendary
Offline
Activity: 1232
Merit: 1072
|
|
September 29, 2011, 01:53:29 PM |
|
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.phpWe aren't allowed to let people easily convert between funds as that's forex trading.
|
|
|
|
phantomcircuit (OP)
|
|
September 29, 2011, 06:37:03 PM |
|
I've updated the example to show filtering for the listOrders call
|
|
|
|
runeks
Legendary
Offline
Activity: 980
Merit: 1008
|
|
October 01, 2011, 04:43:22 PM |
|
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.phpWe 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)?
|
|
|
|
genjix
Legendary
Offline
Activity: 1232
Merit: 1072
|
|
October 02, 2011, 03:36:34 AM |
|
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.phpWe 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 support@intersango.com and they'll fill you. List your country and bank name and they should be able to guide you through.
|
|
|
|
phantomcircuit (OP)
|
|
October 13, 2011, 11:30:54 PM |
|
I have updated the example to include support for FOK and IOC orders.
|
|
|
|
daybyter
Legendary
Offline
Activity: 965
Merit: 1000
|
|
June 13, 2012, 04:17:08 PM |
|
Does anyone know the format of the last_trade_date parameter? microseconds since the GMT epoch (1.1.1970) , or so?
|
|
|
|
phantomcircuit (OP)
|
|
June 14, 2012, 03:38:43 AM |
|
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).
|
|
|
|
toffoo
|
|
June 14, 2012, 03:34:55 PM |
|
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
|
|
|
|
phantomcircuit (OP)
|
|
June 15, 2012, 12:18:20 AM |
|
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..
|
|
|
|
daybyter
Legendary
Offline
Activity: 965
Merit: 1000
|
|
June 15, 2012, 11:17:15 AM |
|
Note to myself....must add a line: if( highest_bid( "Intersango").getUser().equals( "toffoo")) { break; } ...
|
|
|
|
|