Wednesday, March 16, 2016

Installing Python 3.3





So there are two ways of installing python such that the nice Mathematica-like iPython notebook environment works. In the above, it's hardcore console. Here's a related blogpost. Here's a better one. For me I installed Python 2.7 on an older Mac.

I needed to say "pip install ipython[all]" instead of what's in the video.



Then running "ipython notebook" worked. You also need to "pip install" numpy, pandas etc.



Alternatively, and avoiding console for the most part, one may go to Anaconda website. There they have a file you can download for consoleless installation. Ideally "ipython notebook" console command then just gives you what you want.

Wednesday, March 9, 2016

The Big Short, and loans in the modern day

The movie shows how knowing that something for sure is gonna happen, big money players can negotiate instruments that allow them to make much bigger returns than what one would expect. Let's see. Naively, if you know that the price is going to go down or up 5%, you can make 5% returns. If you find a way to borrow money at a rate <5% of interest payments for that period of time, then you can increase your returns. The typical rate for a trustworthy borrower is 5,69% per year. If you know about 5% price move that's gonna happen over 1/2 a year, then you should borrow as much money as they are willing to lend you and get roughly 4% of that after all. Unfortunately, there's not so many places you can borrow big sums of money for stock market purposes. Maybe it changes when you have a lot of money already, and some legal status, Idk. But in essence, one would not expect that a hedge fund can borrow much more money than what investors already gave to it, or else it would do it all the time. So naively you expect that your returns will still be of order 5% of what your investors gave you, even if you are a hedge fund.

But there are plenty of financial instruments that circumvent it, most of which are not available to simple people. One thing would be leverage. As far as I understand, hedge fund can make an agreement with a broker about investing money 1:20 into this opportunity. Then, if the actual price reaches -5% at any point in that 1/2 a year, hedge fund loses everything. But if it actually goes +5% as expected, hedge fund doubles the money, getting +100% out of known 5% change of a given instrument. Another way of thinking about it: hedge fund finds a person who is willing to make a bet on all this money that the price is not gonna go move 5% that direction.


Christian Bale plays Michael Burry in ‘The Big Short.’
 
PARAMOUNT PICTURES


So when one of the main characters (played by Christian Bale?) was drawing numbers on the board: first -119% when the price did something unexpected, but then +440% when it went the way he expected, this is essentially what was happening. The housing prices dropped, say by 60%, after rising by 30%, counting from the moment he shorted the housing market. His bare returns are +30%. If he used the leverage instrument, he needed 1:14 to get his 440%. So he could only afford prices going up by 1/14, or 8%. If they went 9%, he'd lose everything. How could he afford 30% rise on his leveraged short position? And still be only in -119%, not in -440% as the symmetry would suggest?

First of all, he did not put all of his fund's money into shorting the housing market. But that doesn't help: to have 440% returns, he needed to have -440% loss when the price went the opposite direction. Which would bust him. The resolution is that, first, even though the housing market that we see was down by 60%, he shorted some more extreme instruments that were down by almost 100%. Second, to short them, he used Credit Default Swaps, that has been around for decades, just that nobody thought of using them on a housing market.

It is good to note that he made his decision to trade based only only the publicly available information. Using insider's information about upcoming price motions to make money is something you can go to jail for.

Another concept that movie covers are CDO's: a packs of loans that are offered by a bank to investors to provide money for. The movie drives the point home that anyone who was working in the bank on getting those CDO's approved and sold insurance on them was acting completely irresponsible and should go to jail (although almost noone did).

Much blamed CDO's still exist, although in a heavily regulated fashion. Banks still don't do a proper investigation of individual borrowers. However there are web-based platforms Lending club and Prosper that do the bank's job of connecting capital and borrowers without "black boxing" where the money goes. Careful investors can review every single loan app. For big investors, there's even a startup Theorem LP, that's a third party optimization/machine learning that helps quickly scan all the loan requests for reliable ones. They managed to double the return of a naive investment.

Their fees are twofold: there's a 1% fee for putting money into account, and standard hedge fund 10% fee on profits. The minimum account value is 1M$. So essentially what this company is doing is what big banks failed to do during the 2008: carefully review each loan application. It also claims to sometimes provide liquidity to those who want to withdraw (option not available to regular investors on Lending Club), and identify recession years and be even more stringent in the screening during those years. The defaults usually lag 0.5 years behind the economy collapse. Here's a neat data visualization by Bloomberg.

Tuesday, March 1, 2016

Money isn't everything

Once you familiarize yourself with the stock market, it's easy to get caught up in making money frenzy. You won't make too much  - roughly 1% of your current wealth per month is what you can realistically expect. And for most people, they are either in debt, living from a paycheck to paycheck, or having net available wealth of roughly 10 times their monthly salary. So if you do the math, investment gives you only 10% of what your daily job gives you. It's only natural that you commit only 10% of your time to it, not all day every day.

