Tuesday, September 25, 2012

Understanding Factor models and Cone programming

This was a very interesting project we undertook. Not because its result was any enormous value addition but because it helped in grasping concepts and procedures critical to function in practice. It helped in going through the rigorous process of data cleaning and implementing factor models and checking their significance to predict stock returns. Further on we explored optimization using cone programming, which is a special case of interior point methods, to maximize the sharpe ratio and obtain a market beating portfolio.

Here is the Abstract:

The goal of our project is to utilize factor models to explain returns and optimize the Sharpe ratio to create a portfolio that outperforms the S&P 500. After re fining our data we have a universe of 335 stock in which we can invest. We re-balance our portfolio quarterly and incorporate factor models and Sharpe ratio optimization through cone programming to form the portfolio. The rest of the paper is organized as follows: Section 1 is a short introduction of our paper, Section 2 gives a brief idea of the data available and what kind of choices we made to reach the final universe of stocks, Section 3 gives an idea of the general methodology used in the paper, Section 4 describes the results that we have reached, Section 5 presents the significance test we performed, Section 6 presents the results of different sensitivity analysis and Section 7 summarizes the project and gives suggestions for further research.

Investment Allocation using Factor models and Cone programming optimization


Saturday, September 15, 2012

Let's get on the street - Part II

Furthering my experimentation with the real world data, I delved into the minds and psychology of investors. I had taken a course on Behavioral Finance that explains certain irrational phenomena that governs the nature of humans when then invest. This nature has certain shortcomings that are overcome by what has emerged to be known as systematic investing where a computer algorithm makes the decisions rather than a human who can be misguided by emotions.

The following Abstract gives a brief overview of the analysis:

There are many instances when a stock price experiences a sudden jump or a decline and, besides the financial crisis, it has to do with a fundamental change in the business of the stock. Eg. the consumer reaction to netflix's fee structure or a revelation of the revenue reporting mechanism of Groupon or the billions of dollars of trading losses by a bank or the passing of a law that gives huge tax incentives to renewable energy. These events cause almost an immediate reaction by the market reflected by the stock price changes and then as these events are studied in depth and their true impact is understood, the stocks migrate towards their true valuation. The relationship between a surge or a drop and the later migration is something that interacts with human nature and, if understood well, can be leveraged to generate investment idea. In this paper I shall explore such drastic movements and try to understand what their impact is on the stock prices. This is more complicated than it seems because of a change in investors' perceptions after the financial crisis and because of different nature of information dissemination for firms in different segments.

Investing on Behavioral bias

Disclaimer: Please read
Please note that this is my independent work where I have used data from yahoo finance to explore time series concepts from a course I took in statistics. It may inadvertently have an overlap with a work that somebody else has already done and I have no intentions of replicating it. I would be glad to know of any such clash and post a clarification on this post.
I am open to having my work being redistributed or used but only after due credit and a reference has been made. Feel free to contact me to avoid any misunderstandings or if you need more details from this paper.

*The analysis is still underway and the conclusions are under review

Let's get on the street - Part I

Now that I'm in my third semester of my program I've started to apply a few concepts that I learnt in my earlier courses to see if they actually make sense in the real world. It's hard to digest the fact that even doing an "a+b" in the real world is not that easy - acquiring data, ensuring that it is exactly what you want, cleaning it, checking if it makes sense and clipping out those that don't and still be left with enough meaningful numbers  involve a series of massive challenges that only a practitioner would comprehend. And that is exactly why I ventured on this endeavor, to map classroom coaching to real world implementation.

I would have actually wanted to branch off from this blog since it has mostly been about life at Cornell but for now I think I would include all my analysis here until I figure out the best way to split the two different topics. In this post I attempt to implement ARMA time series model on large cap stock returns in an attempt to predict their future returns. It's a first attempt but nevertheless gives an excellent idea about the issues I described above and if the time series concepts work by a brute force methodology.

