Part 1: MATLAB, Neural Networks and the BTC-e trading API.

Let’s get started:

This might contain around 5 parts, so here we go..

exampleANN

I’m in the beginning process of developing a trading-bot using Matlab. Right now the plan is to save data concerning what the order-books look like before and after a dump. This data will be used for training the Neural Network through identification using pattern recognition.

exampleANN2

Multiple indicators will be incorporated as input data also, but we will save that part for later.

The bot needs to have an understanding of order-book trends and the following implications to the price.

A Brief Walk-through on Data Retrieval:

The data is sourced from the BTC-e Trading API

(You will find the need to add urlread2 to your project folder in MATLAB).

urlread2 can be found at the following:

http://www.mathworks.com/matlabcentral/fileexchange/35693-urlread2

Trading API for MATLAB at the following:

http://www.mathworks.com/matlabcentral/fileexchange/44890-btc-e-trade-api

Here is a list of all possible requests:

% response = GetInfo()
% response = TransHistory()
% response = TradeHistory(‘count’,2)
% response = ActiveOrders()
% response = Trade(‘pair’,’btc_usd’,’type’,’buy’,’rate’,200,’amount’,1)
% response = CancelOrder(‘order_id’,651389)
% ticker_output = realtime_ticker(‘btc_usd’);

The default amount is set to only retrieve 150 listings in the orderbooks, whether they are bidding or asking.

We definitely want to get a larger data set than 150 listings. The reason being is that we are going to be creating an Artificial Neural Network and training it with this data. The larger the data set, the better life we all live. The maximum limit for the GET method from BTC-e is 2000 listings. So we’ll go ahead and use that.

To change that we make our own function to change the get method limit to ‘2000’:

example

You don’t have to do it like this, but this is just one way.

I’ve been recently recording the history of order-book movement for the  LTC/BTC pair.

dump

While resting at a somewhat steady exchange rate of 0.0076 for a few days, we recently witnessed a dump to around 0.0073. Having said that, take a look at the order-book movement through the dump. We will be collecting this data to train the bot to recognize a dump before it happens.

Resting:

ltcbtc2

Let the dump begin:

dumpltcbtc dump

Bid Volume starts increasing:

recover

The Recovery stage:

buyback

I will have a break down on gathering and allocating the data to the neural network in part 2.

Thanks for reading!

Any and all tips are greatly appreciated.
BTC:16v9zKaAGiRiqHrcr1BXzYxiSjXqGuFaTA 
LTC:LfQKBDrbPcEM6ioKRxCx8iXjrAJx4Yvake