Importing Historical Price Data Into iPython From Quandl

In this file, I show how to pull Quandl data into Python notebooks without downloading the files on our own systems. The iPython notebook & HTML version of the files are available to download. I recommend that you get Anaconda as it also has a whole host of other features and programmes that make using Python & R easier.

Download links:

  1. Python HTML  File.
  2. Python Jupyter  Notebook.
  3. R HTML File.
  4. R Jupyter Notebook.

As always, for any feedback, contact “me“.

The Word Is Not The Meaning

“We interpret words to mean something that will be convenient or suitable to us, or interpret them according to a certain tradition.”

Jiddu Krishnamurti

Imagine you are thirsty and asked your Mother for some water. Now instead of handing you a glass of water, you get a lecture on what the chemical composition of water is, the different types of water (say mineral or spring) and how it takes various forms like steam or ice for half an hour instead of the drink. Merely understanding the term “water” is not going to satiate your thirst.

To paraphrase Winston Churchill, words are the worst form of communication till we have tried all others. As we explore in “Whose Reality Is It Anyway?”, we all see life from a different perspective and add meaning or draw inference from events differently. A good event for one could be a bad event for another.

Now let us try a thought experiment to understand this better:

What colors are the boxes below?

You’d say that the boxes are orange and pink respectively.

Now imagine that a child is thought that the color on the left is pink and the color on the right is called orange. As he grows up, he remains unaware of this till one fine day, the teacher asks him to name the colors. The child gets it “wrong”. He is regurgitating what is taught to him and it turns out that what is thought to him is “inaccurate”.

Now you can imagine what the child goes through in this situation here. I am guessing bewilderment, and perhaps anger and mistrust at his parents.

The point is that even for some of the most widely used words, each one of us may hold different meanings of the same word. Add to this the complexities in understanding tonality, body language and the evolution of language itself where some words disappear from common use and some words find their way into daily use.

Now imagine someone who thinks in a different language altogether. The ideas may be lost in translation as a complete transfer of meaning is difficult between two languages.

So the next time when you speak or write something, you might want to make it as lucid as possible and define every term as clearly as possible. This may help you and your associates to communicate well.

And when it comes to reading or listening, practise dropping all your preconceptions and you can discover the very essence the writer or speaker is conveying.

Choosing Death & Life

“Fate leads the willing and drags along the reluctant.”


As the clock strikes 12 and another year passes by, we wake up to the potential of new beginnings that we had been putting off! Say hitting the gym, finishing an article, learning a new skill, losing some weight, making more friends and NOT wasting more time doing useless stuff.

The past few months for me have been a journey in self discovery. From recurring situations that I kept finding myself in to a few blunders I would always commit regardless of what I did, a lot of life that was nonsense started making sense.

In 2017 I made a few choices that some might consider questionable or risky, but here I am.

The most radical part of 2017 however was the journey I took inside. Understanding yourself is a hard job, and one that you may perceive to be painful as well. But trust me, it is worth it.

A few things that were shocking as I dwelled inside are:

  1. I do not listen.- I did not listen to people, whether it be family or friends or strangers or anyone. I was in a hurry to impose my point on the other person because I had to be right.
  2. I like doing the opposite because it is the opposite.- I used to be proud of my abilities to spot short sell opportunities in a rising market. I would brag about it, because in my head, I could claim some sort of intellectual superiority. I would actively avoid looking for profitable trades on the long side, because I had to be short and brag about it.
  3. I was comfortable being average.- A common statement on my report card back till the 8th grade was “A lot of potential, could do better”. I perhaps took that to heart and my life till now somewhat reflects that. I could be doing much better, and I did let a few people down, people who had faith in me.

And the above is simply the tip of the iceberg. There were a million such programs running inside me, each with a different agenda, each well meaning in its own right, and yet conflicting amongst each other, landing me in soups.

Such insights require absolute willingness to change with some faith. I looked for answers in despair, but being preemptive could help you turn your life around, before you enter the despair stage. (Highly recommended).

Either way you take, there is one step that you’d take on the path and that is one choice that would seem hard, but it was the best decision I’ve taken. Choose to die.

I do not mean death in a physical manner, but every belief, thought, memory and expectation, let them all go. Whether it be the dream of becoming a market wizard or the fairy tale romance you thought you had. Let it all go.

Does it mean renouncing the world and becoming a saint? If that is what the path leads you to, then that is your path. You’d be guided.

Understand this, you cannot force yourself to change with “I will & I must”. That creates resistance that you will rarely be able to overcome. That is why you stop going to the gym after a month and guitars lie unused.