ARMA model for large cap stocks returns

Disclaimer: Please read
Please note that this is my independent work where I have used data from yahoo finance to explore time series concepts from a course I took in statistics. It may inadvertently have an overlap with a work that somebody else has already done and I have no intentions of replicating it. I would be glad to know of any such clash and post a clarification on this post.
I am open to having my work being redistributed or used but only after due credit and a reference has been made. Feel free to contact me to avoid any misunderstandings or if you need more details from this paper.


Friday, August 31, 2012

Welcome NYC

So after a remarkably memorable stay in the small town of Ithaca it was time to leave the confines of the walls that Mr. Ezra had originally intended all of us to stay in. The idea was that away from all the city congestion and distractions students will get a chance to mingle among themselves in an academic setting that would help foster an enriching learning environment. I guess he did not conceive of this stream of Financial Engineering that inevitably brought Cornell closer to NYC until 2007 when a small part actually branched off and landed on wall street.
Now I wasn't going to begin studying anytime soon and if fate had it's way I might not have even been here so early but here I was, for my internship. I have been a city boy all my life. I grew up in Delhi, India, studied in Mumbai and lived in Bangalore. All these megacenters are one of the most populous cities in India and with an ever increasing immigration population and the progressing boundaries the population density doesn't seem to stabilize.They are home to people either scrambling to get onto that bus to reach their workplace, to catch that last spot on the train trying to make an errand or just to people that exist trying to make your life more complex! But in return, to serve the entire array of different classes of people from different backgrounds and tastes, you get a host of amenities that sometimes seem customized to your need. Be it a restaurant that serves your favorite entre, a pub that plays just your music, a coffee shop that blends to your taste or even a  tailor that stitches to your body.
BUT... all this comes when are in a state to really enjoy what they have to offer. And you certainly cannot be in that state of mind when you are in no man's land and trying to find a place to crash for the night. Home. I have looked for a place twice back home and once here in Ithaca, NY. In each instance I took the time (I would now say I had the luxury of time) to look at a few apartments, weigh them based on different criteria and then decide on the one that passes all the screening. Now this process typically took me a week or two and I was fortunate enough to have my cousin living in the heart of the city where I could crash for that time while I looked at other listings. So I log onto craigslist and try to rank the listings based on the location, distance, furnishings, utilities and my understanding of the safety and fun of the neighborhood. My office was at Grand Central and my next term was to be in downtown. To avoid being sucked into Manhattan's expenses and at the same time have a clean, fun and safe neighborhood I chose Astoria in Queens. It was the end of May and the search threw numerous results of places being available in a couple of weeks for the summer. Even after filtering for what clearly was spam there seemed to be a good number of listings checking which could keep me occupied for a few days.
So, being the diligent person I am, I jotted a few places and mapped my route and headed off. Now what you hear or see about a place can be quite different from what you witness with your own eyes, or in my case, ear. My first stop was north east of Williamsburg and I was pleasantly surprised to see the train ride on an elevated platform. But that soon turned into a blare as I stepped out and it was further disappointing to know that the listing was right around the corner and the noise of the train would deem an alarm unnecessary. Next I took the 7 back to take the N/Q and go into Astoria. The same problem persisted though the area was quite widespread and open to take away that claustrophobic feeling of elevated tracks and the blaring sound. They were all 2 storey row houses with a shop on the 1st floor and along with the curbside restaurants and clean streets it gave the town a pre-modern European look. It seemed like a giant chopper had chopped off all Manhattan sky scrapers from 3rd floor up but then you could still see the city across the river. It was a love at first sight and I knew I was going to live in that neighborhood.
Unfortunately I was still not familiarized with how "big" the rooms really are when they say that on craigslist. My first destination was at a place where 3 men, each over 40, resided. The room was as big as the size of a store room, the living room finished before it even started and the kitchen cabinets were locked because no one cooked. As if that wasn't enough the guy listed all the rules of the house as minute as cleaning the floor and I never thought about that place after that. This way I rejected a few other houses of the day and the next morning I was really considering taking up the first place I saw. When I called up to check I was surprised to know that it was taken up already. That got me on my foot and I started carrying my cheque book along to be able to sign off a place as soon as I saw it.
I was glad to have the assistance of a smart phone all this while. I could always check craigslist for any new sublets and I had that page with my search filter always open. I spent the next week looking over each sublet listing and each time something prevented me from committing to it at that very instant. One was perfect but was available only for 2 months. Another was well furnished but was too far from the closest subway. Then another was also very well furnished but it turned out to be a home to a 50 yr old and his dog and I used to curse them for not being clear about such descriptions on craigslist. The ones that had a good location were either too small or were in a dingy apt or were unfurnished. After about a week I became quite stressed of the situation and restless of living out of a suitcase. I expanded my search to downtown and brooklyn as well thinking that it would be better in the long run when my term begins in the fall on wall street. With the constraint on my budget I could only find apts in Chinatown that appeared like sleazy makeshift dorms that could break away any time or others in brooklyn with so much mess that my trash can seemed cleaner.
Finally I struck gold one day with an apt in Jackson Heights that was well connected by an express train, was in a nice neighborhood and had a big and well furnished room and that too for just $600. I immediately contacted the person and was there in 30 mins - a good test to measure the daily commute time I was going to have. I had been tired the past few weeks and being the middle of June the listings were thinning out and I was really hoping for this to work out. When I reached it turned out that the guy was living with his mother and they had had an Indian tenant before so we struck very well and we all had a good conversation for over an hour. We both liked each other and they began typing the sublet contract and I took out my cheque book. I had been warned to verify the credentials before entering any transaction and so I asked to check their papers and showed them my id, etc. Somehow that sort of upset the lady and she started having second thoughts. Now, I wasn't too impressed with the rest of the apt or its distance as well but I really liked the room and already under pressure I wanted to sign it off. So I tried to work it out well enough and left assured that the guy will be able to convince her mom.
Hardly did I know that it was a blessing in disguise for the next day, while I was holding on to them and still trying to find a better place, I struck gold again and this time I really felt that it was the one! Within 40 minutes of the ad I was in the apartment to check it out. Hardwood floors, big enough and furnished with bed, sofa, tv, desk, chair and AC, two large windows, well stocked kitchen and an orderly living room with a 52" screen and psII. I was all over and when I actually handed an advance cheque and got the receipt I could feel a heavy weight suddenly off my head.
I moved in about a week later and I would say that I love the neighborhood and this house was definitely worth the wait.

