Stock market intraday cash trading robot models


You should see something like the below appearing. From my perspective the interest of such an approach is the ability to glue together R and Excel obviously but also to include via XML and batch pieces of code from Python, SQL and more. This is exactly what I needed. Making the most of the out of sample data August 19, , 9: Then a comparison of the in and out of sample data help to decide whether the model is robust enough.

This post aims at going a step further and provides a statistical method to decide whether the out of sample data is in line with what was created in sample. There is a non-parametric statistical test that does exactly this: Using the Kruskal-Wallis Test , we can decide whether the population distributions are identical without assuming them to follow the normal distribution. It exists other tests of the same nature that could fit into that framework. Then I tested each in sample subset against the out of sample data and I recorded the p-values.

This process creates not a single p-value for the Kruskall-Wallis test but a distribution making the analysis more robust. As usual what is presented in this post is a toy example that only scratches the surface of the problem and should be tailored to individual needs. As usual with those things just a kind reminder: This is a very first version of the project so do not expect perfection but hopefully it will get better over time.

Please report any comment, suggestion, bug etc… to: Doing quantitative research implies a lot of data crunching and one needs clean and reliable data to achieve this. What is really needed is clean data that is easily accessible even without an internet connection. The most efficient way to do this for me has been to maintain a set of csv files. I have one csv file per instrument and each file is named after the instrument it contains. The reason I do so is twofold: Simple yet very efficient so far.

The process is summarized in the chart below. In everything that follows, I assume that data is coming from Yahoo. The code will have to be amended for data from Google, Quandl etc… In addition I present the process of updating daily price data.

The code below is placed on a. Note that I added an output file updateLog. The process above is extremely simple because it only describes how to update daily price data. The Asset Management industry is on the verge of a major change. Over the last couple of years Robots Advisors RA have emerged as new players.

The term itself is hard to define as it encompasses a large variety of services. I found the Wikipedia definition pretty good. In this post R is just an excuse to present nicely what is a major trend in the asset management industry.

Those figures are a bit dated given how fast this industry evolves but are still very informative. It is starting to significantly affect the way traditional asset managers are doing business. Despite all the above, I think the real change is ahead of us. Ultimately it will affect the way traditional investment firms do business. Active portfolio management which is having a tough time for some years now will suffer even more.

Another potential impact is the rise of ETFs and low commission financial products in general. Obviously this has started a while ago but I do think the effect will be even more pronounced in the coming years. This trend will get stronger inevitably. Some of the functions presented here are incredibly powerful but unfortunately buried in the documentation hence my desire to create a dedicated post. I only address daily or lower frequency times series. The example below loads the package and creates a daily time series of days normaly distributed returns.

The join argument does the magic! Apply a specified function to each distinct period in a given time series object. Extract index values of a given xts object corresponding to the last observations given a period specified by on. Generic function for replacing each NA with the most recent non-NA prior to it. For a set of returns, create a wealth index chart, bars for per-period performance, and underwater chart for drawdown.

This is incredibly useful as it displays on a single window all the relevant information for a quick visual inspection of a trading strategy. The list above is by no means exhaustive but once you master the functions describe in this post it makes the manipulation of financial time series a lot easier, the code shorter and the readability of the code better.

When it comes to managing a portfolio of stocks versus a benchmark the problem is very different from defining an absolute return strategy. I strongly encourage anyone with an interest in the topic to read the book from the beginning to the end. In this post I focus on two simple and widely used metrics: The IC gives an overview of the factor forecasting ability.

Obviously ICs must be as high as possible in absolute terms. The usefulness of this tool is straightforward. A factor can have a good IC but its predictive power might be limited to a small number of stocks.

Obviously there is a survival ship bias: This measure is much less sensitive to outliers than arithmetic mean. I applied for only one job as a software engineer. It was the kind of job people love - high salary, all the Silicon Valley benefits, friendly team, well funded company, challenging engineering problems.

After three rounds of interview they decided not to move forward with me. I did want it. But I also feared losing my freedom. Gone would be the days where I could spontaneously book a flight to India with no return date. Going through the interview process made the possibility of losing my freedom real. I went into panic mode searching for a way I could make money on my own.

At this point I still owned Ethereum and the price was still swinging back and forth. I signed up for two exchanges: I needed Poloniex as well because there were many cryptocurrencies being traded there Altcoins - cryptocurrerncies that are not BTC.

Those are the first two exchanges that I used. Now I use others since each exchange has pros and cons. A live crypto exchange is intimidating at first glance. There are charts and numbers changing at the speed of sight. I felt overwhelmed but sat through the confusion to try and make sense of what I was looking at. Soon I could see where to place orders to buy and sell, and the charts started to make sense too.

As the month went on I spent hours trading. I made enough to pay my rent, so the possibility of making a living from this was validated. I wanted to formalize my trading knowledge so I could do more than buy low and sell high. There had to be a real strategy to this stuff. I read as many books as I could on trading stocks and foreign exchange markets. I made a lot of mistakes. But eventually I found my rhythm and strategies. For myself, and most crypto traders, the goal is to increase the amount of Bitcoin we own.

For example, right now the price of 1 ETH Ethereum is 0. Another thing I need to make clear is the type of trading I do - day trading. All of my profits are converted back into BTC at the end of each trading day. Again, even though I buy and sell several Altcoins, at the end of the day my net worth is in Bitcoin.

There are three reasons for this:. I earn more USD when the price of Bitcoin goes up against the dollar. Why was it important to clear this up? Several things were on my mind the first time I had to do this. What if I sell my BTC now and the price shoots up tomorrow?

Yes, but your bills will be paid. Sell now so you can pay your rent. You can always hold out for more, but at the same time you are risking a loss. After a few months I got better at trading. I was earning more Bitcoin than I needed to cover my monthly expenses. At the end of the month I sold only what I needed, and kept the rest of my net worth in Bitcoin. Around this time in my trading career it was getting to the point where I could have bought a Tesla or put a down payment on a house by selling my Bitcoin.

Do you sell your Bitcoin to realize your profit in USD? I can live a nice middle class lifestyle in Los Angeles. Or I can drive a flashy car while I rent a crappy apartment in Los Angeles. It all comes down to your values. In fact, if i see a chart like this I almost always ignore it:. The wild bull runs are hard to find, hard to time properly, and easy to go in the opposite direction where you lose a lot.

Those gains are only exciting if you understand how far they can get you. Of course the numbers above assume you trade days per year. Not many people are willing to forego vacation and weekends to work as a full time crypto trader, even with numbers like that. Not only that but I also let my emotions control my trades. For example, I once purchased Stratis after the price dropped massively.

My assumption was that on such a sharp decrease in price, it had to rebound eventually. The price kept diving. I was constantly tuned into that chart waiting for an opportunity to sell back to Bitcoin. Now I have my strategy that I stick to without letting my emotions interfere. I have a set of coins that I like trading so I only look at those charts. I have patterns and indicators that I look for on those charts so I can quickly flip through them. Within minutes I can set my orders, set alerts on my desired entry and exit prices, and walk away from the computer.

As the market cap of crypto increases, be sure that the IRS is going to find out how to get their slice. And they will look into the past. I am not a tax advisor. This is a simple overview of what I keep in mind as I trade. My accountant handles my taxes, and I advise you to get an accountant to do the same. Keep in mind that this is US-centric. You need to double check if this is the case in your country. The taxable event is when you sell your cryptocurrency for fiat.