Attenti a bitcoin code
Thanks a lot to aerinykimsuzatweet and hardmaru for the useful feedback! The academic Deep Learning research community has largely stayed away from the financial markets. I believe that it has not received enough attention from the research community but has the potential to push the state-of-the art of many related fields. It is quite similar to training agents for multiplayer games such as DotA, and many of the same research problems attenti a bitcoin code over.
Knowing virtually nothing about trading, I have spent the past few months working on a project in this field. Instead, I want to talk on a more high level about why learning to trade using Machine Learning is difficult, what some of the attenti a bitcoin code are, and where I think Reinforcement Learning fits in.
I will use cryptocurrencies as a running example in this post, but the same concepts apply to most of the financial markets. The reason to use cryptocurrencies is that data is free, public, and easily accessible. Attenti a bitcoin code can sign up to trade. The barriers to trading in the financial markets are a little higher, and data can be expensive. The exchange is responsible for the matching. There are dozens of exchanges and each may carry slightly different products such as Bitcoin or Ethereum versus U.
Interface-wise, and in terms of the data they provide, they all look pretty much the same. You would go to this page and see something like this:.
The current price is the price of the most recent trade. It varies depending on whether that trade was a buy or a sell more on that below. In the picture above, that period is 5 minutes, but you can change it using the dropdown. The bars below the price chart show the Volume Vwhich is the total volume of all trades that happened in that period.
The volume is important because it gives you a sense of the liquidity of the market. A high trade volume indicates that many people are willing to transact, which means that you are likely to able to buy or sell when you want to do so.
Generally speaking, the more money you want to invest, the more trade volume you want. High volume means you can rely on the price movement more than if there was low volume. High volume is often but not always, as in the case of market manipulation the consensus of a large number of market participants. The right side shows a history of all recent trades. Each trade has a size, price, timestamp, and direction buy or sell.
A trade is a match between two parties, a taker and a maker. More on that below. The left side shows the order book, which contains information about who is willing to buy and sell at what price. The order book is made up of two sides: Asks also called offersand Bids. Asks are people willing to sell, and bids are people willing to buy. By definition, the best askthe lowest price that someone is willing to sell at, is larger than the best bidthe highest price that someone is willing to buy at.
The difference between the best ask and best bid is called the spread. Each attenti a bitcoin code of the order book has a price and a volume. For example, a volume of 2. If you want to buy more, you would need to pay a higher price for the amount that exceeds 2 BTC. There could one person selling 2 BTC, or there could be people selling 0. So what happens when you send an order to buy 3 BTC?
You would be buying rounding up 0. On GDAX, you would also be paying a 0. Selling works analogously, just that you are now operating on the bid side of the order book, and potentially moving the order book and price down.
In other words, by placing buy and sell orders, you are removing volume from the order book. If your orders are large enough, you may shift attenti a bitcoin code order book by several levels. In fact, if you placed a very large order for a few million dollars, you would shift the order book and price significantly. How do orders get into the order book? For example, imagine that most of the lower levels in the order book only had a volume at 0.
Most of your buy volume would then get matched at a much higher, more expensive, price level. The order will be placed into the book, and you can cancel it as long as it has not been matched. You place a limit order.
If the price keeps moving down your order will just sit there, do nothing, and will attenti a bitcoin code be matched. You can cancel it anytime. However, if the price moves up, your order will at some point become the best price in the book, and the next person submitting a market order for a sufficient quantity will match it.
Market orders take liquidity attenti a bitcoin code the market. At the same time, limit orders guarantee that you will not pay more than the price specified in the limit order. You are also giving the market information about what you believe the price should be. This can also be used to manipulate the other participants in the market, who may act a certain way based on the orders you are executing or putting into the book. Because they provide the option to trade and give away information, market makers typically pay lower fees than market takers.
Some exchanges also provide stop orders, which allow you to set a maximum price for your market orders. This was a very short introduction of how order books works and matching works.
There are many more subtleties as well other, much more complex, order types. Attenti a bitcoin code the above was not attenti a bitcoin code, you can find a wealth of information about order book mechanics, and research in that area, through Google. The main reasons I am using cryptocurrencies in this post is because data is public, free, and easy to obtain. Most exchanges have streaming APIs that attenti a bitcoin code you to receive market updates in real-time. A new Trade has happened.
Each trade has a timestamp, attenti a bitcoin code unique ID assigned by the exchange, a price, size, and side, as discussed above. If you wanted to plot the price graph of an asset, you would simply plot the price of all trades. If you wanted to plot the candlestick chart, you would window the trade events for a certain period, such as five minutes, and then plot the windows. One or more levels in the order book were updated. Note that these are changes, or deltas, and you must construct the full order book yourself by merging them.
Similar to a BookUpdate, but a snapshot of the complete order book. Because the attenti a bitcoin code order book can be very large, it is faster and more efficient to use the BookUpdate events instead. However, attenti a bitcoin code an occasional snapshot can be useful. A stream of the above events contains all the information you saw in the GUI interface.
You can imagine how you could make prediction based on a stream of the above events. When developing trading algorithms, what attenti a bitcoin code you optimize for? You also need to compare your trading strategy to baselines, and compare its risk and volatility to other investments. Here are a few of the most basic metrics that traders are using. Simply how much money an algorithm makes positive or loses negative over some period of time, minus the trading fees. Alpha defines how much better, in terms of profit, your strategy is when compared to an alternative, relatively risk-free, investment, like a government bond.
Even if your strategy is profitable, you could be better off investing in a risk-free alternative. Beta is closely related, and tells you how volatile your strategy is compared to the market. For example, a beta of 0. The Sharpe Ratio measures the excess return per unit of risk you are taking. Thus, the higher the better. It takes into account both the volatility of your strategy, as well as an alternative risk-free investment.
The Maximum Drawdown is the maximum difference between a local maximum and the subsequent local minimum, another measure of risk. Clearly, a lower maximum drawdown is better. Value at Risk is a risk metric that attenti a bitcoin code how much attenti a bitcoin code you may lose over a given time frame with some probability, assuming normal market conditions. The most obvious approach we can take is price prediction. If we can predict that the market will move up we can buy now, and sell once the market has moved.
However, there are a few problems with this. First of all, what price do we actually predict? The final price we pay depends on the volume available at different levels of the order book, and the fees we need to pay. A naive thing attenti a bitcoin code do is to predict the mid pricewhich is the mid-point between the best bid and best ask. The next question is time scale. Do we predict the price of the next trade? The price at the next second? Intuitively, the further in the future we want to predict, the more uncertainty there is, and the more difficult the prediction problem becomes.
So, attenti a bitcoin code much money have we made?