PS: A word of advice - when looking for apts in NYC be ready to commit on the spot, especially when its a sublet. The market is very rapid and dynamic and it pays to be a bit flexible and strike a place as it comes.

Saturday, June 16, 2012

Good Bye Ithaca

And so it was, the end of an era. Though too short to call it so, it was packed with enough substance to qualify as one. The thrill of the ending of examinations transforming into a deep sinking sickness over a period of few days had a tumultuous ride. The weekend after was quite relaxing although my mind was occupied with devising the exit plan, exit from Ithaca. But before I did that, the next few days were going to be really amazing, sort of a flash back of the last 9 months coz my family was going to pay me a visit.

I picked them up from Buffalo and before our departure we made an impromptu visit to the Niagra Falls. I had been to the falls last during my internship in Toronto and so it was from the Canadian side and it was with those memories that I was looking forward to the visit. I remember the liveliness that engulfed the region defined by curb-side restaurants, kids' attractions, junk and souvenir shops, ice creams, sweet balls, hot dogs and children running in the huge gardens amidst families picnicking and people walking their pets. All this was nowhere to be seen on the US side that consisted of just a small mall that showcased a disappointing collection of cuisines and a sort of dull garden. Nevertheless as the area opened into the falls the whole mood switched.
I had rode on the Maid of the Mist last when I was 12 and though I couldn't conjure it as something exciting it indeed was a pleasant experience to go right till the foot of the falls and witness the enormous rage.
We had got a bit late on our way back and I must say that driving in the countryside at night had its own share of fun and fear. Notable was the moment when I turned off ALL the lights in and out of the car that felt as if we were tearing through darkness in the middle of nowhere!

