Is there an open source bot I can get for BTC-E?

4

1

I'm interested in automatic trading but I don't know how to get started.

quitmyjob

Posted 2012-12-07T15:49:46.113

Reputation: 51

For market-making or for arbitrage between BTC-E and other exchanges?

Also, just BTC or for what currencies? – Stephen Gornick 2012-12-09T04:04:29.377

Namecoin to BTC and BTC/USDquitmyjob 2012-12-09T16:44:38.210

Answers

4

You can write your own bot in any modern programming language using the BTC-e API. Also MtGox, Bitstamp, Bitcoin-24 and probably more popular exchanges support this.

These API's mostly give you the possibility to track the price, the market depth and place orders, making easy for you to implement your own trading bot.

Steven Roose

Posted 2012-12-07T15:49:46.113

Reputation: 10 855

How big is MtGox compared to BTCe?Pacerier 2013-04-19T07:23:31.057

You can see a list of all markets sorted by trading volume on bitcoincharts.com/marketsSteven Roose 2013-04-21T18:23:12.500

0

Here is a starting point I found for Btc-e using Pastebin, source here http://pastebin.com/Xu64wH1e:

# BTC-e trade module takes options, pair the pair being traded eg. ltc_usd, ltc_btc,
# btc_usd. type the type of transaction buy or sell, rate the price you are buying or selling
# at with leading zero if decimal (0.025 not .025), and amount the amount to buy or sell.
#  Usage ./trade.py ltc_btc sell 0.0075 568
# Based on the already existing sample code placed on this site with my additions to make
# a working example.

import sys
import httplib
import urllib
import json
import hashlib
import hmac

# Replace these with your own API key data when generating the key be sure to check the trade
# box.
BTC_api_key = "your-api-key-here"
BTC_api_secret = "your-api-secret-here"

# Reading file to get nonce last used then increment and store for next use.
# You must create the file nonce.txt if first time using the trade api put the number 1 in it.
# It must be in the current directory as you are running the .py file in or change to correct
# path in the open(....).

with open('nonce.txt') as f:
n = int(f.read()) + 1
f.close()
with open('nonce.txt', 'w') as f:
f.write(str(n))
f.close()
nonce = n

# method name, options and nonce go into the POST parameters
params = {"method":"Trade",
      "pair" : sys.argv[1] ,
      "type" : sys.argv[2] ,
      "rate" : sys.argv[3] ,
      "amount" : sys.argv[4] ,
      "nonce": nonce}
params = urllib.urlencode(params)

# Hash the params string to produce the Sign header value
H = hmac.new(BTC_api_secret, digestmod=hashlib.sha512)
H.update(params)
sign = H.hexdigest()

headers = {"Content-type": "application/x-www-form-urlencoded",
               "Key":BTC_api_key,
               "Sign":sign}
conn = httplib.HTTPSConnection("btc-e.com")
conn.request("POST", "/tapi", params, headers)
response = conn.getresponse()

print response.status, response.reason
print json.load(response)

conn.close()

Frankenmint

Posted 2012-12-07T15:49:46.113

Reputation: 415