For clarification, this post has to do with me killing my trading bot project, and nothing to do with MiningMonitor itself. MiningMonitor is doing very well for us, and if nothing else, we use it ourselves for our miners After fiddling around, I think it's time to show off, then shelve my pet project.
For those who don't read the Mining boards, I am the lead developer behind
MiningMonitor.com (
Board Post ).
---------------
Starting as a possible feature of MiningMonitor, I developed an advanced interface to MTGox:
http://f.cl.ly/items/1O2c3H1N3V0Y1y1X0Q3B/Screen%20shot%202011-07-13%20at%205.08.44%20PM.png( Yes, High Stop/Low stop aren't real terms... one is a plain sell order "dark" since it's not an outstanding order on MTGox, and and the other is a simple stop order )
Technically the screenshot above shows you a very simple bot. If the price is above X or below Y, sell.Going from there, it almost seemed logical to write a bot. Simple trading bots are a breeze to write... they are really just based around 4 rules
1) Check spot if time since last check is > window
2) If price is below x, buy one unit of btc, note actual price paid ( for easy math, you can buy 1.003btc so 1btc get put in your account )
3) If price is above Y , sell one unit of btc given that spot_price = pricepurchased + (pricepurchased * desired gain )
4) Set a stop to prevent unbound loss ( either overall, or on a per unit purchased basis )
With a little manipulation of X and Y, it's easy to turn a small profit...
A more complex bot makes buying and selling discussions based on various indicators, EMA, WMA, HMA, Ease of movement, the MACD, my personal favorite for the current market RSI, etc. Using an indicator based bot allows for maximizing
the margin since mins and maxs are identified by the signals1) Assuming a certain timewindow ( could be a per trade window if you want ) , get low, high, total volume, open, close
2) Calculate indicators
Assuming for this example we are using RSI , though in reality, multiple combined indicators give you your buy and sell singnals
3) if RSI is < 30, buy a unit of btc , note effective price paid
4) if RSI is > 70, sell unit of btc given that spot_price > pricepurchased + desired minimum gain per transaction
5) Set stops
---
Both of these examples are simplified for brevity.
---
So, once I had a simple bot, I started thinking of a more complex bot. But , given the number of possible signals, and the number of ways to tune them, what is a programmer to do?
Use a genetic algorithm of course http://f.cl.ly/items/290Q2o3l3k1g3S0M0r3t/Screen%20shot%202011-07-15%20at%205.21.34%20PM.pngAnd if you're doing that, you need a way to visualize the results
http://f.cl.ly/items/1W2O0Y3X1Q0C462B3N1w/Screen%20shot%202011-07-12%20at%206.02.19%20PM.png----
Writing a higher level bot/genetic algorithm is again, not that difficult to do:
sub fitness {
# load the data
foreach my $trade (@$ref) {
# determine the current values of your indicators
# pass data to algorithm which decides what to do
# perform action ( buy, sell, hold )
# repeat
}
my $final_networth = $btc * $spot_price + $cash;
my $performance = ($final_networth-$start_networth)/$start_networth*100;
print "Genome: $genome Fitness: $final_networth Performance: $performace\%\n";
return $final_networth;
}
With your algorithm, or trade bot, deciding what it should do based on the data passed in
I developed a number of different trading algorithms:
hurrr_i_am_a_bot
force_1btc
let_the_btc_hit_the_floor
tiny_bubbles
fuck_it_all_RSI_alone
kitchen_sink
( there were a couple of more, but I took them out back and shot them in the head ... they had fundamental flaws in their designs )
Each had it's strength and weaknesses.... for example fuck_it_all_RSI_alone loves a market like the one we are in... very small movements , lots of bouncing around in a constricted range.
kitchen_sink is the most adaptive, and can live in any market since it uses all the indicators, but it needs to be tweaked alot to stay profitable.
----
So the actual trading bot has two parts:
the_brain
the_brawn
Every hour or so , the_brain takes the last 12 hours of trading data, uses genetic algorithms to decide which trading algorithm and settings for said algorithm works best, and tells the_brawn to use them. This allows for automated switching based on current market conditions to a trading algorithm.
The_brawn just reads the live trading data, applies the various metrics to the data, and feeds the data, and settings to the algorithm the_brain decided on, takes back a market order ( buy, sell, twiddle thumbs ), pushes it off to mtgox if needed and repeats.
-----
What is the end result? It's profitable... ~2.5% a day fully automated... but I'm killing off the project
-----
But Pete, that sounds great! Why kill the project?Couple of reasons....
1) the_brain & the_brawn are a little fragile, it would take a decent amount of work to make it usable/shareable
2) Security, if I wanted to let people have access to the bot, they need to give me the MTGOX username/password ... so the original plan was to simply charge $XX per month and give each person their own VPS loaded with DB and software... that way even if one DB got penetrated, everyone's user/pass wasn't exposed
3) Bored now... I've taken it to the point where beyond this would require a much higher understanding of finance and signals
4) Value: Dudes, and dudettes, it's not worth it... the market is too small
---
Number 1 is laziness, 2 is paranoia, 3 is just a fact, but number 4 is the real reason.
The market for BTC has such low volume, and is of such a small size, that a bot that could make any real money would actually affect the market in doing so... since there are no Fill or Kills on MTGox , trying to buy/sell units of BTCs > ~5 at any certain times can move the price of BTC by pennies ( fractions of a percent ).
My personal bot running has been averaging around 2.5% a day, but that's peanuts... 2.5% of 300$ is $7.50 a day... an hour of freelance work makes me 6->14 TIMES that ...
And since I've satisfied my intellectual curiosity... I thought I would share with you folks a post mortem, and give some direction to people screwing around with the idea of a bot some pointers.
Hope you enjoyed reading,
Peter Azuolas
tl;dr: Developed interface to MTGox, built simple trade bot, built genetic algorithm test bed for trading algoritms, turned it into a live bot, make 2.5% a day, killing project because intellectually satisfied and not worth it anymore