Considerations before starting Part 2:
I will not be going in to full detail on every step and I will be assuming you have a basic understanding of MATLAB. Feel free to leave a reply if you have any questions.
Example of recording order-book movement through time:
After Part 2 we will have the functions necessary to start capturing useful data.
Capturing Data:
Initially, we want to have our data constructed in a way that will be easy for us to use and manage.
To start, I have created a main function to initiate when we want to record the status of the order-books and the corresponding price fluctuation.
There are 3 sub-functions that pertain to the three pairs I am collecting order-book data on.
We will get started by creating those first.
ltcbtc_orderbookMovement does the following:
Every function underlined in blue you will find in the BTC-e Trading API link I referred to in part one. I underlined urlread2 to emphasize that it needs to be in the same folder as all of the BTC-e API files and functions (Which should be the directory you’re working from).
On the last line we are simply converting the incoming information from a structure to a data-set.
Continuing ltcbtc_orderbookMovement :
During the for loop we are using strcmp to separate the two types of orders, ‘ask’ and ‘bid’.
We are allocating the ask orders and bid order to individual output cell arrays. After doing so, we then use cellfun to remove all empty cells in the array. This is important because we will be concatenating this data with whatever it was previously. If it is your first time running the function and you do not have variables set up, don’t worry. The following rest of this function will take care of that.
Continuing ltcbtc_orderbookMovement :
The double save is redundant and unecessary.
Now that you have an idea on how we want the incoming information structured, you can go ahead and create two more of these function for BTC/USD and LTC/USD. Rename the variables however you please but make sure to check line 34 and change “orderbook=dataset.ltc_btc;” to which ever pair you’re waiting to gather data from.
This process can also be repeated to create the function priceHistory() referenced to at the beginning of this entry. Just change the necessary information to pull from the function realtime_ticker() referenced to in Part 1.
Now that data gathering is out of the way. We can get to the fun stuff!
Any and all tips are greatly appreciated. BTC:16v9zKaAGiRiqHrcr1BXzYxiSjXqGuFaTA LTC:LfQKBDrbPcEM6ioKRxCx8iXjrAJx4Yvake