Skip to content

The Basics

uzillion edited this page Jul 7, 2018 · 7 revisions

The project primarily makes use of WebSocket APIs of different exchanges. On subscribing (connecting) to a channel via a WebSocket, a continuous stream of data is sent to the server. On every message that is received, the server passes the data to its appropriate handlers that check for various conditions before deciding to send an alert to the user.

Let's take a look at the 2 primary types of channels that are subscribed to in the project:

1. Trades

A trade occurs when 2 parties buy and sell an asset — in this case a cryptocurrency. It is important to note that just placing an order does not mean a trade has occurred, nor does it ensure that a trade will occur. Only when the cryptocurrency trades its place from one party to another, can we say a trade has occurred.

Trades can be an important indicator of the attitude of the market. It can also show what the big players are doing.

For example, if the price of BTC has dropped significantly, and you start getting successive alerts of huge amounts of BTC being bought. If this buy-side action is not followed by similar sell-side action, this could mean that people are getting bullish on BTC, and a price increase should be imminent. The converse could stand true as well.

However, it is extremely risky to make decisions purely based on trades. It is impossible to predict for how long will the buy-side (or sell-side) action hold, that is if it holds at all.

The trade stream is handled by files inside the trades folder. Read further about it here.

2. Maker Orders

Every trade consists of 2 types of individuals — a maker and a taker. A maker is an individual who places the order in the market for display with a fixed price. The taker is the individual that agrees to the maker's price and usually covers the bid-ask spread (the gap between the bids and asks). The makers' orders appear on the order book and are used in the display of depth maps.

The bid makers are the people who are displaying their interest in buying a cryptocurrency at a fixed price. Conversely, the ask maskers are the people who are placing their cryptocurrency for sale in the market at a fixed price. If makers have fixed prices, it goes without saying that the taker will have to bend to the will of the makers by agreeing to their price. Therefore, the takers' orders are filled almost immediately and never appear on the order book; they are dependent on the maker's price. Optional reading about makers and takers here.

In general, if the maker is on sell-side, and the taker is on the buy-side, it means taker is more desperate to buy the cryptocurrency than the maker is to sell the currency. This, in turn, will drive the price up. The inverse is true too. This is the foundation of market price changes; if the buyers are more desperate to buy the asset than the sellers are to sell it, they will be in greater numbers, and the price will climb. And if the sellers are more desperate to sell the asset than the buyers are to buy it, they will be in greater numbers as compared to the buyers, and the prices will fall. This is also called the Law of Demand and Supply.

The motive of subscribing to the makers' orders is to evaluate which side—buy or sell—is greater and more desperate, and then forecast which way the price is going to move. In our project, we do this by taking the ratio of the total quantity of a cryptocurrency being sold to being bought, and then depending on if the ratio is greater or lesser than one, alert the user of sell-side pressure or buy-side pressure respectively.

Like trades, making decisions purely on the basis of buy and sell volumes is foolish and can prove very dangerous. This is because it is very common for people to place fake buy and sell orders of huge quantities just to manipulate the market. These are called fake walls, and one should remain wary from them.

Maker orders and the order books are handled by files inside the orders folder. More about it here.

Conclusion

As seen from above, neither trades nor orders alone can be trusted for making investment decisions. Rather, it is the combination of these 2 that can provide a valuable insight into which direction the market is heading towards.

For example, only if the significantly larger buy volume gets converted into multiple big buy trades can we say with some confidence that the price is going to move upwards. On the other hand, if the larger buy volume does not result in successive large buy trades, and the buy volume disappears into thin air, it is safe to say that this increase in buy volume was a manipulative scheme of pump and dump. Optional reading about buy and sell walls here.

Clone this wiki locally