Answers to all issues come from absolute silence of the mind, whether it be a creative endeavour or a problem that needs solving. Cultivate radical responsibility, that is understand that whether an incident be good or bad, realise that it could not have happened to you without you accepting it on some level.

How do you begin? Well I had something about it previously, but the gist is-take some issue in your life that is recurring, ask yourself, with all genuineness you can muster “Why?”, silence the mind and wait for the answer.

As you overcome these issues, you realise that every moment in itself is fresh, every moment is 11:59 PM on 31 December 20XX and you will be just as enthused. Try it!

The Scariest Thing You’ll Ever Do

“The goal of life is to make your heartbeat match the beat of the universe, to match your nature with Nature.”

Joseph Campbell

The irony of life is that the spark of hope comes aflame only in the depths of despair. Life has a funny way of teaching us. The lessons we most avoid end up running & many a times ruining us if we fail to learn them.

For some time, there has been a nagging feeling of being cut off from the world. Like I was an insignificant speck of dust in this giant cosmos. After all, even with an age span of 80, all of us are here for less than a few milliseconds of the planet. A few years from now, you’d be dead, gone and forgotten. I mean how many of us actually care about our Great-Great Grandparents?

Maybe a car crash, a meteorite or even a neighbour going nuclear could end my life in the fraction of a second. Logically, even if the aforementioned 3 events do not happen, I do depart, like we all do. So am I an insignificant little bug in the system to be crushed on the whim of my creator?

Till we do not face our own mortality, we cling to stuff, people, indulge in self-destructive behaviour, be riddled with guilt and confusion, act against our own interests and what-not.

Shakespeare once remarked that we are all actors on a stage, so in the context of life, is my role set? Is there actually free will or am I just a character who has an illusion of free will, whose script is decided? Or am I equal parts writer & actor and I do have a choice?

Earlier, I’d have written the whole thing off, but at 3 AM, when you wake up asking yourself the meaning of it all, you ask. You ask your heart out because nothing makes sense. Life & the whole world seems impractical & pointless.

And then if you are ready, would an answer come, and the answer is so different from what you expect, that the world you do see does turn out to be fake. Reality is quite different. Your own perception is a crazy beast.

Now, I feel like we are all a part of a giant jigsaw puzzle, where each piece is constantly changing and dynamic. The absence of one piece (namely You) can actually affect all the pieces, and throw the very cosmos out of order.

The Advaita Vedanta teaches us that we are all connected, beyond bodies and beyond our differences of age, gender, color and anything else. And that is the “Source” that the Bhagavad Gita talks about.

So what is the scariest thing you will actually do? (And I recommend you do it everyday.)

In your heart, tell yourself with all sincerity that “I do not know what my purpose is. I have no idea what the world is for. I’d like to know.

Wait for an answer, you’d be drawn to it. And then whether you go seek a Guru, pick up the Bhagvad Gita or the Upanishads or start Yoga, I do not know, but let the Big Guy take over.

Why do I urge you to do this? Simply because you’d avoid the despair! And you will change, for the better.

Good Luck!

Bulls, Bears And Other Beasts

The book is a fictionalised account of a stock trader & operator who began his journey in in 1988 and hung up his boots after the BJP win of 2014.

The central character, aptly named “Lala” began his journey as a “jobber” or what we now call Market Maker and we follow his journey in the Indian markets. From beginning his Market journey in the back office of a small time broker to trading in the “ring”, Lala meets all the famous characters in the Indian market, from Harshad Mehta to Ketan Parekh to Radhakishan Damani to Rakesh Jhunjhunwala.

We see how Lala goes from being a small time trader/jobber to an “operator” approached by company managements to manage prices & a quasi fund manager.Along the way we see how the Bombay Stock Exchange was challenged and overthrown by the NSE, and we see an encounter with the legendary Manu Manek, whose respect Lala eventually earned. An interesting part was when Manmohan Singh was heckled by Brokers when he visited the BSE as a Finance Minister.

Filled with anecdotes and market gyan, this book is the Indian version of Reminiscences of a Stock Operator.

Personally, this book has a connect because of its setting & era. My father was a sub-broker and we had an office very near the exchange. As a child, I have very vague memories of going to the little office we had in Cama building, and anyone I look up to in the market is mentioned here.

So is it worth a read? YES! Especially immediately after Reminiscences of a Stock Operator!

Grab it from

The Difference Between Work & “Work”

