bitcoinex (OP)
|
|
March 06, 2011, 03:28:33 AM |
|
Has anyone seen trading robot to trade on mtgox?
|
New bitcoin lottery: probiwon.com- Moжeт, ты eщё и в Heвидимyю Pyкy Pынкa вepyeшь? - Зaчeм жe вepoвaть в тo, чтo мoжнo нaблюдaть нeпocpeдcтвeннo?
|
|
|
riX
|
|
March 06, 2011, 04:18:19 AM |
|
Today there was a bot online there. The bot kept adjusting it's order so to always be included in the lowest 500 USD worth of sell orders. It's easy to see if it's online.
|
|
|
|
bitcoinex (OP)
|
|
March 06, 2011, 04:59:44 AM |
|
I would ask that the bot began to trade on our exchange too
|
New bitcoin lottery: probiwon.com- Moжeт, ты eщё и в Heвидимyю Pyкy Pынкa вepyeшь? - Зaчeм жe вepoвaть в тo, чтo мoжнo нaблюдaть нeпocpeдcтвeннo?
|
|
|
sidd
Newbie
Offline
Activity: 13
Merit: 0
|
|
March 07, 2011, 02:43:27 PM |
|
I've made a simple bot on mtgox that works. I've tried to make a bot for your site, but can't get it to work. If I try the simple program: import httplib2 h = httplib2.Http('.cache') url = "https://btcex.com/api/orders?username=sidd&token=****" r,c = h.request(url) print c It always returns an empty list [] If I use the exact same url in a browser while logged out of btcex it also returns [] If I use the same url in a browser while logged in it lists orders correctly, eg: [{"pair_id":2,"order_id":59670,"order_type":"Limit","ask":true,"rate":"10.0000","rate_reverse":"0.1000","quantity_sell":"1.00","ttl":"14 days"}]
|
|
|
|
Clark
|
|
March 07, 2011, 10:35:46 PM |
|
I'm trying to interface with the API as well, and I am having the same issue.
|
|
|
|
bitcoinex (OP)
|
|
March 12, 2011, 11:58:11 PM |
|
Sorry for the delay, did not notice the messages. We explore this issue.
|
New bitcoin lottery: probiwon.com- Moжeт, ты eщё и в Heвидимyю Pyкy Pынкa вepyeшь? - Зaчeм жe вepoвaть в тo, чтo мoжнo нaблюдaть нeпocpeдcтвeннo?
|
|
|
BrightAnarchist
Donator
Legendary
Offline
Activity: 853
Merit: 1000
|
|
March 13, 2011, 01:24:20 AM |
|
I tried httplib2 many times to no avail, generally I find that the mechanize package works far better. although it cannot execute javascript for you. I've made a simple bot on mtgox that works. I've tried to make a bot for your site, but can't get it to work. If I try the simple program: import httplib2 h = httplib2.Http('.cache') url = "https://btcex.com/api/orders?username=sidd&token=****" r,c = h.request(url) print c It always returns an empty list [] If I use the exact same url in a browser while logged out of btcex it also returns [] If I use the same url in a browser while logged in it lists orders correctly, eg: [{"pair_id":2,"order_id":59670,"order_type":"Limit","ask":true,"rate":"10.0000","rate_reverse":"0.1000","quantity_sell":"1.00","ttl":"14 days"}]
|
|
|
|
romanoza
Newbie
Offline
Activity: 15
Merit: 0
|
|
March 13, 2011, 08:47:13 AM |
|
seems to be ok now
|
|
|
|
hiker
Newbie
Offline
Activity: 58
Merit: 0
|
|
March 13, 2011, 07:34:42 PM |
|
Are there any working bots examples, like source code etc.?
|
|
|
|
johnieeliang
Newbie
Offline
Activity: 14
Merit: 0
|
|
March 14, 2011, 01:18:43 PM |
|
not much to making a bot, just look at the api on mtgox is all there
|
|
|
|
sidd
Newbie
Offline
Activity: 13
Merit: 0
|
|
March 14, 2011, 09:14:52 PM |
|
Here's the source to a fairly basic sellingbot for Mt Gox. I just use it to trade mined btc for $, but you could add more advanced trading logic if you wanted. The BTCex API seems to be fixed now, the only real difference between the API's is that BTCex is all 'GET' and no 'POST'. #!/usr/bin/python
# Basic Mt Gox salesbot # Will automatically sell all BTC for USD # CAUTION - USE AT YOUR OWN RISK # AUTOMATIC TRADING MAY RESULT IN FINANCIAL LOSS
from urllib import urlencode import httplib2 import json from decimal import *
#### User Variables #### TRADING_FOR_REAL = False
CREDENTIALS = { 'name' : <username> , 'pass' : <password> }
SPREAD_LIMIT = Decimal('0.010') # Critical difference between best bid and best offer. # If the spread is less than this, take the best bid. # If the spread is larger than this, undercut the best offer. # set to 0 for a patient algorithm. # set to a large number for an impatient algorithm. # There is no check that the best bid has sufficient volume.
UNDERCUT_AMOUNT = Decimal('0.0050') # If making a patient trade, undercut best offer by this much.
SMALLEST_TRADE = 10 # Minimum value of trade in btc that Mt Gox allows.
DECIMAL_PRECISION = 4 # Decimal places for price data
#### Mt Gox urls #### Ticker = 'http://mtgox.com/code/data/ticker.php' Depth = 'http://mtgox.com/code/data/getDepth.php' Funds = 'https://mtgox.com/code/getFunds.php?' Buybtc = 'https://mtgox.com/code/buyBTC.php?' Sellbtc = 'https://mtgox.com/code/sellBTC.php?' Myorders = 'https://mtgox.com/code/getOrders.php?' Cancelorder = 'https://mtgox.com/code/cancelOrder.php?'
#### Trading Functions #### h = httplib2.Http('.cache') getcontext().prec = DECIMAL_PRECISION
def GetTicker(): response, content = h.request(Ticker) return content
def CancelAll(): # Cancel every outstanding order # Return account balance (BTC, $) response, content = h.request(Myorders, 'POST', urlencode(CREDENTIALS), headers={'Content-Type': 'application/x-www-form-urlencoded'}) a = json.loads(content) print "There are ", len(a[u'orders']), " existing orders to cancel"
mybody = dict(CREDENTIALS) if TRADING_FOR_REAL: for order in a[u'orders']: mybody['oid'] = order[u'oid'] mybody['type'] = order[u'type'] response, content = h.request(Cancelorder, 'POST', urlencode(mybody), headers={'Content-Type': 'application/x-www-form-urlencoded'}) print "All orders cancelled" else: print "Orders have not been cancelled" return (a[u'btcs'], a[u'usds'])
def PlaceSell(price, amount): mybody = dict(CREDENTIALS) mybody['price'] = price mybody['amount'] = amount if (TRADING_FOR_REAL): print "Selling ", amount, " btc at ", price response, content = h.request(Sellbtc, 'POST', urlencode(mybody), headers={'Content-Type': 'application/x-www-form-urlencoded'}) else: print "Trading disabled but would sell ", amount, " btc at ", price #### Trading strategy #### # First cancel all open orders # Then attempt to sell all BTC in account # # Trade patiently if the spread is large # Trade impatiently if the spread is small
# must deal in quantities > 10 btc
mybtc, myusd = CancelAll()
a = json.loads(GetTicker()) bestsell = Decimal(str(a[u'ticker'][u'sell'])) bestbuy = Decimal(str(a[u'ticker'][u'buy'])) last = Decimal(str(a[u'ticker'][u'last']))
print "Bid: ", bestbuy, ", Offer: ", bestsell
# Place an order to sell BTC if bestsell > bestbuy + SPREAD_LIMIT: # Wide spread sellprice = bestsell - UNDERCUT_AMOUNT sellamount = mybtc # full balance of account if sellamount > SMALLEST_TRADE: PlaceSell( sellprice, sellamount) else: print "Insufficient btc in account to make patient sale" else: # Tight spread sellprice = bestbuy sellamount = mybtc # full balance of account if sellamount > SMALLEST_TRADE: PlaceSell( sellprice, sellamount) else: print "Insufficient btc in account to match existing bid"
|
|
|
|
johnieeliang
Newbie
Offline
Activity: 14
Merit: 0
|
|
March 15, 2011, 03:56:08 PM |
|
why do ppl use python so often for this stuff? what are the advantages?
|
|
|
|
cw
Newbie
Offline
Activity: 41
Merit: 0
|
|
March 15, 2011, 04:46:47 PM |
|
I'm developing a Python trading bot. See this post for more info.
|
|
|
|
llama
Member
Offline
Activity: 103
Merit: 61
|
|
March 16, 2011, 09:11:53 PM |
|
The bot on MtGox is mine. It runs nearly all the time, but it's not always making trades. I brought it online the day Jed opened up the API. Mt. Gox is the only exchange with enough volume to justify trading in right now. Sorry, source will remain closed
|
|
|
|
bitcoinex (OP)
|
|
March 16, 2011, 10:09:06 PM |
|
Our trading API is ok now?
|
New bitcoin lottery: probiwon.com- Moжeт, ты eщё и в Heвидимyю Pyкy Pынкa вepyeшь? - Зaчeм жe вepoвaть в тo, чтo мoжнo нaблюдaть нeпocpeдcтвeннo?
|
|
|
ArsenShnurkov
Legendary
Offline
Activity: 1386
Merit: 1000
|
|
March 18, 2011, 07:11:20 PM Last edit: March 18, 2011, 08:51:28 PM by ArsenShnurkov |
|
Our trading API is ok now? No, of course! Documentation is still awfull. (I talk about https://btcex.com/site/page/api page) And it is not localized to russian language. (I am incubating a devious plan to build a robot for btcex.com, codenamed "Diamond Dust". Please tremble in horror and prepare to a large number of orders in the order stack. I think that you should either limit visible number of orders or/and add paging. You just was forewarned.)
|
|
|
|
bitcoinex (OP)
|
|
March 18, 2011, 11:10:44 PM Last edit: March 19, 2011, 05:20:07 AM by bitcoinex |
|
Our trading API is ok now? No, of course! Documentation is still awfull. (I talk about https://btcex.com/site/page/api page) And it is not localized to russian language. (I am incubating a devious plan to build a robot for btcex.com, codenamed "Diamond Dust". Please tremble in horror and prepare to a large number of orders in the order stack. I think that you should either limit visible number of orders or/and add paging. You just was forewarned.) We solve problems as they come (excluding security problems)
|
New bitcoin lottery: probiwon.com- Moжeт, ты eщё и в Heвидимyю Pyкy Pынкa вepyeшь? - Зaчeм жe вepoвaть в тo, чтo мoжнo нaблюдaть нeпocpeдcтвeннo?
|
|
|
ArsenShnurkov
Legendary
Offline
Activity: 1386
Merit: 1000
|
|
March 19, 2011, 09:00:06 AM Last edit: March 19, 2011, 01:56:35 PM by ArsenShnurkov |
|
We solve problems as they come (excluding security problems) 1) I am trying to give the order: https://btcex.com/api/order?order_type=Limit&quantity_sell=1.98&pair=150&rate=4.0001&Ttl=10&ask=0&username=ArsenShnurkov&token=hereIsMyCoRRecTSesSioNid1111It returns {"error":"Wrong parameters"} Given this explaination I am unable to determine what goes wrong. 2) If I write "ttl" instead of "Ttl" site returns: "Ttl Aтpибyт Ttl oтcyтcтвyeт в cпиcкe. Пpoдaнo Aтpибyт Пpoдaнo дoлжeн быть чиcлoм." 2.1) Why russian letters are returned in this answer ? 2.2) Sample at API description page says to use "&ttl=". So it is a bug either in documentation or in code. 3) It is not documented - what should one use as a value of Ttl field 4) It is not documented which separators of decimal digits are accepted
|
|
|
|
nextnonce
Member
Offline
Activity: 74
Merit: 11
www.minethings.com
|
|
March 20, 2011, 09:57:10 PM |
|
Here's the source to a fairly basic sellingbot for Mt Gox. I just use it to trade mined btc for $, but you could add more advanced trading logic if you wanted. The BTCex API seems to be fixed now, the only real difference between the API's is that BTCex is all 'GET' and no 'POST'.
FYI, decimal.getcontext().prec is not the number of digits after the decimal point but rather the number of total digits in the number. So you should leave that alone and use decimal.Decimal.quantize() instead.
|
BTC accepted at my browser-based MMO, Minethings.com. ~1500 active players mining now.
|
|
|
bitcoinex (OP)
|
|
March 23, 2011, 03:33:10 PM |
|
We solve problems as they come (excluding security problems) 1) I am trying to give the order: https://btcex.com/api/order?order_type=Limit&quantity_sell=1.98&pair=150&rate=4.0001&Ttl=10&ask=0&username=ArsenShnurkov&token=hereIsMyCoRRecTSesSioNid1111It returns {"error":"Wrong parameters"} Given this explaination I am unable to determine what goes wrong. 2) If I write "ttl" instead of "Ttl" site returns: "Ttl Aтpибyт Ttl oтcyтcтвyeт в cпиcкe. Пpoдaнo Aтpибyт Пpoдaнo дoлжeн быть чиcлoм." 2.1) Why russian letters are returned in this answer ? 2.2) Sample at API description page says to use "&ttl=". So it is a bug either in documentation or in code. 3) It is not documented - what should one use as a value of Ttl field 4) It is not documented which separators of decimal digits are accepted 1. In docs there is ttl, but not Ttl, read it carefully. 2.1 RTFM: For all requests you can determine language of error messages with 'language' param. Possible values is 'en' or 'ru'. 2.3 It must be ttl 3. It was, but was cleared by mistake. Now it returned. 0 minutes 15 minutes 1 hour 3 hours 6 hours 12 hours 1 day 3 days 7 days 10 days 14 days 4. Added
|
New bitcoin lottery: probiwon.com- Moжeт, ты eщё и в Heвидимyю Pyкy Pынкa вepyeшь? - Зaчeм жe вepoвaть в тo, чтo мoжнo нaблюдaть нeпocpeдcтвeннo?
|
|
|
|