TL;DR: My weekend project – generating report for BTC trading, that can be found here: http://www.matvoz.com/bitcoin
I guess the best way to learn something is to actually try and fiddle with it somehow.
That is why I dedicated the last weekend of the year 2013 to exploring bitcoin exchange. All this hype about altercoins made me wonder what is going on at these markets (mtgox, btc-e, bitstamp…). Especially what can somebody see through the numbers. I gave myself a two day deadline to just see where it will lead me.
My prior knowledge consisted of knowing enough about bitcoin and altercoins. I even bought a bitcoin when it was still a $100. I also had a theory about how stock exchange functions.
I know I should have tried bitstamp, because the owners are from the same country and I know they are doing a great job, but somehow I found myself on btc-e’s webpage and used their APIs.
For anybody who doesn’t know what APIs are, let’s just say that one part of this is when you go to a certain URL, you get some data without any design. This data is there for you to use it. For example, if you would use this URL https://btc-e.com/api/2/btc_usd/ticker, you would get only this in your browser:
{"ticker":{"high":738,"low":714.98999,"avg":726.494995,"vol":6452322.62343,"vol_cur":8868.1944,"last":735,"buy":735,"sell":734.5,"updated":1388435911,"server_time":1388435911}}
Normaly you wouldn’t want to use this kind of view when in a browser, but it gets handy for computer processing.
Before I jumped into PHP, multidimensional arrays and math, I wanted to understand what all that data means. What are sell orders, buy orders, trade history, what are asks and bids… From now on I will concentrate on Bitcoin(BTC) – USD trading.
Current price – the last price that was used to buy or sale BTC (ie. 736.998 USD per 1 BTC)
Sell orders – Somebody would like to sell BTC, but usually not for the current price, but for more. The more he wants, the longer he will have to wait for somebody to buy it from him. So he ASKS x USD per 1 BTC for his n BTC. (ie. He would like 737.51 USD per 1 BTC, and for that price he is willing to sell 0.456 BTC)
Buy orders – Somebody would like to buy BTC, but usually not for the current price, but for less. The less he wants, the longer he will have to wait for somebody to sell it from him. So he BIDS x USD per 1 BTC for n BTC. (ie. He would give 735.1 USD per 1 BTC, and for that price he is willing to buy 3.41 BTC)
Trade history – the last trades that were successful on the market (somebody did buy or sell BTC)
So let’s say that if I really really would like to buy 10 BTCs right now, and the sell order looks like this:
736 USD for 8.8 BTC;
736.998 USD for 0.05 BTC;
737.787 USD for 5.46 BTC
I would have to buy for 736 from the first guy for 8.8 BTC, and because I still need 1.2 BTC I would have to buy for 736,998 USD a BTC for 0.05 BTC from the second guy in a row and lastly 0.7 BTC from the third guy for a price of 737.787 USD per BTC.
After finding all this out I looked at the APIs and wanted to make my own report.
I used three APIs, one for the current price (ticker), one for sell and buy orders (first 150) and one for trade history (last 150).
The raw numbers didn’t mean much to me, so I wanted to make use of them.
Some summarizing of Sell and buy orders. There are a lot of orders in number, but after I’ve addet up all the multiplications of price for 1 BTC and quantity of BTCs for each orders (buy and sell respectively), I’ve found that view can be deceiving. If I would need to guess if the price will rise or fall, one indicator would surely be the percentage of the difference between equity from both orders. If there is more money (average price for 1 BTC multiplied with all the BTC everybody is willing to sell/buy) on the selling order, than the price can drop.
Later I found out, that some orders can be fake to just make some noise and distort the whole picture. I saw some large orders waiting patiently until the price was almost the same as they wanted it to sell/buy, but then they canceled the order.
I also wanted to know when/where are these orders. Are they near the current price, or are they much higher/lower. That is why I split the data into six parts. Price for first order, price for 30th order, 60th, 90th, 120th and price for the last order. I calculated the procentage of rise or fall of the price and the averages for each part (price, quantity, and multiplication of price and quantity). So even if the Buy order has more equity I could find out that most of that equity would come into use in the last part, so at a very low price.
After the orders I wanted to see the last 150 trades more clearly. Firstly I divided the data to six parts and followed the price and percentage of its rise or fall.
I also wanted to know the actual equity that was sold or bought and how many transactions was for each one. But just the transactions can be deceiving – at the moment of writing there were 76 transactions for selling bitcoin and 74 for buying; that would mean that both are more or less equal. They aren’t. These 76 transactions sold 11,37 BTC for 8,355.61 USD and these other 74 transactions bought 21.43 BTC for 15,751.89 USD. So 46.955% more BTC was bought than sold.
One part of the reportLastly I also wanted to know the price, quantity and multiplication of both for all the parts for sold and bought BTC.
Because I wanted to see if my findings could be a foundation to an automatic trader if I ever find another free weekend I followed the numbers and properly foresaw the rise and fall of BTC in one one-hour interval. Let there be beginners luck or just coincidance, I am declaring this weekend project as a success. I’ve learned yet another subject that may or may not be of any future use to me, but it was fun and rewarding.
If you found the power to scroll all the way to here, I hope you found something new (I know many of you know a lot more about this subject than me) and I appologise if any statement here is not correct or plain wrong. And if you missed the link at the top, my live report page can be seen here: http://www.matvoz.com/bitcoin
Comments are closed