When back to Ithaca I gave a "crash course" to my family in 3 days of what I knew about the town in 9 months. We first went to Cayuga lake and although I had thought of buying food there it struck me to pick up something from the Hot Truck that we passed while taking a tour of the North Campus. It skipped my mind that Cornell ran Ithaca and with the end of the semester it wasn't just Cornell that took a break but many businesses cut down their hours, including the places by the lake. Thankfully we had food and we got a nice place and I cannot describe the eternal peace of mind I felt while eating besides the placid lake and nice bollywood tracks playing from the phone. We then went for a walk at the Taughannock falls and then on the way back stopped at a vineyard a number of which span the surroundings of Ithaca.
The next day was fixed for a tour of the University, by foot! I had given a glimpse of what the daily walk towards the campus looked like and it was time to experience it first hand. A lunch buffet at Mehak was hence tactically planned right after the first leg of slope. I should take a brief moment to point the transition lately from Sangam to Mehak as we rediscovered the delicacies it offered at the same price. Maybe we appreciated the change or maybe Mehak did bring about an improved change in its cuisine but we had been frequenting Mehak about weekly during the last month and never got tired of any monotonicity. After relishing the sumptuous meal we scurried off to make it through the time window for which the clock tower is open, to get a splendid view of the entire town. Then we went in a few buildings where my parents appreciated the disparity between the modern facilities that a top Indian university provides and here. The concept of "break out" rooms for student groups to study took them by surprise as even I remember that IIT didn't come equipped with any such provisions. After enacting a few lectures and trapping those moments on film we went back home to dress up for a dinner at one of those curb-seating restaurants in downtown. Honestly it was the second time I went for fine dining at a curbside place in Ithaca and it was really refreshing. After fully loading ourselves we strolled around the Commons and then went back home.

The next day was relaxing and consisted of packing all the stuff and I must say that it was really hard to assimilate all the items that I had piled over the course of two semesters and organize them to be able to discard most of it. More than the physical effort, each item brought with it a different memory and it was tough to throw it away and erase its existence. It felt like the whole life that I had built throughout this time was falling apart and it was unsettling to think of all that I wanted to but couldn't accomplish in this "golden period". I had met some amazing people during this time and although we would stay in touch there was an uneasy feeling of the connections breaking away and our lives transforming to the next phase. I still had one more semester to go but as I imagined and realized it would be a whole new story and no where the same. Nevertheless what had to be done had to be and I am glad I had my family to sail with during this time. As I packed all the belongings and stripped my room to its original state my first week here flashed before me and  all the fun/hard/pleasant/anxious/excited/drunk/hot/cold/loud/crowded and amazing times crossed my mind. All good things do come to an end! Next stop - NYC.


Saturday, May 5, 2012

Slope Day