Say you have a regular 9 to 5 job. You punch in, punch out and you get paid for days you were in the office, even though the work you do may be variable based on the season and time of the year. Many accountants & auditors get busy during the tax season but have a smooth sailing for a few months after. Similarly many (especially Indian) IT companies have employees on the “bench” . Say you are paid Rs.1,00,000 a month but the work you do perform varies.

And let us plot the same on a chart:

Here you exchange time for money, even though the amount of time you work may vary on a month to month basis. You can spend a month doing absolutely nothing and spend another month doing 3 months worth of work in a month.

Now we take a look at someone who has to work a lot during the initial stages without a fixed pay for the potential of a greater reward, say an author writing a book or a movie maker who would take 6 months to put the movie out there.

Take the case of the movie maker, he/she works with a great outflow in the first 6 months but based on his own calculation, expects a hefty payout. Again let us put in some numbers and plot them to make it simpler.

And here is the chart:

So even of things do not pan out, the movie maker knows what he loses, whereas the potential gain is theoretically all the money in the world.

When we put the two scenarios in context, in the former case, the payout is fixed, whereas the workload is variable. In case of the latter, the payout is uncertain, whereas the maximum loss the movie maker would bear is Rs.8,65,000.

So while working 9 to 5 is easy and somewhat guarantees a regular paycheque, “working”, while not guaranteeing a paycheque, does have a great payoff.

|Choose wisely!|

P.S: Interesting to note is that most employers believe that employees are underworked whereas most employees believe that they are overworked. That I believe depends on which version of reality is seen & by whom.


Whose Reality Is It Anyway?

“Let’s get real” or “Face reality as it is” or “The truth is bitter” are common dialogues we hear. But what is reality?

Is reality relative? Is reality different from person to person? Let us take the example of financial markets. We assume that both the buyer and seller of a security are rational and aware of the facts. Yet why does one person sell and another buy? Afterall one person has to be wrong. Both buyer and seller cannot be winners.

Now, let us shift to something a lot more prevalent. Take football (or any other sport) fans. We have fanatics arguing over which team is the best. And we have the numbers and facts, yet we have fans arguing that the team they support is the best.

So can I say that your reality is different from my reality and that we see the world through our own tinted glasses which distort “reality”?

I believe that our own programming & environment is largely responsible for our own version of “reality”. Say you were told that eating a lot of chocolates can lead to cavities. So when you see someone with cavities, you’d think that the person eats a lot of chocolates. Is that the “truth” however? It may not be the case!

In areas like financial markets, teaching or arts like movies and painting, understanding this concept of reality is of prime importance.

Even a polymath like Da Vinci is not spared from “our” version of reality. I myself do not find the Mona Lisa to be as fascinating as it is supposed to be, yet it is one of the most viewed paintings on the planet. Similarly, we see movies coming day in and day out and question why someone would even finance or make a film as crappy as that, yet it could be a super hit. (I do not understand most Oscar winning movies myself :-P).

So how do we “see reality?

A suggestion I have is something I have mentioned earlier- Be Childlike!

Let go of every concept that you’ve held, “you” are not a Boy or Girl, “you” are not (Insert Your Name Here).

Only once you’ve broken the shackles of of your own tinted glasses, can you see reality. And once you do, you’d get much better at making decisions!

The Greatest Trickster, Ever!

Things are only different in our mind, from the biggest decisions in life to the simplest ones, our inner voice allocates different weights to different things in life, especially under pressure. Say in a bad mood, even a decision as to what to have for dinner can be difficult and when in a good mood, complex decisions like how to plan your retirement finances can seem easy. (Notice how there is always soothing music in loan advertisements).

Our mind is a lot like Loki, the Trickster Norse God. It makes crazy scenarios, and scares us, makes us nervous, gives us fear and sends us on an endless trip of “What If?”

The beauty of “What If?” is that it can start with an innocuous headache and end up with us surfing WebMD and we start to think that it could be Brain Tumour.

So how does one stop being tricked (apart from an existential crises) ?

Go inward, ask yourself something as simple as “Who asks this?” or “Who is afraid”. Earlier I tried to explain why being childlike is a benefit. Most of what we believe we are is a belief. We have built layer upon layer of our identity.

Let all of these identities go! Most of them were taken from someplace anyway. Once you let enough of these beliefs or identities go, you realise at some level that you are not the body or beliefs, but something much more.

You realise that even your own name was given to you. You forget notions of cause and effect as well. So when things do not go as per plan, you do not hung up over it, thinking “but that should have happened!”.

