<p>You can write your own bot in any modern programming language using the <a href="https://btc-e.com/api/documentation" rel="nofollow">BTC-e API</a>. Also <a href="https://en.bitcoin.it/wiki/MtGox/API" rel="nofollow">MtGox</a>, <a href="https://www.bitstamp.net/api/" rel="nofollow">Bitstamp</a>, <a href="https://bitcoin-24.com/user_api" rel="nofollow">Bitcoin-24</a> and probably more popular exchanges support this.</p>

<p>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.</p>

CC BY-SA 3.0
2013-04-19T07:23:31.057Z
How big is MtGox compared to BTCe?
Pacerier
CC BY-SA 3.0
2013-04-21T18:23:12.500Z
You can see a list of all markets sorted by trading volume on bitcoincharts.com/markets
Steven Roose
CC BY-SA 3.0
2013-04-09T00:44:19.427Z
2013-04-09T00:44:19.427Z
Steven Roose
<p>Here is a starting point I found for Btc-e using Pastebin, source here <a href="http://pastebin.com/Xu64wH1e" rel="nofollow">http://pastebin.com/Xu64wH1e</a>:</p>

<pre><code># 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()
</code></pre>

CC BY-SA 3.0
2014-01-12T16:10:31.107Z
2014-01-12T16:10:31.107Z
Frankenmint
<p>I'm interested in automatic trading but I don't know how to get started.</p>

CC BY-SA 3.0
2012-12-09T04:04:29.377Z
For market-making or for arbitrage between BTC-E and other exchanges?

Also, just BTC or for what currencies?
Stephen Gornick
CC BY-SA 3.0
2012-12-09T16:44:38.210Z
Namecoin to BTC and BTC/USD
quitmyjob
<exchanges><bots>
Is there an open source bot I can get for BTC-E?
quitmyjob
# Is there an open source bot I can get for BTC-E?

(Asked by: username_0 on 2012-12-07)

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

**Tags:** exchanges, bots

> **Comments:**
> **username_1**: For market-making or for arbitrage between BTC-E and other exchanges?  Also, just BTC or for what currencies?  
> **username_0**: Namecoin to BTC and BTC/USD  

---

## 2 answers

### Answer by username_2 on 2013-04-09. Score: 4

You can write your own bot in any modern programming language using the [BTC-e API](https://btc-e.com/api/documentation). Also [MtGox](https://en.bitcoin.it/wiki/MtGox/API), [Bitstamp](https://www.bitstamp.net/api/), [Bitcoin-24](https://bitcoin-24.com/user_api) 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.

> **Comments:**
> **username_3**: How big is MtGox compared to BTCe?  
> **username_2**: You can see a list of all markets sorted by trading volume on bitcoincharts.com/markets  

---

### Answer by username_4 on 2014-01-12. Score: 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()

```


---