One may argue that if you get really good at it, you can attract other people's money. If you go to a hedge fund - that's exactly what happens, and you are paid relatively big salary. But not everybody would want to have finance as their daily job. There are much better things to do in life. Outside hedge fund, as an independent investor, there's really not many legal ways to manage other people's money. Your uncle can give you 100k$ informally. There are trading competitions online, where you can get to manage up to 1M$ if you win. The conditions are usually that the investment manager gets 10% from the profits. At 1% per month the profits from 1M$ are about 10k$, so you get 1k$ per month - not a salary, but best of what's available. Still doesn't justify spending more than 10% of your time on it. If you are educated enough to invest correctly, you are probably educated enough for one of those manager or software engineer jobs that pays 10 times more. If you want them, that is.

But even if the activity gave you all the money you need, money isn't everything. For what we want to do, usually bottleneck isn't money. Money can be loaned in the worst case. There are other resources that are often a bottleneck: connections, education, achievments on your cv, status, fame, friends and family, relationships, health, and last but not least - time. Managing those resources is somewhat harder that speculating on the stock market. For one thing, they are pretty much illiquid - you cannot exchange them or request them instantly. There are some that come close liquidity, as I will attempt to list below. For another thing, if with money the utility function is clear as a day: more is better, with other things there may not be a single utility function to optimize. Finally, the US society is incredibly focused on independence, providing for yourself. But many of the non-money resources only become available if you let go of that notion that you're optimizing them for yourself alone, and collaborate with other people.

Let's go over a few examples.

  • Education. Oftentimes you find a job you want but don't have a diploma that qualifies for it, or for that matter, the skills. You can easily get a loan and waste another 4 years of your life studying in a college. If you can do it without a loan, you probably should at least once in your life. (again, issues with utility function. Teenagers are incredibly susceptible to feeling included/excluded of whatever everybody else is doing. It is not clear if those feeling persist to adult age in people who did not go for college) A bit more optimal solution is to be self-taught - it only takes about a year of your time and ideally doesn't cost you anything with tons of free resources available. However, it only works for people who already know what they want, and most of the college kids don't, which kind of justifies colleges. Also, there's an extra cost that you now need to prove that you know your stuff every time, instead of just having your diploma speak for you. Are there any other solutions? So far, we only considered purchases of resource "Education" from the standard system. Can one loan education without actually giving the cost? Can a person trade their education for something else? Those are the right questions to ask. The opportunities to circumvent the standard cost usually come with a lot of money. You can hire full-time a person who has this education to do what you wanted to do but needed education. Similarly, a person getting a job is essentially trading his education (and time) for money. So there is certain liquidity for resource called "Education". But it's nowhere near one click of the button liquidity that is available for stocks on the stock market. In a sense, internet can be a way to get educated people to do things for you just one click of the button away. But it probably will cost you again. When I'm talking about "Education" resource, I mean not only the skills to do things, but also the fact that those skills open certain doors in our society. You job choices, salary and locations will strongly depend on what it says under "Education" in your cv. That effect seems to be not liquid at all. It's much like our second example - immigration status:
  • Your job opportunities are severely cut by the immigration status. It takes time and paperwork to have a proper one, and many companies just don't want to bother. So your ability to settle down in certain countries at certain times of your life very much depends on this completely illiquid resource "Im. status". The only way to loan or trade immigration status is to marry someone. Otherwise, it's just one other thing like Education that you either have or not, either get the benefits or not, and you can't easily get those benefits within legal bounds.
  • Social resources like connections, friends and family, relationships are liquid only for people who are good at it. You can let someone else benefit from your social connections as much as you do. However it's typically not done as a transaction, more as a favor, so it's unavailable 90% of times when you actually need it. There may be some markets for the above, but they are all very controversial if it's click-of-a-button. To do it more traditional way, one is expected to invest a lot of time, and the only way to save time on this is to have a lot of money and hire a secretary.
  • Health and time are resources that are given in only limited quantity, and "activated" by money. Time can be purchased by hiring other people, if you want to do something productive with it. If you just want to have fun, you only get 24 hours in a day and that's it. Health can be a huge money dump, and also some people just don't have it. To keep oneself in good health takes time and effort. Some parts of our body are replaceable, but the markets for them are heavily contrained by the law.
By describing the obvious things in life in this kind of structure, we may outline a model for life. Then we can proceed to "solve life". That is, come up with objective function and optimize it given the constraints. This is essentially what we do every day, but sometimes we are pretty bad at it. Because it's a hard problem, and the only data we have is just lives of a few people we know plus our personal experience. Any datasets collected by facebook etc. are too noisy and miss the whole point.

But one can start working in that direction, formulate relevant questions, even if not all of them can be answered at this point.