Throngs of college students spread over the entire libe slope shaking to the tunes of three different genres unleashed via an array of JBL speakers and woofers creating a thumping atmosphere - that was just one aspect of the Slope Day 2012.
An annual spectacular to mark the last day of classes, slope day is the traditional event when students from all departments and batches unite for a single common cause - letting it loose! It is amazing how the managers were able to pull out the event given the fact that we had a hailstorm just the previous night that stripped the town off power for an hour. The prevalent rains and stormy weather would have dampened the spirits of many while the coordinators were at work erecting the fences through the night, their optimism providing the courage. And it seems, fortunately, the weather Gods gave way to the hopes of thousands by setting up a beautiful backdrop with the perfect weather - a cloudy sky with light sun!
I arrived for the event pretty early right after my lab (yes I had a lab!) at noon. We entered from Ho Plaza and the liveliness in the atmosphere set the tunes for an exhilarating evening ahead. There were food stalls offering cup cakes, sweet donuts, drinks for light refreshments and then down the slope were more food stalls for proper meals. But of course the crowd had piled up into a single line that led to the alcohol section. And I must say how well the entire crowd was managed.
Having come from the institute that hosts Asia's largest cultural festival the meticulous planning that was apparent in the Slope day was praiseworthy. There were numerous volunteers spread across the entire arena with backpacks filled with water bottles handing them generously to anybody who could use a sip. Then there were others carrying plastic bags and wearing tags indicating what would go in those bags - compost, trash, recyclable, plastic, etc. Also on site was Ithaca police well equipped with the gear to tackle any situation. And this was very well tested when a minor scuffle broke up between two students when they had to interfere and there radios came in handy to call for additional help. There was another section for first-aid with doctors and ambulance ready in case of any emergency. Apart from the readiness in terms of man power the entire process that required regulation like adherence to queues, purchase of food and alcohol tickets was done in an orderly and fool proof manner such that it could not be replicated or abused. Quite impressive!

The highlight of the evening were the concerts - The Wailers, Neon Trees and Taio Cruz. I went right upto the stage for the last two and I could tell that it had been a long time since my ear drums had vibrated with such a high amplitude! A few minutes into the crowd it was impossible to hear anybody around except for the unanimous clamor that followed the song. As cliche as it might sound - I was completely immersed in the sound waves and was flowing with the beats. Has it been long since I went to a concert! To add to the excitement and the frenzy the volunteers had been sprinkling water at the crowd and the crowd supplemented by sprinkling from their own bottles. With that, the mud from the ground began taking friction away and there is where I guess it got it's name from - Slip, I mean Slope, Day! To give the perfect ending to the day was "Dynamite" from Taio Cruz and I got goosebumps witnessing the exuberance in the air.

All in all the pleasant weather, the charged up atmosphere and the high spirits of thousands of students added up to bring a memorable end to the first year of graduate studies at Cornell.

PS: Photos courtesy Cornell University @ Facebook.

Wednesday, April 4, 2012

What is the problem with Greece?

This has been a topic at the helm of global finance that has taken all the markets on a roller coaster ride since the past year. Here I attempt to discuss some of the issues, the causes and the steps taken to avert a crisis as a result of its ballooning debt to GDP.

Why is Greece close to defaulting on its sovereign debt (government bonds)? Why cannot Greece use the monetary policy tools that traditionally states used to ease their debt burden, and what are some of these tools?

Even before the time they entered the EU, Greece has been on a spending spree on infrastructure, services and public sector wages. As Greeks reduced their tax payments, the vast gap between government income and expenditures was filled in by borrowing billions of dollars from other banks and nations. This enormous public deficit was exposed post the 2008 banking crisis and currently, with a 160% debt to GDP ratio, Greece is nowhere near able to pay off its debt. With the downgrade of Greek bonds to junk status no one is also willing to lend Greece and being on primary deficit it is further unable to meet its expenses without external monetary support.

Some of the monetary tools that governments use in such a situation are devaluation of currency, increasing the interest rates, controlling reserve requirements or printing new currency. Greece had been deploying many of these tools before its integration into the Euro. However, under the Maastricht criteria applicable to all EU members, all the EU states need to keep their inflation rates within stipulated limits and need to have a control over their government deficit and debt. In addition they need to follow the exchange rate mechanism under European Monetary System (EMS) and also need to keep a check on their long term interest rates. Since Greece is a part of the Euro it does not have enough flexibility with these policies to be able to come out of its debt crisis.

http://www.telegraph.co.uk/finance/financialcrisis/9098559/Whats-the-Greek-debt-crisis-all-about.html

http://en.wikipedia.org/wiki/Maastricht_Treaty

