New York Institute of Finance and Google Cloud launch a Machine Learning for Trading Specialisation on Coursera

Jim,

Since you like machine learning, I think you might be interested in this new course at Coursera.

Regards
James

New York Institute of Finance and Google Cloud launch a Machine Learning for Trading Specialisation on Coursera

27/01/2020

The New York Institute of Finance (NYIF) and Google Cloud have launched a new Machine Learning for Trading Specialisation available exclusively on the Coursera platform.

The Specialisation helps learners leverage the latest AI and machine learning techniques for financial trading.

Composed of three courses in financial trading, machine learning, and artificial intelligence, the Specialisation features a blend of theoretical and applied learning. Topics include analysing market data sets, building financial models for quantitative and algorithmic trading, and applying machine learning in quantitative finance.

The Specialisation is particularly suited for hedge fund traders, analysts, day traders, those involved in investment management or portfolio management, and anyone interested in constructing effective trading strategies using machine learning. Prerequisites include basic competency with Python, familiarity with pertinent libraries for machine learning, a background in statistics, and foundational knowledge of financial markets.

https://www.coursera.org/specializations/machine-learning-trading#courses

Thank you James!

I just enrolled in the class (audited it for free). I was unaware of this particular class and it definitely looks interesting!

You probably saw in one of my posts that I have taken many Coursera courses already. So I know the courses are good and there is always something useful. The instructors are often top in their field.

Great recommendation and much appreciated!!!

-Jim

Jim,

At the end of this course, you will be to build complex pair trading strategies (similar to statistical arbitrage used by Medallion) including prediction models based on Reinforcement Learning.

I am very interested to explore stat arb due to its low volatility and highly profitable (when used together with leverage).

Perhaps we can work on a project together later on to develop something usefjul.

Regards
James

James,

Yes, I saw that. Just like we have talked about before.

I would like to work with you. I have not done reinforcement learning yet.

But as you probably know Deep Learning using TensorFlow is actually very easy (do not tell anyone outside of the P123 community this) and the course probably would walk us through what we need to do to add reinforcement learning. Those courses are usually self contained (I have not finished it).

Just to make you aware, my money is in a SEP-IRA account and I probably cannot do pair trading in it. I could probably pull some money out of the bank to trade.

But I would like to contribute just for the fun of it if you want!

-Jim

Jim,

I want to send you this book via email. It is a 25MB file.

Is it too big for your email account?

Regards
James


Thank you James!!!

Already have it!

Do you have any chapters/methods in mind that I could re-read?

Good book. Probably readable for most members. I think. No math to machine learning. Just light programming and an Excel csv file to upload if you want to get started or use the book examples.

Do not even need a computer: check out Google Colab (okay you need an internet connection but probably could be a trader with your smart TV). Copy and paste code from the book.

Best,

Jim

Jim,

The book is too difficult for me since I don’t know Python and not a good programmer,

I am more a investment banking/finance guy.

Regards
James

James,

Start Python. The absolute truth is the hardest part for me was figuring out how to upload a csv file when I started. It is downhill after that. You will get your own collection of code that you can copy and paste into other scripts/programs.

All the code you need can be copied and pasted. From the book or just Google what you want with the word Python in the search. There will be all the code you need to copy and paste by the 5th link in the search.

Read all of the O’Reilly books on Python and Pandas. Pandas was developed for use by AQR Capital Management.

Sure I like math but my only computer training was a Fortran Course (with punch cards) and an audited DOS course when I switched from an old MacIntosh to early windows.

Coursera I guess, but that was after I learned some Python.

You know how to use Coursera. I think there are courses on Python in there. It will not be hard.

Best,

Jim

Jim,

Since you know Python, do you have an account at Quantopian? I understand that you can copy/paste different functions from all kind of data libraries to build algos at Quantopian and run strategies like pairs tradings and run long/short books that you can’t do here.

Regards
James

I do have an account there. I saw the pair trading course. I did not go through it (because of the SEP-IRA thing).

I think you could learn Python there. I plan to use it as a resource to improve my skills.

I am not good at Python. But Machine Learning is really a separate (and very easy) thing.

For example, I would often prefer to just get the average return of something I do. Plotting the equity curve is not something I like to do.

I would prefer to construct an entire Random Forest than sort the results (predictions). I suspect most programers would read that sentence and think I have no programming skill. I would not disagree.