Life becomes much more colorful and fun. Ups and downs seem like a rollercoaster ride. So you start enjoying life, and work with a passion, yet remain unfazed when things do not go as planned. And most importantly you can enjoy complete silence and being by yourself with no thoughts.

Try it! You may lose a lot of gunk in your head and find your self.

The Z Factor

Dr.Subhash Chandra is a Maverick & Pioneer. The Z Factor combines the effects of serendipity, raw guts and a “Karte Hai, Dekha Jayega” (“Screw it, let’s do it!”).

From his family’s beginnings in Sadalpur near Hisar, Haryana, to taking charge of the family finances at 17, Dr.Chandra’s story reads as a nice thriller in some parts. This is a tell all account as there is no sugar coating in the book. Take for instance, how Chandigarh officials of the Food Corporation Of India would help him win bids. Dr.Chandra candidly admits how he “curried favours” or how India’s first private television channel was an “illegal” operation.

We read how Star misjudged the opportunity size India presented or how an angry Dr.Chandra bought satellite bandwidth at $5 Million when the going rate was somewhere between $1.5 Million simply because the Star executives did not want to sell him the satellite bandwidth.

From betrayals (a lot of them) to political pressure that comes with running a news channel, we read how a fearless man like Dr.Chandra admits how scary it was to meet Mrs.Indira Gandhi. The absurdly funny part of the book is a con Dr.Chandras  competitor in the rice exporting business was running on Soviets.

This autobiography is raw. It touches a nerve and shows us how serendipity helps.

Dr.Chandra is a Byronic hero. He has done some wrong, not played by the book completely and he is candid enough to admit it. He does not paint himself as an angel nor does he have any false modesty. Like Dumbledore, he knows he has achieved a lot and has no compunctions about it.

Go grab it from Amazon.

The Answer To Everything

“If you wish to make an apple pie from scratch, you must first invent the Universe.”

Carl Sagan

“Causality” is to look for events to explain why a chain of events happened. Because event “A” happened, Event “B” happened. Primarily though we use the Cause & Effect Model to get something to fit into our conceptual framework.

We cannot accept that things just happen!

Now let us start with this article itself.

I” write an Article share it on Social Media. “You” click the Link & Read it.

Let’s break the Cause & Effect:

Cause: “Me” writing an article and Sharing it on Social Media.

Effect: You clicking on the link and reading it.

But let’s dig a bit deeper into the Hierarchy of “Cause & Effect” now.

Let us begin with “Me” writing the article:

“Harshil Shah” writes & posts an article.


“Harshil Shah” likes thinking & writing.


“Harshil Shah” reads some stuff and gets Ideas.


“Harshil Shah’s” Parents Buy him lots of Books.


Well they Love Him.


“He” is their Offspring.


Well, they got Married & wanted a Child.


“Harshil’s Grandparents agreed that his Parents were a Good match for each other.


Both sets of “Harshil’s” Grandparents “vibed” & thought that his Parents were of age.


Because “Harshil’s” Grandparents were also married off similarly.


Because “Harshil’s” Great-Grandparents also “vibed”.

Why? (At this Question, we can skip the Great∞ -Grandparents and come to the below conclusion)

The Universe was Created.

Now let us take Social Media:

“Harshil Shah” shares the Article on Social Media


WordPress, Facebook, Google & Twitter exist.


These Companies Have Creative Founders.


They foresaw the amazing uses of something called the “Internet”.


The US Army created something called the “ARPANET”


Communication is vital for Human Beings.


That is how societies of various hues & shades are formed.


People like to Bond.


Since the Dawn of Mankind, Groups were better off than Individuals.


Mankind was Born.


The Universe was created.

Now You, the Reader

You are Reading this article.


It came across your Social Media Feed.


You have an Internet Connection and thought the Title of the Article was interesting.


You Have a Phone/Tablet/Laptop and were surfing the Internet


You bought one for yourself or your Parents bought you one.


You have an Income or Your Parents love you.


You are Educated Enough to earn an Income or Your Parents Love You.


Your Parents were married off or Your Parents met & fell in Love.


Now we can insert the Grandparents Analogy I used in “My” case and keep going back to the Dawn of Civilisation, before Homo Sapiens were around.


The Universe was Created.

Or“- either statement could have been a “Cause”.

So at times when we are confused or sad and look for an answer to “Why is this Happening to “Me”? Do not get sucked into Cause & Effect much, because then you’d Question the existence of the Universe. And that is a Deep Rabbit Hole.

P.S: The Butterfly Effect tries to take “Causality” to a whole new level.