## Jul 28, 2009

### View stock market with heatmap

There is a heatmap tool which let you view the stock price change at a glance. It can be recreated with Mathematica in several lines of code.

Let’s pull the data by format {“symbol”, price change}

stockdata={#,(FinancialData[#]/FinancialData[#,"Close"]-1)*100 }& /@FinancialData["^DJI","Members"];

Then we need to represent the price change by color: Green means up, Red mean down, and the deeper the color, the bigger the change.

max = Max[Abs[stockdata[[All, 2]]]]; (* max change *)

GraphicsGrid[Partition[Graphics[{If[#[[2]]>=0.0,Blend[{White,Green},Rescale[#[[2]], {0,max}]], Blend[{Red,White}, Rescale[#[[2]],{-max,0}]]], Rectangle[], Black,Text[Style[#[[1]]<>"\n"<>ToString[NumberForm[#[[2]],{3,2}]]<>"%", Medium,Bold], {0.5,0.5}]}] &/@ stockdata, 6 ]]

The key function is if the price change is >0, then rescale the change in range (0, max) and get it’s color in Blend[{White, Green}]; if the price change is <0, then rescale the change in range (-max, 0) and use Blend[{Red, White}] to get the right color.

In the ascending order:

We can try other representations, too. For example, we can use the size of disk to represent the change.

#### 10 comments:

vJD said...

Hey, this is really great - thank you for providing us with the code.

Is there an equally easy way of creating seasonal charts like in

http://www.seasonalcharts.com/

Cheers,
Holger

KnowYourProfit said...

The blog is very informative and user friendly created by the

webmaster,we would also like to share our experience on this

blog

As such we all had seen 5% correction in bse so this is the

right time for the investors to take positions for handsome

returns,no doubt everyday the market is giving opportunities to
make money provided you are taking timely entry and exit from

the positions

Regards

www.knowyourprofit.com

+91-9871142419

stock market tips said...

I read your post . it was amazing.Your thought process is wonderful.The way you tell about things is awesome. They are inspiring and helpful.Thanks for sharing your information and views.
Regards
stock market tips

Unknown said...

Just want to say your article is as amazing. The clearness in your post is simply cool.
-------------
swing trading

SHRISTOCKTIPS said...

Share Market Investment made profitable by SHRISTOCKTIPS- Get NSE/BSE Tips via SMS and Yahoo Messenger. We give daily stock market tips for future and cash segments. As said last time to make a buy in TCS & INFY both gave very handsome profit to our all paid clients. Last time we are not very much sure about NIFTY so there were no NIFTY callsNSE, STOCK TIPSNow we suggest all the traders to make a sell position in NIFTY at the level of 6400-6450 with stoploss of 6550 for the target of 6200-6100. One can also make a sell position in NIFTY 50 stocks with the stoploss of NIFTY mentioned before. We starkly follow our stoploss. So keep in mind this thing carefully. Do not make any buy position in these stocks because they are directly link to NIFTY. For Further update keep following our website.
Regards
SHRISTOCKTIPS TEAM

Ram Katariya said...

Join Epic Research and get free Stock tips, live market news, updates, recommendations and many more to hike your profits.

Esha Agrawal said...

Thanks for the information

Open Demat Account with Indira Securities best Stock Broker
Open Commodity Trading Account
Open equity Trading Account
Mobile Trading App

Beststockstips12 said...

Thanks for this great post.
Short Term Investment Tips

Best Database provider said...

This is very great post and i am inspired with your content.
Best Datawebster Services

Best database provider said...

Thanks for sharing this with us. I found it informative and interesting. Looking forward for more updates.
School info database