-Jim

Jim,

Thanks for your suggestion about Python, I would definitely consider it even though programming is not exactly my strength.

Going back to the Machine Learning for Trading Specilisation course, is it a 3 months course (1 month per module) or a 1 month course?

If it is a 3 months course, let’s continue our discussions about the pair trading (stat arb) project in the summer. I think it is more prudent to start with paper trading and not commit any real capital to begin with if we end up developing something useful. So don’t worry about the SEP-IRA thing and taking money out of the bank to trade.

Regards
James

James,

Great. I can send code to you (assuming I can do it myself).

BTW, you can even send a Python File to Excel sort/delete rows there and send back to Python. I think you can do what you want with Python if you are patient.

My advice: learn Python!

Best,

Jim

James,

I am still looking at the course.

But I wonder if this is not getting close to what you are looking for so I thought to share it with you. This inputs the historical returns of one of my ports (Y) and 9 Sector SPDR ETFs.

I then set it to market_neutral = True (line 53) and weight bounds = (-1,1) so that it will go short(line 52).

I also set the target_return = 0.06 or 6% (line 53)

So it will give me the optimal market neutral portfolio for those assets with the given target return allowing shorts.

The code:

pip install PyPortfolioOpt
import pandas as pd
df=pd.read_csv(‘/Users/JamesRinne/opt/ReadFile/popt.csv’)
from pypfopt.expected_returns import mean_historical_return
from pypfopt.risk_models import CovarianceShrinkage
mu = mean_historical_return(df)
S = CovarianceShrinkage(df).ledoit_wolf()
from pypfopt.discrete_allocation import DiscreteAllocation, get_latest_prices
ef = EfficientFrontier(mu, S, weight_bounds=(-1,1))
ef.efficient_return(target_return=0.06, market_neutral=True)
ef.portfolio_performance(verbose=True)

The results:

In [148]:ef.efficient_return(target_return=0.06, market_neutral=True)
Out[148]:
{‘Y’: 0.75648797746825,
‘XLE’: -0.0606854571986156,
‘XLU’: -0.024159556408907153,
‘XLK’: -0.04802174150017669,
‘XLB’: -0.1368722290737997,
‘XLP’: -0.3008639095065781,
‘XLY’: 0.07550913606628665,
‘XLI’: -0.08763541433838248,
‘XLV’: -0.07409396593669107,
‘XLF’: -0.09966483957138589}

ef.portfolio_performance(verbose=True)
Expected annual return: 6.0%
Annual volatility: 7.5%
Sharpe Ratio: 0.53

As you can see this is not difficult: Learn Python!

Hope this help some.

Best,

-Jim

Jim,

I think the volatiliy is a bit high for a market neutral portfolio especially if we are planning to leverage on it.

Regards
James

Yes. I definitely noticed that. Is that the best optimization the program can do with these assets and my constraints? Maybe that explains what we are noticing.

I was using that spreadsheet and program for something else (long only) and it was handy. I went ahead and changed the parameters to market neutral and allowing shorts to see what it did with what you are most interested in.

We probably need to find pairs with better correlation and I assume the course will be helpful for this.

Just thought this might be of some interest.

Best,

Jim

Jim,

One of the constraint of running a successful stat arb strategy is enough leverage.

Do you have any idea how we can obtain leverage of more than 2 times (from margin account)?

Regards
James

James,

No I have never used any leverage.

The only thing I could add is that Yuval had an excellent post where he used some money from a mortgage to invest, I believe.

I did not read the post thoroughly so I may be wrong on the specifics but mortgages are cheap and the general idea is sound, IMHO.

There may be a tax advantage for paying mortgage debt too. My mortgage is paid off and I intend to keep it that way so I have not looked at this but it could be another advantage to Yuval’s method for some people.

-Jim

Jim,

I am actually referring to leveraging on the market neutral portfolio, not generally leveraging on the mortgages.

The way Medallion makes money through its stat arb operations is to leverage on a low volatility (through netting off the risk) which generates a small profit but through thousands of trades.

Regards
James

James,

Right. I have no experience with leverage through brokers. I may be able to help with some of the coding.

-Jim

Some brokers do portfolio margin which allows for higher leverage depending on the risk of your holdings. I believe the ceiling is 6:1 but you need to be well hedged.

Jeff