The Greek economy is small relative to the economy of other states in the EU – why would a Greek default significantly impact (i) the economy of other EU states; (ii) the stability of the Eurozone; (iii) the world economy?

Even though Greece has a relatively small economy, a Greek default can lead to a contagion the effect of which will be felt throughout the EU and also the world at large. It would send the yields on Portuguese, Irish and Italian bonds spiraling upwards and Portugal might have an incentive of defaulting as well. Subsequently the confidence in these countries will drop leading to a bank run and a severe credit crunch and EU will need to provide capital to the banking system for which there would be no collateral.

Such events would lead investors, and the world, to lose confidence in EU and hence growth can be hampered in the near future which can also lead to a drop in the euro. With the global financial system just out of a financial crisis, this contagion will be akin to rubbing salt on the wound that hasn’t even begun to heal yet and it would probably put Europe in a recession and would stall short term growth throughout the world.


Great efforts are expended to restructure the Greek debt so that it does not trigger CDSs written on Greek bonds. Who holds these CDSs?

The net value of CDS written on Greek debt is small as compared to the total debt. For instance, with a $300 billion of restructuring and $100 billion of wipeout, the outstanding CDS contracts net just about $3.2 billion ($70 billion overall).

These CDS are held by private entities that have invested in Greek debt over the years. Although this information is not publicly available, it is known that major European banks such as DB and BNP Paribas as well as some American banks such as JP Morgan, Citibank and Goldman Sachs hold Greek debt and have hedged it with CDS.


Recognizing that the situation evolves from day to day, what are the arrangements related to the Greek debt restructuring that are contemplated currently?

Of course Greece defaulted for non payment of the dues it owed on 20th March. Thankfully, to my utter surprise, it failed to shake the markets in a way I had imagined leaving it with just a nudge, maybe that was also the market's volatility itself. However, to ensure that financial markets are now immune to the fate of Greece a series of hard steps were taken and accepted, in some cases against the will of many. Here I lay down those steps and their magnitude.

There have already been four rounds of austerity packages involving about 100bn Euros in loan and a round of austerity measures being implemented by the government. Currently the Greece creditors have agreed to a 53% haircut on the Greece debt and EU has raised about $172 billion for support the remaining debt of Greece. Debt swap for coupon bonds (50% of face value as compared to original) have been initiated with a coupon of 3.7% bringing the total voluntary write-down to around 70%. Although it seems that even this huge bailout will not be enough and ECB reckons that Greece would need another 254bn Euro to meet its targets.

Under the terms of this bailout Greece is required to undergo reforms aimed at reducing its debt to 120% of GDP by 2020 from 170% currently. These include severe austerity measures as well as a 22% wage cut across the working population and a 35% for those under 25.

But this bailout has quite some risk associated to it especially because of the elections that are about to take place in Greece in April. The debt restructuring package is extremely demanding on the citizens and it is not surprise that there have been widespread demonstrations, sometimes violent, against it. This can be a crucial campaign agenda for politicians who can promise a renegotiation of the terms which casts uncertainty over Greek default. On the other hand the deal has been struck with the private sector representative, the IIF and needs the support of each of the private debt holder to go through which is a major process in itself. Now this debt restructuring has been accepted by a higher majority of the private creditors as against the alternative of losing their entire investment and face the ugly process of recovery from a default.

http://blogs.wsj.com/marketbeat/2012/02/07/whats-the-latest-on-greece/?KEYWORDS=greece+default

http://online.wsj.com/video/is-europe-preparing-for-a-greek-default/7ACA93BF-474E-4DCF-A9DE-248567E1E152.html

http://online.wsj.com/video/where-next-for-greece/DE35FF36-8253-4E67-90B8-637E849D7F7F.html

http://dealbook.nytimes.com/2012/02/21/greek-crisis-raises-new-fears-over-credit-default-swaps/

http://news.goldseek.com/UnionSecurities/1328198400.php