Professional Documents
Culture Documents
Quantitative Finance Collector
Quantitative Finance Collector
abiao
Published: 2010 Categories(s): Non-Fiction, Business & economics, Finance Tag(s): "quantitative finance" "financial engineering" "mathematical finance" quant "quantitative trading"
Quantitative Finance Collector is simply a record of my financial engineering learning journey as a master in quantitative finance, a PhD candidate in finance and a Quantitative researcher. It is mainly about Quantitative finance codes, methods in mathematical finance focusing on derivative pricing, quantitative trading and quantitative risk management, with most of the entries written at university.
A useful summary of suggested solution: 1, 1) import the large file via "scan" in R; 2) convert to a data.frame --> to keep data formats 3) use cast --> to group data in the most "square" format as possible, this step involves the Reshape package, a very good one. 2, use the bigmemory package to load the data, so in my case, using read.big.matrix() instead of read.table(). There are several other interesting functions in this package, such as mwhich() replacing which() for memory consideration, foreach() instead of for(), etc. How large can this package handle? I don't know, the authors successfully load a CSV with size as large as 11GB. 3, switch to a 64 bit version of R with enough memory and preferably on linux. I can't test this solution at my office due to administration constraint, although it is doable, as mentioned in R help document, Quotation 64-bit versions of Windows run 32-bit executables under the WOW (Windows on Windows) subsystem: they run in almost exactly the same way as on a 32-bit version of Windows, except that the address limit for the R process is 4GB (rather than 2GB or perhaps 3GB)....The
disadvantages are that all the pointers are 8 rather than 4 bytes and so small objects are larger and more data has to be moved around, and that far less external software is available for 64-bit versions of the OS.
The amazing point of it is the smaller files keep the original header of the big csv file, very cool. Download the free csv splitter here. Tags - csv , tool
following errors: 1, ??? Error using ==> sendmail 530 5.7.0 Must issue a STARTTLS command first This could happen for MATLAB 7.1 (R14SP3) and before, you may have to upgrade your version. 2, Could not connect to SMTP host: smtp.gmail.com, port: 25; Connection timed out: connect This is due to your firewall or anti-virus software setting. you are not allowed to send email from port 25. What you shall do is too add an exception and let your computer know this action is safe. For instance, I have McAfee, to add an exception, open its control console -> double click access protection -> anti-virus standard protection -> prevent mass mailing worms from sending mails -> Edit
Ros, you don't have to check computers one by one. Sounds useful? download the file at http://www.mathworks.com/matlabcentral/ fileexchange/16649, don't forget to change the email address and password at the beginning of the file. Tags - matlab , sms
After:
10
It returns a GUI looks like where you are able to set inputs and get outputs. Nice. More advanced GUI is possible by adding more lines. Interested readers shall download the package "fgui" at http://cran.rproject.org/web/packages/fgui/index.html Tags - r , gui
11
The submission deadline is October 10th 2010. Final results will be announced on October 12th. The winners of this contest will be honoured at a session of the INFORMS Annual Meeting in Austin-Texas (November 7-10). Check the detail of this competition at http://kaggle.com/informs2010 Tags - prediction , competition
12
Believe it or not, on average programmers spend 70% of their working time in debugging (I don't know where this number is from but I do believe so). A good debug tool, command or even habit will definitely improve your work efficiency, shorten working hour, and enjoy more the world cup. When it comes to Matlab and R, I have to say the debugging in Matlab is straightforward but is more comprehensive in R. Here is an introductory video demonstrating how to debug and understand Matlab codes:
Also a very good PDF document for debugging in R with detailed examples at http://www.biostat.jhsph.edu/~rpeng/docs/R-debugtools.pdf. Enjoy. Tags - debug
13
14
any other distractions. This is unworkable for many traders, though when a scalper finishes for the day, his exposure is finished as well. Some scalpers try to eliminate this problem by automating the process. In recent years, a vast number of robots and software automation kits have become available for scalpers. Unfortunately, most of these are unproven, and many make wild claims that stretch far beyond plausibility. Still, there is a real benefit in automating certain parts of the process. For instance, you might use software to execute redundant tasks like stop-loss, take profit and other orders, while doing the analytical tasks yourself. In this limited role, the automation can be a significant help by allowing you to execute more trades with less drudgery. Scalping is a workable strategy if you know what you are doing and are willing to dedicate your full time energy to forex trading. Unfortunately, too many beginners try scalping based on the assumption that they can avoid risk. As any experienced investor knows, risk accompanies any genuine financial opportunity. After several months of practice, and with plenty of education, scalping is a great way to enter the forex markets. This guide will tell you some of the main things you need to know when getting started. The first step in any guide on scalping is understanding how scalpers actually make money. What does a scalping strategy look like in daily practice? We already mentioned that scalping involves entering and exiting the market in short time spans. But what guides the choice to enter or exit? Actually, this strategy works on the basis of careful analysis and timing. What makes scalping different from other strategies is that it takes advantage of volatility rather than trending, ranging, or fundamental analysis. Recognizing that the market moves erratically in the short term, scalpers try to identify small patterns and exploit them. The strategy works when traders can find short-term disruptions in liquidity, or other temporary abnormalities. For instance, a news shock or some other factor might suddenly increase demand for the yen. During that time, there will be a need for liquidity as too many people demand the yen with insufficient supply. The spread between bid and asking price will temporarily widen. A scalper might recognize that the
15
liquidity has to return eventually and the price will eventually settle back into normal levels. Based on this, he can go long or short, as appropriate, and collect on the difference. This means that scalpers actually benefit from volatility by trading on the assumption that prices will stabilize again. Its not hard to see that after a major event, prices routinely zigzag for several minutes before settling again. Since this is an emotional over-reaction, a scalper maintains a realistic, stable viewpoint and profits from those who dont. Its also easy to see that if trading wisely, scalpers act as brakes on the micro-volatility of the market. They actually profit by dragging irrational price-spikes back to meaningful levels. One other implication is that the most important time for a scalper is just after a market shock. Scalpers pay careful attention to announcements of economic data or news shocks and the disruption that follows. But these observations lead to the other major topic of this articleleverage. The inherent limitation of trading on micro-volatility is that it will never be very significant. Therefore, scalpers use surprising amounts of leverage to make their trading more potent. Their leverage might range from 5:1, all the way up to 50:1. These kinds of leverage would be simply intolerable for other traders, but the important thing to remember is the short duration that scalpers use. During this time, there is little opportunity for wide swings in the market that would risk massive losses. It is also crucial to always use a good stop-loss mechanism and not adjust it for individual trades. If these measures are maintained and a trade turns out badly, it will be closed in a matter of minutes or even less when the stop-loss level is reached. There are still a few cases when scalpers might still suffer significant losses. Significant news shocks might cause very wide spreads in a short time. Even the best brokers may not be able to complete stop-loss orders quickly enough, and losses can multiply exponentially. Therefore, traders should always be conscious of whether new economic data or another type of event has the potential to cause significant disruptions. In such cases, it is always wise to use caution and trade with lower amounts of leverage. Scalping is an interesting strategy because it takes advantage of
16
phenomena that might otherwise seem random. It is a simple testimony to the fact that on every level of the forex market, the same principle appliesprofit belongs to the traders that use their heads and who are not carried away by short-term emotion. The scalpers that succeed are the ones that have mastered that art. The next logical question in our guide to scalping is how to do it. When it comes right down to the pragmatics of this strategy, what do you need to make it work, and where do you start? One of the most important foundational issues is choosing the right broker. In some cases, a brokerage may even have a stated policy against scalping. Without the right platform and broker, you simply have no chance of success. But what should you be looking for? The first issue is the brokers spreads. If a swing trader opens and closes several positions every day, a spread of several pips is hardly an issue, but scalpers might open and close more than a hundred daily. If you work out the math, this is a significant loss. For instance, imagine that a trader makes 50 trades with a nice profit of 130 pips. If the spread is three pips, he would end up with a net loss of 20 pips. Since the cost of the spread applies to every trade whether it is profitable or not, this loss adds up very quickly. The conclusion is fairly obviousif you want to make any profit with scalping, youll need to find a broker with the lowest spread possible. In addition to spreads, you should also check for any commissions or hidden trading fees. But this search is not always easy. Unfortunately, many brokers have a bad relationship with scalpers. The problem is that the number of trades scalpers make can sometimes overwhelm older systems. In addition, every broker has to countertrade the orders he processes to avoid being financially liable. Receiving large numbers of orders every day doesnt make this easy. For those reasons, many brokers try to eliminate scalpers. Sometimes this is a stated policy, but very often a broker will simply terminate a scalpers account or slow down his processes so that scalping is impossible. Therefore, you must also find a broker with the most up-to-date technology and a toleration for large numbers of orders. Look for a fullyautomated broker with no-dealing desk (NDD).
17
There are several other things that can make scalping impossible. If the trades take too long to process (slippage), the price difference will quickly make trading unprofitable. Therefore, you should always look for efficient execution of your orders. Similarly, price quotes must always be precise and updated dynamically. Even a small delay (latency) makes trading based on micro-volatility impossible. Finally, scalpers should look for platforms with a workable interface. For the most part, this should include the same financial tools that traders want with other strategies. Of course, you should look for an interface with a full range of execution tools. But in particular, the interface needs to be fast and easy to use. This is important because of the number of rapid orders that must be made. Customization is also a big advantage, as well as automation. You should also pay attention to the visual appearance of the interface. Scalping requires intense focus, and many traders report eye-strain after a long day of staring intensely at a screen. In short, you should consider every angle before committing yourself to a particular brokerage or a trading platform. Be upfront from the beginning with your broker. If you try to use this strategy through a system that cant handle it, the brokerage will intentionally make trading impossible. Of course, you should also be confident that your broker isnt fraudulent. Most of all, you should never try to use scalping through a broker with wide spreads or other excess costs. The net result will always be a loss. Done right, and done through the right avenues, however, scalping can be quite successful. Once you establish a broker, there are several other things you should know about scalping. First, you should wisely pick currency pairs that will work well with the strategy. The best thing is to start out with the basic pairs, and move to riskier pairs as you become more experienced. The most stable and liquid currency pair is certainly EUR/USD. Other majors have a similar stability, such as GBP/USD, USD/CHF and others currencies from the major world economies. All of these currencies change very slowly. Even major events will not produce significant jumps in these pairs, because of the volume that is regularly traded.
18
But isnt the goal of scalping to profit from volatility? So it seems as though more volatile currencies would be better. The advantage of the more stable currencies, is that directional changes are much easier to predict. Remember that even small fluctuations can be magnified through leverage. This means that a trader can generate very large returns from these pairs, if he is willing to accept the risk. Another group can be called carry pairs. These currencies are liquid, but much more volatile than the majors. A good example here is the Japanese Yen. Interest rates are very high on the Yen, and many investors also use the currency for risky assets. One of the results is that market shocks will have extreme results that might result in very wide spreads. Within a scalping strategy, this might result in extreme losses that a stop-loss order cannot protect from. Furthermore, excessive volatility can be quite unpredictable. Therefore, it is generally best for beginners to stay away from pairs that involve the Yen (JPY) or other carry pairs. Finally, exotic pairs involve small or developing nations with a low volume of trade. Examples might include the Norwegian Krone (NOK), the Turkish Lira (TRY), the Brazilian Real (BRL), or any of the developing currencies. These pairs are quite unpredictable, and often run into significant liquidity problems. Trading with one of these is a significant risk. Any experience trader also realizes that the markets change during the course of a day. So when is the best time to trade? From 7:00-8:00 (EST), markets are quite choppy, because worldwide traders anticipate the opening of the New York market. Late morning brings higher volatility, but also great liquidity. Many announcements also direct the market during this time. Early afternoon tends to be quite choppy, with higher risks but potentially greater profits. Late afternoon sees the closing of most large banks in developed countries, and the market becomes its quietest. Really, your preference for each of these times depends on your style. In choppy conditions, scalpers should look for shorter trades without concern for directionality. Of course, during the time that the markets are open, there should be more attention to larger trends, and the
19
possibility of more extended trades. All of these factors are significantly influenced by your particular style and your experience. Risk may be just the thing if you know how to handle it, and experienced traders often had straight for more volatile times and currency pairs. If youre only beginning, the key is to stay with major pairs and avoid times of wild fluctuations. Learn how to predict the market with low leverage and minimal risk. Once youve seen and handled various market conditions, you can consider taking bigger risks, and pursuing larger profits. This guide has sought to introduce scalping and discuss the pros and cons of the strategy. After a brief introduction into the characteristics of scalping, we discussed how scalpers profit and how they use leverage. We also pointed out the major necessary things to make scalping successful, including a good broker and an efficient platform. Finally, we discussed the best currency pairs and times of day when scalping works best. But this guide runs the risk of being overly simplistic if we fail to talk about the variations on scalping. Traders might use any one out of a number of techniques to make their strategy successful. Trend scalpers follow the direction of the market and try to profit from where it is headed. Think of this as following the macro-direction of a currency, but on a much smaller scale. Other scalpers prefer to take advantage of news events and other shocks to the market. These traders stay away from the period closest to the news event, but profit in the time just afterward. The more important point to recognize is that scalping varies drastically according to conditions. At times the distinction between scalping and other strategies is quite unclear. For instance, if a scalper opens a position and then observes a longer profitable trend, it only makes sense to take full advantage of it. Depending on what is happening, a trader might switch back and forth between all of the strategies, or form his own hybrid. However, this points to a very important issue that applies to all forex trading. There is a deeply psychological aspect of dealing with risk and loss that every trader should be conscious of. Here are a few qualities to aim for.
20
First, scalpers and all forex traders for that matter, must exercise discipline in their trading. This is the only problem with moving between various strategiesit becomes too easy to make emotional decisions and take foolish risks. Let your strategy control your decisions. In particular, dont make the mistake of varying the size of your trades too muchespecially when you have a string of successes. One bad trade can erase a lot of progress. A second, related point is cool-headed thinking. When markets become chaotic, it is easy to be controlled by the volatility and make foolish mistakes. At those times, remember your strategy and follow it assiduously. Third, you must be patient for the long-term. Scalping works when lots of small but profitable trades add up to a large sum. Be willing to wait for that, even if it requires persistence and temporary loss. Finally, it is imperative to know yourself. Know what style works well for you. Observe what market conditions tend to reap the best profits for your trading. At certain times, it may be best not to trade at all. When you recognize that conditions mirror what has worked well for your strategy in the past, you should jump into the market fully. Beginning traders sometimes assume that scalping is the easiest way to earn a quick profit. However, scalping is actually one of the most challenging strategies. Some scalpers suffer losses at the beginning, but with a lot of practice, discipline, education, and the right tools, this method can be one of the most profitable forex strategies. Tags - forex , trading , strategy
21
Massive, isn't it? download the csv file and also a file for option data at http://www.gummy-stuff.org/Yahoo-data.htm Tags - data , yahoo
22
R Sapply Problem
Any expert in R please educates me. I have got a problem about the sapply (or lapply), it made me headache for over two hours. As "for loop" is very slow in R, we should try best to avoid using it, and to use vectorization instead. sapply is designed for this, for example, instead of: for (i in 1:10) { z[i] <- mean(x[1:i]) } we could use z <- sapply(1:10, function(i, x) {mean(x[1:i])}, x)
It went well, but what if besides computing z, I need to update another variable, for example, with loop, it is temp <- 3 for (i in 1:10) { x[i] <- x[i]-temp z[i] <- mean(x[1:i]) temp <- x[i]-z[i] }
in this case, temp is changing every step (it doesn't have to be a function of z[i]). How to vectorize that and use sapply then? since sapply can't return two variables z and temp. I tried to define a matrix and store z in the first column and temp in the second column and return the matrix, however, failed. Many thanks.
PS, NO, still not correct, working on it... ah, I worked it out, it can be done by passing z itself to sapply, that's good.
23
the following is a sapply example returning the same result for "for loop" and "sapply". sapply.example <- function(nsim = 10){ x <- rnorm(nsim) y <- list() z.for <- array(0, nsim) temp <- 3 for (i in 1:nsim) { x[i] <- x[i]-temp z.for[i] <- mean(x[1:i]) temp <- x[i]-z.for[i] } y$z.for <- z.for z.sapply <- array(0,2*nsim) z.sapply[1] <- 3 z.sapply <- sapply(seq(1,2*nsim,by=2), function(i,x,z.sapply) { temp <- z.sapply[i] z.temp <- mean(x[1:((i+1)/2)]) temp <- x[((i+1)/2)]-z.temp z.sapply[i] <- temp z.sapply[i+1] <- z.temp z.sapply[i:(i+1)] }, x, z.sapply, simplify =TRUE) y$z.sapply <- z.sapply[seq(2,2*nsim, by=2)] y } Tags - r
24
25
Tags - football
26
Exclusive Offer: Download $79-value Vertical Spreads options trading ebook for free
A guest post from our Elliott. Dear reader, We have a very special offer for traders today. Our friends at Elliott Wave International have just released their $79-value, 42-page ebook for options traders for free download. The new ebook, How to Use the Elliott Wave Principle to Improve Your Options Trading Strategies -- Vertical Spreads, which sells in EWI's online store for $79, is available for free, exclusively to you, for a limited time. The ebook is designed to help you exploit sharp price movement with powerful vertical spread trading strategies, including: Bull Call Spread, Bear Put Spread, Bear Call Ladder, Bull Put Ladder and more. This valuable ebook belongs in any serious trader's library. You can download it now for free here. Tags - option , trading , elliott
27
28
Below are the selected steps to create an R package in Windows I summarize: 1, you have to download Rtools at http://www.murdochsutherland.com/Rtools/. 2, depending on your needs, you may download and install LaTex, Microsoft HTML Help Workshop and the Inno Setup installer, available at http://www.miktex.org, http://msdn.microsoft.com/en-us/library/ ms669985.aspx, and http://www.jrsoftware.org/, respectively. For example, Microsoft HTML Help Workshop is for making HTML Help documents, LaTex is for a nicer outlook, especially when your documents have math equations. 3, double click Rtools.exe to install it and its accompanying tools: minGW, perl. Rtools automatically recognizes the paths of those relevant softwares and add them to the environment variables of your computer.
4, check and change your PATH environment variables of your computer if incorrect. To set the path, right click on the My Computer icon on your desktop, choose properties and click on the advanced tab, click the environmental variables button, click on the path variable and select the edit button. Check carefully whether all the paths are correct, special attention needs to be given to the path of R software. 5, double check whether all tools are installed correctly by opening a command prompt window and typing the following commands: R; gcc help; perl help; Tex help, respectively. You should see a list of options, otherwise re-install or check the path if you see is not a
29
recognized as an internal or external command 6, start R and run the command package.skeleton( ) with suitable arguments, read the help http://stat.ethz.ch/R-manual/R-patched/ library/utils/html/package.skeleton.html for detail. For instance, I write a sample code MonteCarloPi.R to estimate PI by Monte Carlo simulation, we use package.skeleton(name = "MonteCarloPi", code_files = MonteCarloPi.R), where MonteCarloPi.R includes function we want to add to the package MonteCarloPi. This function creates the directory tree for the package containing: DESCRIPTION << man <<< for documentation R <<< for R function definitions src <<< for low-level source code (this is optional for other programming files, such as your c++ codes) data <<< for package datasets (this is optional)
7, remove the Read-and-delete-me file and modify other files in the above directory with notepad or other tool, for instance, to add the author information and Help explanation. 8, open a command prompt window, change the directory to where your package is, type the command R CMD build MonteCarloPi to build the package, this will generate a file called MonteCarloPi_1.0.tar.gz. You must run the command in a command prompt window instead of in R, otherwise you are expected to see Error: unexpected symbol in "R CMD". 9, test the package by typing R CMD check MonteCarloPi_1.0.tar.gz, go back to step 8 if you see errors. 10, now you are able to install the package typing R CMD INSTALL MonteCarloPi_1.0.tar.gz. Congratulations if you see done and you will notice there is one more sub-folder MonteCarloPi in your R library folder. #MonteCarloPi.R -- PI estimation by Monte Carlo simulation MonteCarloPi <- function(nsim){
30
31
15 Incredibly Stupid Ways People Made Their Millions A selection of stories outlining the stupid ways people made their millions.
Inventions are important. They're the reason life has become so easy for us, and technology so accommodating. The market for inventions is enormous, and hundreds of new ones are patented every day. Since not everyone is a genius, many of them fall into obscurity immediately as inefficient or unimportant ideas. However, sometimes the silly ones we might be quick to dismiss are unexpectedly more profitable than the conventional method of doing whatever it is the newfangled thing does. Here are 15 weird and ridiculous ideas that made people rich.
1. Pet Rock
The Pet Rock is undeniable proof that people will buy just about anything. It's literally a rock with googly eyes glued to it, but the inanimate companion grossed a couple million dollars in 1975. The fad only lasted for that year before dying out, but the Pet Rock carriers, equipped with breathing holes and a straw as if for a real animal, proved irresistible for those wishing to give silly and ironic Christmas gifts.
2. SatLav
Really having to pee can be one of the most uncomfortable feelings ever. You cant concentrate on anything else, you fidget, you frantically search for the bathroom. But what if youre out in public and dont know where to find one? Poppin a squat it picking a dark corner isnt always an option, and many establishments have bathrooms restricted for employee or customer use only. Conveniently, anyone with a cell phone can now find the nearest public restroom just by texting a short number for a small fee.
32
3. Doggles
Do dogs really need goggles? No. Do they want them? Probably not. Does anyone sell them? Of course -- and they've made more than a million dollars off the idea. Giving dogs goggles is about as useful as giving a goldfish a monocle and cane, but that didnt stop the company Doggles from doing their very best. At $80 a pair, Doggles is a multi million dollar company. If you think about it, looking at the photo above (and ignoring the fact that this product shouldnt exist in the first place), theres no reason that goggle s for dogs should look the same as those for humans. The bridge of a dogs nose isnt directly between his eyes like a human, so this design is a little strange. They pretty much look like Seth Greens character from Cant Hardly Wait.
How much is a solitary pixel floating around in cyberspace worth? Alex Tew thought $1 per pixel was a reasonable price. Tew was just about to begin studying business at the University of Nottingham, but the idea he came up with to fund his education proved that he already possessed the sensibility of a successful businessman. Tew bought a web domain, laid out an area of 1,000,000 pixels, and sold them in 100-dollar blocks. Ads ranged from online casinos, to Target and everything in between. This was The Million Dollar Homepage.Tew came up with the idea in August of 2005, and by New Years Eve, every pixel bar but one had been sold. Not only did Tew make a whopping $ 1,037,100 gross from his relatively simple idea, but he also managed to attract some big name clients, like Tenacious D.
33
Even more absurd than dog goggles is the concept of a dog perfume. It's true that wet, dirty dog smell is an awful one... But how about wet and dirty mixed with floral extracts? It's like spraying air freshener in the bathroom -- it doesn't cover up the poop smell, just sort of hangs on top of it like an additional layer of sense assault. Here's an idea: give your dog a bath. If the dog is clean, it won't smell so bad. Dont just cover the smell up like some French hooker from the 1700s. The fact that this invention has earned over a million dollars is downright ridiculous. Another case against Petite Armande is that dogs have an exponentially stronger sense of smell than humans do. The animal most likely finds it unpleasant to be sprayed with irritating odor concentrates. If the smell is strong to us, it must be a billion times stronger for the dog. Suit yourselves, perfumed-pup-lovers, just dont complain when Timmys stuck in a well an you bloodhound Biff cant find him because his sense of smell is masked by the wafted aroma of Lassie Chanel No. 5.
Amazingly, this might be the silliest product yet which is definitely saying a lot, considering the cavalcade of weird stuff thats preceded it. Wishbones are traditionally considered lucky, and are taken from an animal (which is typically being consumed) to break in half between two people. Holding each end of the tiny bone, the two parties pull until it snaps, and decide which player is the lucky one according to who has the larger portion. However, Lucky Wishbone Co. doesnt sell real wishbones. It sells fake little plastic ones, at around about a dollar each. This abortion of an idea also makes its creators the a ton of money.
7. SantaMail
34
Get a postal address in the North Pole, pretend you are Santa Claus and charge parents 10 bucks for every letter you send to their kids. Well, Byron Reese has sent over 200,000 letters since the start of that business in 2001, meaning he's made a multi-millionaire dollar fortune. One of the best ways to make money out of people has always been taking advantage of their navet and dreams, and who's more nave than kids? Byron Reese, sprung for a postal address in the North Pole, a place he'd never been, so he could pretend to be Santa. Even worse than the mall Santa who lets kids sit on his lap and drinks malt liquor in the parking lot, in some intangible way. Reese writes back to the letters himself, but never reveals his true identity. At first, this sounds quite sweet, but consider this: What if little Susie (they are always called Susie) wants a little doll which Mommy and Daddy can't afford? Is Santa going to say no? What if little Jessica (shes rich and has a last name like DuBois or something) wants a pony, and Santas all like I think thats a bit much to ask, little Jessica. Ho ho ho! but then Jessicas parents buy her a really awesome pony with a Bose sound system and five LCD monitors? Then Santa all of a sudden seems nonexistent. Another million-dollar idea, this time one that depersonalizes one of the most beautiful mysteries of childhood by making it a capitalist business.
Are you too lazy to show up to work or school on time, but dont want to waste your creativity on coming up with your own excuse? The Excused Absence Network is a service which caters to all the lying employees needs; from a missed math test all the way to skipping out on your own wedding. The notes arent just those little Johnny had a sore throat today notes from mom these are excuse notes that look as though they come from a hospital or doctors office for just $25 per note.
9. Fetal Greetings
35
What is the worst way of telling someone that you're pregnant? The guys at Fetal Greeting have certainly come very close to nailing it -- their website suggests that you should surprise friends, family, & even the expectant father with these one-of-a-kind cards. It sounds almost like a scenario for Maury Povich And the card saysBob, you ARE the father. As is the case with most everything else on this list, there seems to be a positive correlation between the inanity of the product and its commercial viability. Fetal Greeting saw sales being reported in the million and climbing steadily.
10. www.MannequinMadness.com
Mannequin Madness is a website that sells second-hand mannequins at third-hand mannequin prices. They boast that that have the perfect body for you to buy or rent and the second-hand mannequin business is booming. The website stresses that the mannequins arent only good for traditional uses, like showing off clothes and making you feel bad about your body type. The website also suggests they be used for practical jokes and Halloween displays (read: causing heart attacks).
The Big Mouth Billy Bass was designed with the sole intention of driving people insane. It's a product for old people, who are the only ones to find its autonomous song incredibly novel. The singing fish is otherwise given as an unwanted box where it sits in the box to gather dust or is put out repeatedly at the same garage sale for two months. These two criteria make up millions of people, and the Big Mouth Billy Bass has made millions of dollars. With its success has come the delightful discovery that hacks could leave the Bass able to sing any song.
36
12. www.ICanHasCheezburger.com
I Can Has Cheezburger? burst onto the web scene in early 2007 and elevated the already rampant LOLcat meme to new level of ubiquitousness. The site, now a conglomerate of several extended memes, is primarily concerned with evoking humor from photos of cats with added, sometimes nonsensical, subtitles. The site was acquired a short eight months after is creation by a group of investors for a whopping $2 million. Two million dollars for a website whose principle visitors are stoners and 13-year-old girls who have just learned how to use the internet. I Can Has Cheezburger? Revenue is solely advertising-based.
Kyle McDonald may not be a household name, but hes definitely internet-famous, and he definite has a household -- one that he traded his way to from a solitary red paperclip (which, to be honest, looks used). It only took Kyle exactly one year and fourteen trades to make his way from a twisted piece of metal to a home for his family. Along the way, he travelled to the far reaches of Canada, all across the US, met Alice Cooper and Corbin Bernsen, and basically had one hell of a good time. Finally, Kyle settled with a home at 503 Main Street, Kipling, Saskatchewan, Canada, and he still lives there to this day. His story stands as an example of how you can start with absolutely nothing, and then one day live in Canada.
What is an ambitious real estate flipper to do with the abandoned house whose floors have been ravaged by the waste and habitation of a feral cat community? What about the family whose estranged hoarder aunt dies
37
from eating herself into a corner surrounded by mountains of garbage and human waste? Advanced Bio-Treatment specializes in murder, suicide, drug lab, and (really nasty) waste clean-up. It sounds like a morbid idea for money making, but ABT raked in about a million dollars during 2009 alone. And if all else fails, at least grandpa has some interesting bedtime stories for the kids.
Another death-related business is Eternal Reefs, a service which provides underwater urns for individuals cremated after death. The cement globe contains holes to encourage plant growth and allow fish to swim in and out of your loved ones ecologically friendly grave. Those purchasing the Eternal Reef are allowed to press their hands into the soft concrete, or attach a flag or sorts as a means of marking their reef. Eternal Reefs have a profit of about half a million per year. Tags - money
38
NEWFCN is a good function I always use when creating new files, basically it creates a M-File having the entered filename and a specific structure which helps for creating the main function structure. The actual working MATLAB Version will be also captured. For example, running newfcn('testnewfcn') generates a file named testnewfcn.m at a predefined style, the new file looks like function testnewfcn() % TESTNEWFCN ... % % ... %% AUTHOR : aBiao @ mathfinance.cn %% $DATE : 28-May-2010 18:55:27 $ %% $Revision : 1.00 $ %% DEVELOPED : 7.1.0.246 (R14) Service Pack 3 %% FILENAME : testnewfcn.m disp(' !!! You must enter code into this file < testnewfcn.m > !!!') % ===== EOF ====== [testnewfcn.m] ======
Did I mention you can customize the exact style by modifying newfcn.m to the appearance you like? just that simple! Download at fileexchange/6408 Tags - matlab http://www.mathworks.com/matlabcentral/
39
That's why I only got to know the existence of Mathematica Home Edition today despite the fact it has been in the market for over one year! What is Mathematica Home Edition? as the webpage shows: Quotation Mathematica Home Edition gives home users Mathematica's powerful technology, developed over 20 years and used by Nobel-winning scientists and leading corporations. It provides access to curated data, makes it easy to create and share interactive applications, and a whole lot more. It can be used for: Calculate mortgage, credit card, car, and student loan payments Evaluate currency exchange rates Monitor stock market returns and predict trends And much more...
In short words, Mathematica Home Edition contains the same functions that can be found in Wolfram's Mathematica 7. it is the full version of Mathematica but at reduced price for recreational or personal use. How much does it cost? $295, if you think $295 is a lot, please keep in mind the full non-student version is $2500!! Sounds a good business? Start to Import, visualize and calculate using built-in financial data with Mathematica Home Edition. PS: this post is by abiao, not by bo. Tags - mathematica
40
FinMetrics
I came across a toolbox - FinMetrics this morning, it sounds good from the introduction of help document, plus highly relevant to our topic quantitative finance, so I am eager to share it here. However, I am unable to get access to Matlab and check it in detail at the moment, please help me test and leave a comment about your thoughts then.
Quotation FinMetrics is MATLAB based, open source quantitative portfolio management environment. Built on concepts of bottom-up approach to application design, it allows users to define most basic, low level building blocks, e.g. assets and transactions, to be further pieced together in a higher level objects, e.g. positions or portfolios. Data analysis and statistics function, implemented within the environment and native to MATLAB, enable users to conduct scenario analysis, stress testing, performance measurement and attribution, risk measurement and attribution, design hedge strategies, etc. Open architecture of the environment allows users to work with objects of any level, depending on their requirements and expertise. The object structure and data types are specifically designed to make integration with MATLAB and native FinMetrics functions as easy as possible. FinMetrics user interface application and MATLAB scripting may be utilized to facilitate or automate complex and repetitive tasks, as well as extend functionality of the environment.
41
Flash Order
The stock market is a mess of people one-upping other people constantly. Any chance to get an advantage is seized immediately and one of those opportunities lies in the so called Flash Orders. In a brief summary, a flash order is a brief glimpses (no more than milliseconds) of someone elses exchanges. Of course, only high-speed computers can see these, but once they are seen, they can be used to get a leg up and buy or sell ahead of others. Some regard this as an unfair advantage as professional traders would gain advance knowledge on trends before individual buyers. Others say that it adds liquidity to the stock market. This opinion comes, of course, from the big businesses who are using the flash order service to their advantage to gain a profit. The problem is in the shifts that this brings about. For example, the big business might buy all of a certain stock, and then sell it for a bit more than they bought it, but a penny less than what the next guy is offering it for. This advantage causes motion in a violent manner in ways that would not be present in normal conditions. While this can for a time be a benefit, it means it can also fall just as quickly. Another big gripe is that the High Frequency Trading can really mess people over. Those with a leg up can make an investment risk-free, and it is only risk-free for them because all of the risk falls on to the lower tier. So far, it has upset enough people to be at risk for banning. The stock market has become a beast to be weary of these days. If this unfair advantage doesnt go, whats to ensure equality in the future? Fortunately the flash order business will very likely be taken away as more than a few well-placed officials have been given varitable heebiejeebies from this mess. Hopefully order will soon come out of this chaos. Tags - trading
42
It is all right to do like that, but the whole process becomes extremely simple with the cell mode in Matlab, it generates report automatically for us, any change you make regarding description, codes and results will be updated by clicking a simple button: Publish to HTML. The following steps outline the procedure, First, opening an editor in Matlab by choosing File -> New -> M-file; Second, selecting cell and enable cell mode in the editor; Third, inserting cell divider under cell window, it allows you to type a name for each section, similar with the title for chapters in Word; Fourth, depending on your reports, inserting Text Markup, where you are able to insert description text, bold text, etc. most importantly, it supports TeX equations; Finally, clicking "Publish to HTML", a nice-looking report is generated, and if necessary, changing the codes and re-running to update the report.
For a simple demonstration, I write the files as follows. %% Cell mode publish demonstration % abiao @ mathfinance.cn %% Using Black Scholes formula as an example % The value of a call and put options in terms of the BlackScholes parameters % is: % % $$C(S,t) = SN(d_1) - Ke^{-r(T - t)}N(d_2) \,$$ % % $$P(S,t) = Ke^{-r(T-t)} - S (SN(d_1) - Ke^{-r(T - t)}N(d_2)) = Ke^{-r(Tt)} - S C(S,t)$$
43
(r
\frac{\sigma^2}{2})(T
%% Sample code, for simplicity, I use the embedded command [call, put] = blsprice(10,9,0.02,2,0.3); fprintf('Call option value is %g. \n',call) fprintf('Put option value is %g. \n',put) call1 = []; put1 = []; for i = 1:10 call1(i) = blsprice(5 i,9,0.02,2,0.3); end %% Sample plot for demonstration only plot(5 (1:10), call1)
The final report is shown at http://www.mathfinance.cn/attachment/ CellPublishDemo.html, looks fantastic. Tags - matlab
44
Needless to say, comment is crucial for programming, it helps ourselves to debug our thoughts and other colleagues to understand the codes efficiently, which is especially indispensable as each programmer has his own coding style. However, under certain circumstances we may have to remove those comments, for instance, for the sake of confidential, etc. How do you do that then? delete the comments line by line? it is OK for a small file, but generally we may end up with a file with dozens, if not hundreds, lines of comments, what's worse is those comments intersect and we have to be carefully to find them out. Here is a clever way, MATLAB Comment Stripping Toolbox (it indeed has only 3 short files if you are afraid by "Toolbox" ). Basically it is a small collection of utilities for stripping MATLAB comments from MATLAB code. The code may be given in strings, cell arrays of strings, or read from a file or file identifier. There is full support for stripping comments from multi-line strings, that is strings with embedded newlines, which typically appear when an entire file is read in one go. For example, I wrote a simple test.m file and prefer to remove the comments and rename it as test-client.m: % test the comment strip command using mlstripcommentsfile(infile, outfile) % by abiao @ mathfinance.cn a = rnorm(10,1); % check if you can remove me % one more line b = rnorm(5,5); c = rnorm(3,3)... rnorm(3,3); %now i am here % test finished
after running the command mlstripcommentsfile('test.m', 'test-client.m'), I got the file test-client.m to send to others
45
Nice, isn't it? you can download the toolbox at http://www.mathworks.com/matlabcentral/fileexchange/4645. PS: the original codes use old Matlab version so you will get the warning "Warning: The 'tokenize' option for regexprep is now the default behavior." You may choose to modify the codes by deleting 'tokenize'. Tags - matlab
46
Financial Scams
A guest post of Bo. People have a great amount of concern for money, and finding means to get money quickly becomes almost a necessity. It is this need for quick cash and no work that leads people to be drawn into great, sometimes historical financial scams. One great example would be the use of historical Bonds. You see, back in the day, there were a number of gold bonds issued for a variety of reasons. A way for the government to obtain money with the promise to return it with interest. These bonds were payable in gold, and after a certain maturity point could be cashed in. The problem is that after a particular date they became useless. Nothing more than a piece of history waiting to be preserved in a museum. It is these relics or mock-ups of them that are sold to you by the conartists. Normally with very official looking documentation and after youve been hopped from bank to bank, you find out that it is in fact worth nothing except maybe some sentimental collectors value. If your lucky, it may actually be an actual Bond, in which case you could get a small amount of money from a museum that hosts them. This is truly a great demonstration of one of the historical financial scams. Another great example is the Viactuals Frauds. The pretense is that you buy someones life insurance policy, making small investments. When they die you get the full death benefit from said policy. You also walk away happy knowing that your investments made a sick persons life a little better right? Well just like any child in school there are people out there who will fake sickness for the attention and the money. Your money could easily be pocketed and you are left all the poorer. Then of course there are scammers that will take your investments to buy their own wants and luxuries rather than using it on the policy you wanted. And the world goes round. The best way to avoid these historical financial scams is to stay away from any offer that looks too good to be true unless you have the help of a real attorney or somebody who really knows what they are talking about. Scam artists are usually professionals at their trade, so will not likely be found.
47
Tags - scam
48
Tags - calculator
49
50
\sum_{n=0}^{\infty}\frac{(it)^n}{n!}e^{n\mu+n^2\sigma^2/2} is asymptotically divergent but sufficient for numerical purposes Fisher information: \begin{pmatrix}1/\sigma^2&0\\0&1/ (2\sigma^4)\end{pmatrix} As you may guess the same information is available at wikipedia at http://en.wikipedia.org/wiki/Log-normal_distribution. now for the estimation properties. well conviniently you would want to estimate the mean and the variance of the corresponding logarithmic distribution which happens to be normal and then may be use the above formulas to find the lognormal's parameters. but there is error associated with this. An example of the error is : say you decide on a parameter m as the mean of the corresponding normal distribution and sigma^2 as the variance. the you may say that the corresponding mean of the lognormal distribution is simply mean of lognormal distribution = exp(m+sigma^2/2) However using some math i will show you that this is not an unbiased estimator. Let E[.] denote the expectation of the quantity within the brackets and let M denote the mean of the lognormal distribution.Then if the above estimator was unbiased, we should have E[M] = E[exp(m+sigma^2/2)] But, E[exp(m+sigma^2/2)] => exp(E[m+sigma^2/2]) according to the Jensen inequality. for those of you who don't know what this is refer to the http://en.wikipedia.org/wiki/ Jensen_inequality. Hence there are problems with this form of the estimation. So i would redirect you to this page check out some other ways how this can be done
51
http://papers.ssrn.com/sol3/papers.cfm?abstract_id=1285465 Now having resolved the univariate case we turn our attention to the bivariate case. The parameters in this case are the two means, the two standard deviations and the correlation coefficients. Now the natural question is how to calculate the correlation coefficient. The expression for the covariance is cov(x1,x2) exp((sigma1*sigma2)-1)*exp(m1+m2+(sigma1^2+sigma2^2)/2) The expression for the correlation coefficient is rho = [exp(sigma1*sigma2)-1]/sqrt(exp(sigma1^2-1)*exp(sigma2^2-1)) For more such references and also to get a table for actual values check the following out http://www.stuart.iit.edu/shared/shared_stuartfaculty/ whitepapers/thomopoulos_some.pdf I will want to finish off with some intuition as to where can you apply the lognormal distribution. Now first identify if the variable under study is throughout positive or not like a stock price. Next identify the fact that the variable contains kind of multiplicative factors in the sense that say there are levels to the quantity in multiplicative terms. What I mean to say is that the variable has let us say a level r on normal days.Then when you expect the variable to go up it goes upto 1.5 times r then even higher means that it goes to say 5 times r. Similarly for the lower side. If your variable is indicative of this then it suggests a lognormal distribution. Tags - distribution =
52
53
again the same as those of prior market. Case 3: The views are the same as for case 1, but we increase the confidence for both view from 25% to 75%. We expect the distribution of posterior market alters more significantly. identical with what we expected, when compared with the results of case 1, the means of 2y and 10y are decreased more significantly, and the means of 5y and 20y are increased more pronounced. For all views, the even moments are only marginally affected. Our robust analysis demonstrates the strong consistence of the COP approach. Based on the posterior market values we are able to do return mapping and portfolio optimization. These two posts are a short summary of the original paper and Matlab implementation, please read the source for detail. Tags - black-litterman
54
55
However, the original Black-Litterman model helps portfolio managers to compute the distribution of the posterior market that incorporates their subjective views with respect to the prior distribution. All these assumptions are being made considering the entire scenario is normally distributed. In fact, it is frequently observed that returns in equity and other markets are not normally distributed. At the same time, you would expect a practitioner to input his views in a less informative manner. For instance, instead of a view like I am 90% sure that stock A will have a 2% expected return, he may have a more accurate view such as I am 90% sure that the return of stock A will stay between -1% and 1% with equal chance, or for an Asian option Trader, his views may be a set of prices at several specific monitoring times, when the option is supposed to be exercised. Meucci (2006) solves the above-mentioned issues of the original BlackLitterman model by developing an approach called Copula-Opinion Pooling (COP), the author relaxes the normal distribution assumption and in principle allows any distribution. However, the proposed implementation in the paper has a distinct distribution under certain assumptions. Indeed, the market has been assumed to be skew-t distributed, this strong assumption makes the application of the approach less evident, although the implementation is pretty straightforward for any distribution by Monte Carlo simulation, because Monte Carlo simulation can be applied for almost any distribution and is suitable for any dimension (at least in theory), COP approach can handle a portfolio with any number of risk factors. The second part will be about the Matlab implementation and results analysis. Tags - black-litterman , allocation
56
1, The latest report shows only 3.5% cash on average in mutual funds. This figure matches the all-time low, which occurred in July 2007, the month when the Dow Industrials-plus-Transports combination made its all-time high. But wait. The latest report pertains only through February. In March, the market rose virtually every day, so there is little doubt that the percentage of cash in mutual funds is now at an all-time low, lower than in 2000, lower than in 2007! We will know for sure when the next report comes out in early May. Regardless, the confidence that mutual fund managers and investors express today for a continuation of the uptrend rivals their optimism of 2000 and 2007, times of the two most extreme expressions of stock-market optimism ever. 2, The 10-day moving average of the CBOE Equity Put/Call Ratio has fallen to 0.45, which means that the volume of trading in calls has been more than twice that in puts. So, investors are interested primarily in betting on further rising prices, not falling prices, and thats bearish. The current reading is less than half the level it was thirteen months ago and its lowest level since the all-time peak of stock market optimism from January 1999 to September 2000, the month that the NYSE Composite Index made its orthodox top. The 30-day average stands at 0.50, the lowest reading since October 2000. It took years of relentless rise following the 1987 crash for investors to get that bullish. This time, its taken only 13 months. 3,The VIX, a measure of volatility based on options premiums, has been sitting at its lowest level since May 2008, when wave (2) of ((1)) peaked out and led to a Dow loss of 50% over the next ten months. Low premiums indicate complacency among options writers. The quants who designed the trading systems that blew up in 2008 generally assumed
57
that low volatility meant that the market was safe, so at such times they would advise hedge funds to raise their leverage multiples. But low volatility is actually the opposite, a warning that things are about to change. The fact that the options market gets things backward is a boon to speculators. Whenever options writers are selling options cheap, the market is likely to move in a big way. Combined with the readings on the Equity Put/Call Ratio, puts right now are a bargain. 4,In October 2008 at the bottom of wave 3 of (3) of ((1)), the Investors Intelligence poll of advisors (which has categories of bullish, bearish and neutral), reported that more than half of advisors were bearish. In December 2009, it reported only 15.6% bears. This reading was the lowest percentage since April 1987, 23 years ago! As happens going into every market top, the ratio has moderated a bit, to 18.9% bears. In 1987, the market also rallied four months past the extreme in advisor sentiment. Then it crashed. The bull/bear ratio in October 2008 was 0.4. In the past five months, it has been as high as 3.4. 5,The Daily Sentiment Index, a poll conducted by Trade-Futures.com, reports the percentage of traders who are bullish on the S&P. The reading has been registering highs in the 86-92% range ever since last September. Prior to recent months, the last time the DSI saw even a single days reading at 90% was June 2007. At the March 2009 bottom, only 2% of traders were bullish, so todays readings make quite a contrast in a short period of time. 6,The Dows dividend yield is 2.5%. The only market tops of the past century at which this figure was lower are those of 2000 and 2007, when it was 1.4% and 2.1%, respectively. At the 1929 high, it was 2.9%. 7,The price/earnings ratio, using four-quarter trailing real earnings, has improved tremendously, from 122 to 23. But 23 is in the area of the peak levels of P/E throughout the 20th century. Ratios of 6 or 7 occurred at major stock market bottoms during that time. P/E was infinite during the final quarter of 2008, when E was negative. We will see quite a few quarters of infinite P/E from 2010 to 2017. 8,The Trading Index (TRIN) is a measure of how much volume it takes to move rising stocks vs. falling stocks on the NYSE. The 30-day moving average of daily closing TRIN readings has been sitting at 0.90, the
58
lowest level since June 2007. This means that it has taken a lot of volume to make rising stocks go up vs. making falling stocks go down over the past 30-plus trading days. It means that buyers of rising stocks are expending more money to get the same result that sellers of declining stocks are getting. Usually long periods of low TRIN exhaust buying power. For more market analysis and forecasts from Robert Prechter, download the rest of this 10-page issue of the Elliott Wave Theorist free from Elliott Wave International. Learn more here. Tags - trading
59
those different formats really bring a problem, as I need to match the dates and compare the prices, it is easy to convert a cell format date to what matlab recognizes using cell2mat() and then datenum(), for instance, matlab returns a number 733737 for '25/11/2008', however, how can I compare that with 20081125 then? what I am thinking is: first, convert the cell format to string using cell2mat(), it becomes a string 25/11/2008; second, reformat the string using datestr(,26), it becomes a string 2008/ 11/25; third, remove '/' by using find(b~='/'), it becomes a string 20081125; finally, convert the string to number using str2num(), it is eventually a double number I need 20081125, then I am able to use and match the date from different sources. It sounds lengthy, do you have a better idea? please share with us by leaving a comment, cheers. Stanley suggests to use the following code: datenum(datevec(num2str(dates),'yyyymmdd')), here dates is double number, perfect, it is much better than my method as it allows us not only for date comparison but also for calculation, what's more, it is more efficient. many thanks, stanley. Tags - matlab , excel
60
61
para0 = [0.05, 0.1, 0.1, -0.1, 0.01*rand(1,ncol).*ones(1,ncol)]; [x, fval] = fmincon(@loglik, para0,[],[],[],[],[0.0001,0.0001,0.0001, -1, 0.00001*ones(1,ncol)],[ones(1,length(para0))],[],[],Y, tau, nrow, ncol); para = x; sumll = fval; end flip over to next page... function sumll = loglik(para,Y, tau, nrow, ncol) lculate log likelihood % initialize the parameter for CIR model theta = para(1); kappa = para(2); sigma = para(3); lambda = para(4); %volatility of measurement error sigmai = para(5:end); R = eye(ncol); for i = 1:ncol R(i,i) = sigmai(i)^2; end dt = 1/12; %monthly data initx = theta; initV = sigma^2*theta/(2*kappa); % parameter setting for transition equation mu = theta*(1-exp(-kappa*dt)); F = exp(-kappa*dt); % parameter setting for measurement equation A = zeros(1, ncol); H = A; for i = 1:ncol AffineGamma = sqrt((kappa lambda)^2 2*sigma^2); AffineBeta = 2*(exp(AffineGamma*tau(i))-1)/((AffineGamma kappa lambda)*(exp(AffineGamma*tau(i))-1) 2*AffineGamma); AffineAlpha = 2*kappa*theta/ (sigma^2)*log(2*AffineGamma*exp((AffineGamma kappa lambda)*tau(i)/2)/((AffineGamma kappa lambda)*... (exp(AffineGamma*tau(i))-1) 2*AffineGamma)); A(i) = -AffineAlpha/tau(i); H(i) = AffineBeta/tau(i);
62
end %now recursive steps AdjS = initx; VarS = initV; ll = zeros(nrow,1); %log-likelihood for i = 1:nrow PredS = mu F*AdjS; %predict values for S and Y Q = theta*sigma*sigma*(1-exp(-kappa*dt))^2/(2*kappa) sigma*sigma/ kappa*(exp(-kappa*dt)-exp(-2*kappa*dt))*AdjS; VarS = F*VarS*F' Q; PredY = A H*PredS; PredError = Y(i,:)-PredY; VarY = H'*VarS*H R; InvVarY = inv(VarY); DetY = det(VarY); %updating KalmanGain = VarS*H*InvVarY; AdjS = PredS KalmanGain*PredError'; VarS = VarS*(1-KalmanGain*H'); ll(i) = -(ncol/ 2)*log(2*pi)-0.5*log(DetY)-0.5*PredError*InvVarY*PredError'; end sumll = -sum(ll); end
I also attach the ir.xls file to test the codes, you should get the parameters values as: theta: 0.0613 kappa: 0.2249 sigma: 0.0700 lambda: -0.1110 Click to download Tags - filter
63
64
We have been looking for paid contributors and guest writers, please consider to join us by reading our policy http://www.mathfinance.cn/ looking-for-paid-contributors/ and http://www.mathfinance.cn/postyour-article-on-this-blog/, your support is much appreciated. Have a nice weekends. Tags - quant , blog
65
66
67
or you can search directly by typing a keyword, take a look if you feel useful, http://wikiposit.org/w Tags - data
68
69
For a detailed Kalman filter example in excel, please read the paper "A simplified approach to understanding the kalman filter technique" for detail, I also wrote a sample tutorial file trying to mimic the results but failed, possible reasons are poor performance of solver in excel and the small simulated sample periods. Interested readers can choose to download a Kalman filter toolbox for Matlab. Click to download Tags - filter
70
71
b) Put option A contract between two parties, the writer (seller) and the buyer of the option. The buyer acquires a short position by purchasing the right to sell the underlying instrument to the seller of the option for specified price (the strike price) during a specified period of time. Lets look at the same example discussed for Call option, like you want to buy an put option contract at a strike price of $100 for a given stock. If the current value for the stock is $90/share and you wanted to buy the $100 put option contract you would probably be looking at a price of $10 or $11 in the option price listing. If the stock value doesnt get increased in the period of your put option contract, then you would get a profit of $10/share. But in the other case, where the share value increases beyond $100, say by $10, then you would face a lose of $10/share. And for this put option, it is always advisable to exercise the contract if the current stock value is greater than your contract value. So that you can have a profit, else if you let it expire then you would end up paying the premium to the writer unnecessarily. Future Value From the above example for both the call & put option contracts, you would have got an idea that calculating the future value of the option. Thus in order to understand option pricing, this future value additive must be accounted for in your investment plan. Remember the longer you hold onto an option (call or put), the less valuable is that future value portion. Again, Check Varieties of programming codes on option valuation for implementation. Tags - option
72
73
74
I would stay away Gaussian Copula if I were a risk manager, and you? Download Copula toolbox and other code files at Copula if interested. Tags - var , copula
75
76
Advertise with us
Thank you for your interest in advertising on MathFinance.cn. We have approximately 13,000 unique visitors that view 40,000 pages per month. Engage our valuable demographic of highly educated quantitative research readers through multiple placement options including premium display, buttons and links, email and newsletters, co-registration and lead generation, sponsorships, home page takeovers and other creative advertising solutions. InvestingChannel is one of the fastest growing financial media companies and is our exclusive advertising partner. With InvestingChannels seasoned team of professionals, you can optimize your campaigns to maximize return on investment with the highest level of service. Available ad sizes include 728x90, 300x250, 160x600, 88x31 and many more. To learn more about InvestingChannel at: advertising on MathFinance.cn contact
77
78
these methods in their day to day operations. For more technical posts, please search "Monte Carlo" in this blog. For instance, Variance reduction by antithetic variable. Tags - monte carlo
79
Pricing
Using
Adjusted
Transition
One big issue of pricing barrier option with Binomial tree or other lattice method is its slow convergence rate, the barrier option value converges very slowly as the number of tree or lattice levels increase, often requiring unattainably large computing times for even a modest accuracy. A typical plot of barrier option binomial tree results against its analytic value looks like source from paper Enhanced Numerical Methods for Options with Barriers where the pricing performance is in a sawtooth fashion, with severe periodic spikes that move away from the correct result, which is a nightmare for a researcher because adding more steps doesn't necessarily mean to yield a more accurate answer. The reason for this is that the barrier being used by the tree is generally different from the true barrier value, for example, as demonstrated below, no matter inner barrier or outer barrier is chosen in practice, calculated value will always be smaller or bigger than correct value, where true barrier shall be used.
John Hull presents three approaches for overcoming this problem, namely, positioning nodes on the barriers, adjusting for nodes not lying on barriers, and the adaptive mesh model. Interested readers please refer to chapter 20, from page 467 to 472, the 5th version, Options, futures and other derivatives. Or read another paper in detail "Enhanced Numerical Methods for Options with Barriers" by Emanuel Derman, etc downloadable at http://www.ederman.com/new/docs/gsnumerical_methods.pdf. The way shared today is distinct from the three approaches, unlike traditional methods to ensure convergence through placing the barrier in close proximity to, or directly onto, the nodes of the tree lattice, this method applies a suitable transition probability adjustment, thereafter called Barrier Option Pricing Using Adjusted Transition Probabilities, which exhibits increased convergence to the analytical option price, source from paper Barrier Option Pricing Using Adjusted Transition Probabilities
80
Please read the paper for detail at http://papers.ssrn.com/sol3/ papers.cfm?abstract_id=964623 and check the accompanying C++ codes at http://www.codeproject.com/KB/recipes/ Zeppelin_Barrier_Options1.aspx Tags - barrier , option , binomial
81
82
Binomial Tree
This post is by Bo, a guest author of the math finance blog, unlike biao's technical posts, I will be mainly writing introductory articles, which aims to help beginners have a rough idea, and I will try to link to other technical posts for a better understanding if possible. Binomial options pricing model or BOPM, as it is popularly known is a generalized numerical method that is used for the valuation of options. This method was proposed by Rubinstein, Cox and Ross. This method is popular in the sense that it can be used for variety of conditions, while the other numerical methods have limited use. The main reason why it can be used in varied situations is that it is based on the underlying instrument spread over a period of time rather than a single point of time. It is slower, but much more accurate than any other method. This method traces the evolution of options underlying variable spread over a period of time. This is done by using a binomial tree or binomial lattice. Each node in the binomial tree or lattice represents price of the underlying at a single point of time. The valuation is performed iteratively, i.e., it starts from the final node and goes backwards till it reaches the first node. The value that you will calculate in each node of the binomial tree is the value of the option at that point of time. BOPM follows a three step process. In the first step, which is binomial tree generation, a tree comprised of prices is produced by working forward the date of valuation to expiration. It is assumed that at each step the value of underlying instrument is either moving down or up by a specific factor. The down and up factors are calculated using underlying volatility. The next step is to find the value of option at each final node. The option value which is obtained is called the exercise or intrinsic value. The third step is to find the value of options at earlier nodes, by moving backwards from the final nodes. Check Nine Ways to Implement Binomial Tree Option Pricing for binomial tree implementation.
Tags - binomial
83
84
Mathematics is everywhere
Share a few interesting pics taken by Nikki Graziano, a photographer and a mathematician. Mathematics is everywhere in a mathematician's eyes. Source from http://www.thejunction.de/impulse/2010/03/24/ mathematische-funktionen-fur-jeden-geschmack-0017020
Tags - math
85
(Source from A note on multidimensional sobol sequences) read the paper for detail if interested, http://papers.ssrn.com/sol3/ papers.cfm?abstract_id=1558186 Tags - sobol
86
9:00 a.m. (U.S. EDT)2:00 p.m. (U.S. EDT) 9:00 a.m. (U.S. 8 Apr Digital Signal Processing Using MATLAB EDT)2:00 p.m. (U.S. 2010 EDT) 13 Apr Best Practices for Verification, Validation, 9:00 a.m. (U.S. EDT) 2010 and Test in Model-Based Design 2:00 p.m. (U.S. EDT) 15 Apr MATLAB for Excel Users in 10:00 a.m. (United Kingdom-GMT) 2010 Computational Finance
87
88
(source from Options, futures and other derivatives) Should you are interested into a sample implementation in Matlab of Binomial Tree Option Pricing with Discrete Dividends, take a look at the file http://www.ualberta.ca/dept/aict/bluejay/usr/local/matlab-6.5/ toolbox/finance/finance/binprice.m. Tags - dividend , option
89
If you happen to have some math finance projects for outsourcing, you may consider to give my group and me chance. Although we can't guarantee we are capable of meeting all your requirements, we can try best to insure you a satisfied result as long as we promise to undertake the project, at a low cost. Please email me at abiao @ mathfinance.cn (remove space) for a quote and proposal if you want, cheers. Tags - quant
90
I don't know, considering the high quality of Liar's Pocker, it may be worth reading. I pre-ordered just now at Amazon, if you also want a bed reading book, order one at only $15.09 at Amazon to be released on March 15, 2010. The Big Short: Inside the Doomsday Machine.
91
92
93
2, INCORPORATING VOLATILITY UPDATING INTO THE HISTORICAL SIMULATION METHOD FOR VALUE AT RISK by John Hull and Alan White. The idea is to "adjust" return based on the ratio of current volatility to the past volatility, and use historical simulation on the adjusted returns. Their argument is supposing today's volatility is 20%, while volatility was say, 30%, then past returns obviously exaggerate the current market situation if used directly. They even compare their performance with the first one above and the results are: source from INCORPORATING VOLATILITY UPDATING INTO THE
94
HISTORICAL SIMULATION METHOD FOR VALUE AT RISK page 17. Results are promising, aren't they? few lines of codes are enough for the adjustment. Tags - var
95
96
at
http://www.xamuel.com/inverse-graphing-
97
finally do steps: <- put data to matlab, MLPutmatrix("X",X) <- solve the problem in matlab, MLEvalString("X=sudoku(X)") <- get results from matlab, MLGetMatrix("X","NewX") result is then retrieved immediately to Sudoku Spreadsheet from matlab
98
Straightforward to run your Matlab function in excel, isn't it? alternatively you can use Matlab builder for excel. Click to download Tags - matlab , excel
99
100
Believe it or not, we've only scratched the surface. In his myth-busting, free video "Why Use The Wave Principle," Wayne Gorman presents a total of 40 charts that capture failed fundamental analysis of the world's leading financial markets. Wayne recalls this expression from a famous, Nobel Prize winning economist:
101
"Economic reasoning will be of no value in cases of uncertainty." And he offers this response: "But isn't that what we have in financial markets: cases of uncertainty? We need a different type of reasoning, one that will help us to avoid the pitfalls shown on the previous charts. That's why the Wave Principle is so important. It offers a unique perspective and a market discipline of rules and guidelines that help investors avoid buying at tops and liquidating at bottoms. It helps to explain and understand trends before they happen." The flaw in Economic 101, cause-and-effect theory is one of the easiest things to prove. But it's also one of the hardest things for many investors to accept. Now is the time to do so. Watch the free "Why Use The Wave Principle," video in its entirety today at absolutely no cost. Simply sign on to join the rapidly expanding Club EWI and take advantage of the amazing educational benefits membership has to offer. Tags - report
102
VaR Backtesting
A follow-up of my previous post Value at Risk xls, I was asked why not & how to add a VaR backtesting module in that excel file, well, it is straightforward in principle to do that but since we have to calculate daily VaR for multiple periods in order to do backtesting, I simply didn't add that in an excel for speed reason. The Backtesting framework developed by the Basel committee is the main methodology to judge the performance of VaR model, it typically consists of a periodic comparison of the portfolios or assets daily VaR values with the subsequent daily profit and loss (P&L). Obviously, the ideal model should generate the times of VaR exceeding P&L equal to (1-alpha) multiplied by time periods for backtesting. For a single equity case it is obvious what we need to do is comparing daily VaR results with daily return; but for a portfolio we have to be careful with the trading positions. Basel committee (1996) introduces a three-zone approach, where the green zone means the possibility of erroneously accepting an inaccurate model is low; yellow zone is risk manager should be careful to check the model before take action; red zone means the probability of erroneously rejecting an accurate model is remote. For example, the backtesting three zones boundaries for a sample of 250 observations, source from Basel committee, 1996 look like Backtesting results can therefore be judged by counting the number of exceptions and seeing intuitively which colour zone it falls into. Alternatively you can rely on some statistical testing, for instance, the exception testing by Kupiec (1995). Your final VaR backtesting results will look similar to
by which you are able to tell the performance of your VaR model. certainly there isn't only one way for VaR backtesting, the abovementioned one is an example. Tags - var
103
The author protects the macro code with password, unfortunately. Check http://homepage.hispeed.ch/FinCalc/Index.htm if interested. Tags - risk , excel
104
105
- Hourly trades; - Open an account is free, absolutely No Fees; - Members can choose to withdraw fund as they want; ... Besides simplified trading process, EZTrader members are provided with a complete set of tools to help them optimize their trading. Tools include live financial news, references to financial sites and a wide variety of tradable options, and more. Check EZtrader home page regularly for new promotions that will help you to get the most out of your trades, for example, one promotion is: If you deposit a total of $550.00 today, Monday, February 22nd, 2010, you will receive a bonus of $250.00 (%45)Registration is totally free and there are no commissions to pay ever. To start trading, first go to trading area after sign in, you will find a pool of options to choose Choose an option to trade from the list of available options, then select the type of trade, either CALL or PUT, enter the amount you would like to trade. you can change the trade type from CALL to PUT or vice-versa even after entering an amount, finally click 'Trade' to execute your trade. Simple & new binary options trading platform, start applying your derivative quantitative skills directly at EZTrader. Tags - binary , option , trading
106
Given confidence level and horizon day, the crucial point for quantile estimation is to find a suitable distribution of underlying risk factors, once distribution is known, VaR and ES can be easily calculated by the definition. Mina and Xiao (2001) explains in detail three popular methods to compute VaR: parametric approach (the simplest one is delta-normal), Monte Carlo simulation (MC) and Historical simulation (HS). I am not going to talk in detail how to calculate them as interested reader can refer to the paper or the book by John Hull, a short comparison of the above-mentioned three approaches are listed below, HS easy to implement, no distribution assumption; highly depends on the choice of sample data length, VaR result does not vary often or changes suddenly. MC flexible, almost suitable for any distribution; assumption of risk factors return required, time consuming. Parametric easy to implement, not hard to understand; assumption of risk factors return required, too simple assumption or too exotic to implement. Attached is the ValueatRisk.xls file, where for simplicity, I treat volatility as normal standard deviation, Value at Risk is computed by delta-normal, monte carlo simulation and historical simultion for any single equity, you have to make sure internet is accessible for downloading data from Yahoo. Please keep in mind this file is created for illustration only, use at your own risk.
107
To use it, you need to fill in several parameters including: where you can change stock symbol "IBM" to any stock you want, as long as its trading prices are available at Yahoo finance. Please let me know any error, cheers. Excel: Click to download Macro Code: Click to download Tags - var
108
109
110
investing. We've gathered the writings that expose these 10 statements as market myths in our 33-page eBook, called Market Myths Exposed. They come from two of our premier publications, The Elliott Wave Theorist and The Elliott Wave Financial Forecast, as well as two of our books, Prechter's Perspective and The Wave Principle of Human Social Behavior. The 33-page eBook takes the 10 most dangerous investment myths head on and exposes the truth about each in a way every investor can understand. You will uncover important myths about diversifying your portfolio, the safety of your bank deposits, earnings reports, investment bubbles, inflation and deflation, small stocks, speculation, and more! Protect your financial future and change the way you view your investments forever! Learn more, and get your free eBook here. Tags - elliott , stock
111
Although all for pullbacks, 3-day high/low method did worst with only 0.01 sharpe ratio, compared with the best one the %b strategy 3.34 and buy & hold strategy 0.74. R3 strategy generates 2.67 sharpe ratio high enough for trading but we have to be very careful as the slipage cost due to whipsaw position may kill our profit.
112
Anyway, as the authors mentioned, we must test seriously before applying these strategies to non-ETF assets, especially for breakout type assets.
113
114
by using the information in a few cross-sections of observed traded derivative prices and a time series of underlying asset returns." http://papers.ssrn.com/sol3/papers.cfm?abstract_id=1550135. Tags - friday
115
116
117
The exact computational time depends on the time steps and asset steps, but generally speaking, since Quadrature has a higher order of convergency rate, it is several times faster than finite element, in my case, Quadrature costs me less than ten seconds but finite elements costs me around one minute. PS: the y-axis should be relative error. Tags - quadrature , convertible bond
118
Dolphin in Taiji
This post has nothing to do with quantitative finance, so please skip it if you have no interest at all. A friend of mine, who is an active animal protectionist, asked me if it is possible to embed a video on my blog. I didn't promise at the beginning worrying the video has nothing to do with my topic, but decide to do so after watching it, in addition, today is Sunday, take a rest then. Dolphin is among the most intelligent animals and its often friendly appearance and seemingly playful attitude make it popular, I once read an article saying dolphin is as smart as an average three years kid, however, like many other animal species, it is under increasing human threat, as mentioned in Wikipedia, "In some parts of the world such as Taiji in Japan and the Faroe Islands, dolphins are traditionally considered as food, and killed in harpoon or drive hunts." The video tells us how cruel the fishermen in Taiji are, how the activists hope to save dolphin but fail, a touching story worthy to think about. PS: my friend is glad to add how happy he is after knowing Chinese government imposed a law recently against eatching dog meat in China, from now on it is illegal. A great step. Below is the video, 90 minutes long, it is in English and with Chinese scripts. Tags - dolphin
119
120
Specifically, we address the question whether trading decisions to open or close a position are different in the case in which investors already hold a position than in the case in which they don't.", http://papers.ssrn.com/sol3/papers.cfm?abstract_id=1538760; 6, Optimisation in Financial Engineering , "We discuss the precision with which financial models are handled, in particular optimisation models. We argue that precision is only required to a level that is justified by the overall accuracy of the model. Hence, the required precision should be specifically analysed, so to better appreciate the usefulness and limitations of a model." http://papers.ssrn.com/sol3/ papers.cfm?abstract_id=1547173 Tags - friday
121
122
%read paper by Haug for detail; %dt: dividend time BSprice = blsprice(s,k,r,t,vol,0); AdjS = s-exp(-r*dt)*d; Escrowed = blsprice(AdjS,k,r,t,vol,0); %%%%%%%%%Chriss, 1997%%%%%%%%%% vol1 = vol*s/(s-d*exp(-r*dt)); Chriss = blsprice(AdjS,k,r,t,vol1,0); %%%%%%%%%Haug, 1998%%%%%%%%%% vol2 = sqrt(vol^2*dt vol1^2*(t-dt)/t); OldHaug = blsprice(AdjS,k,r,t,vol2,0); %%%%%%%%Bos et al. (2003)%%%%%%%%%% lns = log(s); lnk = log((k d*exp(-r*dt))*exp(-r*t)); z1 = (lns-lnk)/(vol*sqrt(t)) vol*sqrt(t)/2; z2 = z1 vol*sqrt(t)/2; vol3 = sqrt(vol^2 vol*sqrt(pi/(2*t))*(4*exp(z1^2/2-lns)*d*exp(-r*dt)*... (normcdf(z1)-normcdf(z1-vol*dt/sqrt(t))) exp(z2^2/2-2*lns)*d^2*... exp(-r*2*dt)*(normcdf(z2)-normcdf(z2-2*vol*dt/sqrt(t))))); Bos = blsprice(AdjS,k,r,t,vol3,0); %%%%%%%%%Haug, 2003%%%%%%%%%%%%%%% NewHaug = exp(-r*dt)*(quad(@(x)blsprice(x-d,k,r,tdt,vol,0).*lognpdf(x,lns (r-0.5*vol^2)*dt,vol*sqrt(dt)), d, k d)... quad(@(x)blsprice(x-d,k,r,t-dt,vol,0).*lognpdf(x,lns (r-0.5*vol^2)*dt,vol*sqrt(dt)), k d, 20*s)); callprice = [BSprice, Escrowed, Chriss, OldHaug, Bos, NewHaug];
For example, the results of a $7 dividend after 0.5 year are (DiscreteDividend(100, 100,0.06,1,0.3,7,0.5)): 14.7171 10.6932 11.5001 11.1039 11.0781 11.1062, respectively. Reading the original paper Back to Basics: a new approach to the discrete dividend problem if interested, http://www.nccr-finrisk.uzh.ch/media/ pdf/ODD.pdf, or the book The Complete Guide to Option Pricing Formulas by Haug for more detail. Tags - dividend , option
123
On the Brink: Inside the Race to Stop the Collapse of the Global Financial System
Henry Merritt Paulson, Seventy-five men served as Treasury Secretary of the United States, blurted out when he learned U.K.'s Financial Service Authority was reluctant to approve a prebankruptcy deal for Barclays PLC to acquire Lehman, "The British screwed us." This was revealed in Paulson's new book "On the Brink: Inside the Race to Stop the Collapse of the Global Financial System", where the author tell us the key decisions that had to be made with lightning speed under urgent market conditions, about Lehman Brothers, AIG, and other financial institutions. Selected author's note from the book On the Brink: Inside the Race to Stop the Collapse of the Global Financial System: Quotation The pace of events during the financial crisis of 2008 was truly breathtaking. In this book, I have done my best to describe my actions and the thinking behind them during that time, and to convey the breakneck speed at which events were happening all around us. I believe the most important part of this story is the way Ben Bernanke, Tim Geithner, and I worked as a team through the worst financial crisis since the Great Depression. There can't be many other examples of economic leaders managing a crisis who had as much trust in one another as we did. Our partnership proved to be an enormous asset during an incredibly difficult period. But at the same time, this is my story, and as hard as I have tried to reflect the contributions made by everyone involved, it is primarily about my work and that of my talented and dedicated team at Treasury. --Henry M. Paulson
Tags - book
124
125
126
127
The Quants: How a New Breed of Math Whizzes Conquered Wall Street and Nearly Destroyed It
Bought a book just now recommended by a friend of mine, The Quants: How a New Breed of Math Whizzes Conquered Wall Street and Nearly Destroyed It, what a looong name. The book is written by a Wall Street Journal reporter Scott Patterson and has got brilliant editorial reviews, for instance: Quotation Scott Patterson has the ability to see things you and I dont notice. In The Quants he does an admirable job of debunking the myths of black box traders and provides a very entertaining narrative in the process. --Nassim Nicholas Taleb Quotation "The Quants will keep hedge fund managers on the edge of their Aeron chairs, while the rest of us read in horror about their greed and their impact on the wider economy. A gripping tale right until the last page...but I fear this is perhaps not yet the end of the story." --Paul Wilmott
Below is a short video of an interview with the author, where Scott Patterson explains a group called "The Quants" developed complex systems to trade securities such as mortgage derivatives, which were at the heart of the crisis.
Sounds like a good book for bed reading, order one if you also fancy it, The Quants: How a New Breed of Math Whizzes Conquered Wall Street and Nearly Destroyed It
Tags - quant
128
So this weekend I'm gonna talk few more words about Elliott Wave Analysis, what is elliott wave principle then? as described on wikipedia, "it is a detailed description of how financial markets behave. The description reveals that mass psychology swings from pessimism to optimism and back in a natural sequence, creating specific wave patterns in price movements." Therefore it is a type of investment discipline combining technical analysis with behavioral finance that attempts to explain and predict the market trend (of stock, forex, etc.). Unlike those quantitative techniques we often hear or apply, Elliott Wave Analysis assumes it is unnecessary to be based on past price charts to decide where a market is in its wave patten, which is instead decided by investors' psychology, therefore Elliott Wave Analysis has got criticism, for example, quantitative researchers tend to blame it is just an art where the subjective judgement is more crucial than the objective, replicable verdict of the numbers. Anyway, it is not bad at all to know the non-quantitative trading world, if you are interested, I recommend you to watch the following video "How to Use Elliott Wave Analysis to Boost Your Forex Trading" and attend the free courses then.
Or watch this classic video from Elliott Wave International's Chief Currency Strategist, Jim Martens, to see how useful the basics of Elliott wave analysiscan be. Jim explains how the same basic pattern that R.N. Elliott discovered back in the 1930s is often all you need to make informed market forecasts. Then access Jim Marten's intraday and endof-day Forex forecasts, completely free from Elliott Wave International. Get your free Forex forecasts.
129
Tags - wave, trading, elliott Watch this full $79 course, FREE. Click Here!
130
131
132
133
Access Robert Prechter's 50-page report "Popular Culture and the Stock Market" FREE! Tags - stock , elliott
134
135
136
137
implementation of strategy combination, factor mimicking, hedging, and stock-specific bets in a unified framework." http://papers.ssrn.com/ sol3/papers.cfm?abstract_id=1347663 4, Homogeneous Volatility Bridge Estimators, "We present a theory of homogeneous volatility bridge estimators for log-price stochastic processes. The main tool of our theory is the parsimonious encoding of the information contained in the open, high and low prices of incomplete bridge, corresponding to given log-price stochastic process, and in its close value, for a given time interval. The efficiency of the new proposed estimators is favorably compared with that of the Garman-Klass and Parkinson estimators." http://papers.ssrn.com/sol3/ papers.cfm?abstract_id=1523225 5, A PDE Pricing Framework for Cross-Currency Interest Rate Derivatives, "We propose a general framework for efficient pricing via a Partial Differential Equation (PDE) approach of cross-currency interest rate derivatives under the Hull-White model. In particular, we focus on pricing long-dated foreign exchange (FX) interest rate hybrids, namely Power Reverse Dual Currency (PRDC) swaps with Bermudan cancelable features." http://papers.ssrn.com/sol3/papers.cfm?abstract_id=1502302 Have a nice weekend. Tags - friday
138
For example, to find pdf documents about "Asian option", simply type "Asian option" in the form and click the PDF icon Similarly each icon stands for one filter:
Searching results will be openned in a new browser window in Google as what I did was creating a page to filter results. You can also choose to search books in Amazon below. PS: the page can also be used for keywords nothing to do with Quant staff as long as google catches them. Anyway, hope you find it somehow useful: Google Quant Staff, bookmark if you like. Tags - google , quant
139
140
x1 = Vegak*log(k2/k)*log(k3/k)/(Vega1*log(k2/k1)*log(k3/k1)); x3 = Vegak*log(k/k1)*log(k/k2)/(Vega3*log(k3/k1)*log(k3/k2)); price = blsprice(s,k,r,t,sigma2,rf) x1*(blsprice(s,k1,r,t,sigma1,rf)... -blsprice(s,k1,r,t,sigma2,rf)) x3*(blsprice(s,k3,r,t,sigma3,rf)... -blsprice(s,k3,r,t,sigma2,rf)); where Vega is a function to compute vega under black scholes formula function VegaValue = Vega(s,k,r,t,sigma,rf) d1 = (log(s/k) (r-rf 0.5*sigma^2)*t)/(sigma*sqrt(t)); VegaValue = s*exp(-rf*t)*sqrt(t)*normpdf(d1,0,1);
Implied volatilities curve is therefore easily achieved by inverting VV pricing model. Interested ppl please refer to http://www.risk.net/risk/ technical-paper/1506580/the-vanna-volga-method-implied-volatilities or an advanced one www.mathfinance.de/wystup/papers/ wystup_vannavolga_eqf.pdf Tags - volatility
141
142
143
144
I know Elance several weeks ago refered by a friend of mine, who is a software engineer and gets used to do SOHO jobs, "why not try to be a freelancer since you now have enough self-controlled time?", that's the first reaction he had, then I knew the site and started to earn spare money. Basically Elance is a portal where companies find, hire, manage and pay contractors online, and is a place independent professionals to meet clients and get paid for delivering great results. I personally found several great projects already, not bad payment plus opportunities to practice our quant knowledge, for example, two randomly chosen projects about derivative: one is forex trading strategy
and the other one is about option portfolio profit and loss calculation
If you are interested, just Register Free, Looking for work? Sign up at Elance and search over 30,000 jobs today. and Bid on the Project, once your proposal is selected, you are in and start to do the project. The other site I personally find useful is first tutor, a site allowing people to register as a tutor and to teach part time. Anyway, earning by doing a job I like is always cool. Tags - quant
145
146
147
You can find out more about both events on our website, http://www.rmetrics.org. We would like to invite you to take part in the conference, and we are now accepting submissions; please send your one-page abstracts to submissions [at] rmetrics.org. The submission deadline is February 10, 2010. We look forward to seeing you in Singapore.
Wishing you merry Christmas and a happy new year, The organizing committee: Diethelm Wuertz Juri Hinz Mahendra Mehta David Scott Tags - conference , r
148
its
website
at
Tags - derivative
149
Apply for interested positions free and help us expand the board by posting your jobs, thanks. Tags - quant , job
150
Still Time to Access Exclusive Content from the Computational Finance Virtual Conference. Even if you did not register for the conference, there is still time for you to view the conference presentations, research products on the exhibit floor, and see why hundreds of your peers from around the world attended the Computational Finance Virtual Conference. Conference Highlights Keynote Speakers Managing Diversification [Dr. Attilio Meucci, Head of Research Bloomberg ALPHA Portfolio Analytics and Risk] Dr. Attilio Meucci, Head of Research Bloomberg ALPHA Portfolio Analytics and Risk Rigorous Intraday Trading: Best Quantitative Practices to Minimize Your Tracking Error [Charles-Albert LeHalle Head of Quantitative Research Credit Agricole Chevreux] Charles-Albert LeHalle Head of Quantitative Research Credit Agricole Chevreux Who Should Attend Traders Economists Actuaries Risk managers Portfolio managers Quants See exclusive keynotes by Dr. Attilio Meucci from Bloomberg; and Dr. Charles LeHalle from Credit Agricole Chevreux. View conference presentations by MathWorks product experts, research the latest information on MATLAB and several products designed specifically for
151
the financial industry. Featured Conference Presentations: Insuring Our Future: Projection Systems, Liabilities, and Assets Managing Diversification When Will the Recession End? Multivariate Time-Series in Econometrics Rigorous Intraday Trading: Best Quantitative Practices to Minimize Your Tracking Error Knowing Your Risk: Credit Value at Risk Calculation After a simple free registration you will be led to a page where visual conference is being hold, where you can watch conference video at conference hall, download resource at resource center, chat with representatives at exhibition hall, have a casual talk with other people at networking lounge, etc.
152
153
154
155
156
157
apply directly by clicking "Apply Online" at the lower side of page and sending their CVs to the recruiter's email box, otherwise by visiting the company's website with URL below the job title
If you have any questions then please don't hesitate to contact us. Tags - quant , job
158
Tags - twitter
159
Tags - cir
160
NASDAQ Stock Market A media file here. Please view this entry in browsers.
Nightly Business Report: A media file here. Please view this entry in browsers.
Weekly Market Monitor A media file here. Please view this entry in browsers.
Weekly Street Critique A media file here. Please view this entry in browsers.
Don't stop here! Get Jim Marten's intraday and end-of-day Forex forecasts FREE through February 10. Get your free Forex forecasts. Tags - tv , online
161
162
u = repmat(u,1,NoTau 1); inx = find(x>bar,1,'first'); u(:,1) = 0; %up and out when j=tau f = zeros(N,1); % start timestepping for m = 1:M lastu = u; % compute right hand side for j = 2:NoTau 1 f = C*[lastu(2:inx-2,NoTau 1);lastu(inx-1:end-1,j-1)]; low using tau=0, above using tau=tau 1; u(:,j) = zeros(N 2,1); % solve the linear system u(2:N 1,j) = B\f; end u(inx-1,2:NoTau) = u(inx-1,NoTau 1);%reset value at barrier point for parisian lastu = u; end Plots of the Parisian option and its delta W.R.T stock prices and barrier Tau.
163
164
165
average daily volume are not allowed. # You can only sell short if your buying power exceeds the size of the short position. # Your portfolio account is a margin account with a 100% initial margin requirement (total positions cannot exceed portfolio value). Ready? Join The Investing Social Network and Begin Online Stock Practice. The other portal is http://www.cofool.com/, which is similar except the site is in Chinese and special trading rules of Chinese stock market are applied. Have fun practice stock trading. Tags - trading
166
RQuantlib
Quantlib is a free library for modeling, trading, and risk management in real-life providing a comprehensive software framework for quantitative finance, it is written in C++, which might be inconvenient for some users. JQuantLib aiming at Java-fans is naturally developed, correspondently, RQuantlib connects GNU R software with QuantLib. The installation is straintforward, I tried it on my Windows, the source code is at http://cran.r-project.org/web/packages/RQuantLib/ index.html, which is self-contained and does not even require a QuantLib (or Boost) installation. Nothing more to say, following the process, users are able to use the library immediately. So far the function and option types supported by RQuantlib are limited, vanilla and a few popular exotic options, for example, American option, Asian option, Barrier, Bermudan, Binary option, as well as a range of fixed-income functions, mainly on Convertible bond valuation. Hopefully it will grow quickly. Detailed reference manual is also available at http://cran.r-project.org/ web/packages/RQuantLib/index.html. Tags - quantlib
167
168
169
virtually never crashes. Amelia II was developed based on R language, so users have to install R before running it, installation of Amelia is staightforward: download and run the exe file, that's it. For me, the beauty of Amelia II is its friendly interface, I don't even need to run R software myself. Double clicking Amelia II shows the following as you can see from the input and output menus, it supports csv files, simply importing a csv file with missing data returns a csv with imputed data, amazing, isn't it? Downloading the software http://gking.harvard.edu/amelia/. Tags - missing-data and help documents at
170
2, you prefer to download historical stock data from Yahoo, dividend info for each stock and adjust the data yourself instead of using this script. Fine, if you are happy. 3, you have option to download daily, weekly or monthly data using this script, while there is no such an input using http://ichart.yahoo.com/ table.csv?s=symbol. This is another reason I wrote it, please correct me if I am wrong. How to use the script? by typing the url http://www.mathfinance.cn/ yahoo-chinese-stockquotes.php?stockNo=yourstock&exchange=ss&dateType=yourdate, here yourstock is the symbol of stock to download, ss means shanghai, and sz means shenzhen stock exchange, yourdate has three types: day, week and month for daily, weekly and monthly data, respectively. For instance, http://www.mathfinance.cn/yahoo-chinese-stock-
171
quotes.php?stockNo=600030&exchange=ss&dateType=day will pop up a window asking you to save or open the data in csv. Leave a message here for any error or share with others if it is helpful, thanks. All stock data is from Yahoo finance China, please obey the policy of Yahoo finance. Tags - yahoo , data
172
Matlab codes can be downloaded at http://www.rotman.utoronto.ca/ ~jcduan/mainfram.html, several other programming files can be also found at the page, for example, Co-integration option pricing model, GARCH option pricing model and its application to volatility smile, Linear and non-linear asymmetric GARCH models, Estimating exponential affine term structure models, and Maximum likelihood estimation method for Merton's deposit insurance pricing model. Tags - garch , volatility
173
Tags - jim-cramer
174
175
176
Here I arbitrarily set ymax=3, which is enough for this simple example, the result for a European call option with strike price 9, stock price 10, volatility 20%, risk free rate 2%, dividend 1%, time to maturity 2 years is 1.71429100893328, with 0.005681 seconds elapsed time using my humble laptop, in contrast with the embedded Black Scholes matlab function value 1.71429100824415, and 100 time steps binomial tree value 1.71422035929822. QUAD performs quite good, isn't it? The exotic option pricing is left for further experiment, have a nice evening.
177
PS: i was seriously drunken last weekend, my poor stomach. Tags - quadrature , integral
178
SOCR of UCLA
Statistics Online Computational Resource (SOCR) is a great application built by University of California, Los Angeles (UCLA). What is SOCR? Quotation The aims of the Statistics Online Computational Resource (SOCR) are to design, validate and freely disseminate knowledge. Our Resource specifically provides portable online aids for probability and statistics education, technology based instruction and statistical computing. SOCR tools and resources include a repository of interactive applets, computational and graphing tools, instructional and course materials. What are the main SOCR Components? Quotation The core SOCR educational and computational components include: Distributions (interactive graphs and calculators), Experiments (virtual computer-generated analogs of popular games and processes), Analyses (collection of common web-accessible tools for statistical data analysis), Games (interfaces and simulations to real-life processes), Modeler (tools for distribution, polynomial and spectral model-fitting and simulation), Graphs, Plots and Charts (comprehensive web-based tools for exploratory data analysis), Additional Tools (other statistical tools and resources), SOCR Wiki (collaborative Wiki resource), Educational Materials and Hands-on Activities (varieties of SOCR educational materials), SOCR Statistical Consulting and Statistical Computing Libraries.
As its name suggests, SOCR is mainly for people learning statistics, for example, to fit a certain probability, to draw density graph of a selected distribution, etc. There are also limited financial applications as well,
Anyway, sharing it just in case some ppl need a portal to learn statistics. http://www.socr.ucla.edu/SOCR.html Tags - statistics
179
180
Volatility Breakouts: m = size(price,1); pos=zeros(m,1); for i = 2:m %put here the way to calculate variance C UpperTrigger = price(i-1) multiplier*sqrt(C); LowerTrigger = price(i-1)-multiplier*sqrt(C);
181
stochastic indicator: stosc = stochosc(highp, lowp, closep, kperiod, dperiod); %embedded Matlab function m = size(highp,1); pos=zeros(m,1); inx1 = find(stosc(:,1)>=30); inx2 = find(stosc(:,1)>=stosc(:,2)); pos(intersect(inx1,inx2)) = 1; inx1 = find(stosc(:,1)<=80); inx2 = find(stosc(:,1)<=stosc(:,2)); pos(intersect(inx1,inx2)) = -1;
Divergence Index: %divergence index strategy, m is long momentum period, n is for short longmom = tsmom(price,m); shortmom = tsmom(price,n); mm = size(price,1); pos=zeros(mm,1); DI = longmom.*shortmom./var(diff(price)); inx1 = find(DI<-8); inx2 = find(longmom<0); inx3 = find(longmom>0); pos(intersect(inx1,inx2))=-1; pos(intersect(inx1,inx3))=1;
Moving Average Confluence Method: % p - *price* data % N - number of points to generate signal pos=zeros(size(p,1),1); macs = zeros(size(p,1),20); for i=1:20 j=i*4;
182
[lead,lag]= movavg(p,i,j,'e'); lead = [nan(i-1,1); lead]; %to avoid dimension mismatch lag = [nan(j-1,1); lag]; macs(lead>lag,i) = 5; end macssum = sum(macs,2); macssum(1:80) = 50; %first 80 observations with zero position pos(macssum>=N)=1; pos(macssum<=(100-N))=-1; There are other strategies left to you to backtest the effectiveness of technical analysis, for example, Kestners Moving Average System, Second Order Breakout, MACD Histogram Retracement, Normalized Envelope Indicator, etc. Have fun. Tags - trading , strategy
183
184
Currently FERC has the following sections: Books, Daily news, Job, Journal, Quant answer, Software, Trading and Video. Simply from the name we can guess the content under each section, for example, daily news is about some recent interesting news might be worth reading; trading is the latest model and technique written by well-known quant trader, etc. There are subsections under several categories, Job consists of UK, US, Asia and world, Journal includes Journal of finance, Journal of financial economics, Mathematical finance, etc., where people can track the latest publications for each selected Journal. Overall I find FERC makes my daily reading easier, check Financial Engineering Resource Center (FERC) if you are curious as well. Tags - financial-engineering
185
186
187
188
189
and rigorous backtesting. through whch the ser ma visually assss wether the relatinship is valid throughut historical time. * The relationshi s extended int the future to ake a forecast, by te nuber of days the ser hs set on th slider during training. * There is no buy/sell indicator: the reliability of the forecast depends on th user' visual verification f te math between the to grphs otained during backtesting, and the his estimation of the likelihood that te mathematical relationship which has ben found will continue to hold in the future. Downloading or trying online through http://www.goldengem.co.uk/ or the one I introduced before http://www.mathfinance.cn/neuralnetwork-source-code/ Tags - neural-network
190
To install the application, just search "bond calculator" at the Market section of your gphone. Tags - calculator , gphone
191
192
193
194
195
FX option calculator
Another FX online option calculator by MathFinance covers Vanilla option, digital option, touch options (one touch, no touch, double one touch, double no touch), barrier option (single barrer, double barrier) and Black-Scholes Implied Volatility Calculator. For detail about options description and calculator please visit http://www.mathfinance.com/tools/calculator/index.php Tags - calculator , fx
196
197
198
199
200
201
202
203
204
205
Matlab toolbox
Dozens of Matlab toolboxes(packages) for downloading, including the following classifications: Audio - Astronomy - BiomedicalInformatics - Chemometrics - Chaos Chemistry - Coding - Control - Communications - Engineering - Data Mining - Excel - FEM - Fuzzy - Finance - GAs - Graph - Graphics Images - ICA - Kernel - Markov - Medical - MIDI - Misc. - MPI - NNets Oceanography - Optimization - Plot - Signal Processing - Optimization Statistics - SVM - Web - etc ... Recommended matlab toolboxes: Kernel Density Estimation Toolbox http://ssg.mit.edu/~ihler/code/ BOOTSTRAP MATLAB TOOLBOX http://www.csp.curtin.edu.au/downloads/bootstrap_toolbox.html CompEcon Toolbox for Matlab http://www4.ncsu.edu/~pfackler/compecon/toolbox.html Random Neural Networks http://www.cs.ucf.edu/~ahossam/rnnsimv2/ Logistic regression http://www.spatial-econometrics.com/ ARfit: A Matlab package for the estimation of parameters and eigenmodes of multivariate autoregressive models http://www.gps.caltech.edu/~tapio/arfit/ Time Series Analysis http://www.dpmi.tu-graz.ac.at/~schloegl/matlab/tsa/ Interested ppl may download more at http://www.tech.plym.ac.uk/ spmc/links/matlab/matlab_toolbox.html Tags - matlab , toolbox
206
207
208
209
210
211
CreditMetrics spreadsheet
CreditMetrics is a framework for measuring credit risk of portfolios of traditional credit investments (for example, loans, commitments to lend, financial letters of credit), fixed income products, and market-driven instruments subject to counterparty default (swaps, forwards, etc.). It is a lot more complex than RiskMetrics, and thus requires a deliberate inspection. Actually, within the CreditMetrics framework, users are confronted with a mixture of choices. For instance, CreditMetrics grants users to follow one of four different approaches to calculating correlation among several credit types-historical data, bond spreads, equity correlations or consistent constants. Here is an Excel 7.0 spreadsheet demonstrating how to use CreditMetrics to compute credit risk of a portfolio, technical document is free to download at http://www.ma.hw.ac.uk/~mcneil/F79CR/ CMTD1.pdf. Functions for calculating the CreditMetrics risk model in R are at: http://cran.r-project.org/web/packages/CreditMetrics/ index.html Tags - creditmetrics , spreadsheet
212
213
214
215
here are the paper and matlab codes, you might feel in the end binomial tree implemention is not such easy . Enjoy. Tags - binomial
216
So far so good, but it seems the products Wolfram Alpha covers are limited, when I try to type Barrier option or Asian option, two simple exotic options, it says "Wolfram|Alpha isn't sure what to do with your input." there is no API users are able to add their own formulars, either. In brief, Wolfram alpha is a big step towards intelligent search engine, nevertheless, as it broadcasts at its main page: it is the first step in an ambitious, long-term project to make all systematic knowledge immediately computable by anyone.
217
218
219
220
221
222
223
224
Apr 28th from twitterfeed # Why do only headhunters contact me? :)9:34 AM Apr 27th from TwitterRide # @cosbeta agree.7:34 AM Apr 27th from TwitterRide in reply to cosbeta # Terrible monday morning. Coupled ewma makes me dizzy.6:39 AM Apr 27th from TwitterRide # think about my future over several bottles of beer8:36 AM Apr 26th from web # prepare Tier 1 general5:56 AM Apr 26th from TwitterRide # finally finished exam, henghenghahie10:57 AM Apr 25th from TwitterRide # got lost, finally am here. waiting outside of classroom.7:13 AM Apr 25th from TwitterRide # on the train to univ of greenwitch for visa english test, have to leave uk if fails. bless myself. Tags - twitter
225
226
The software supports the following types of options at the moment. Vanilla Options (using standard Black-Scholes formulae). Binary (Cash-or-nothing) Options (using standard analytical formulae). Asian Options (using Monte Carlo simulation). Barrier Options (using Monte Carlo simulation). Lookback Options (using Monte Carlo simulation). ... download at products_options_calculator.aspx Tags - calculator , exotic , option http://www.mgsoft.ru/en/
227
228
229
230
231
232
233
Day(EndDate) & "&f=" & Year(EndDate) & "&g=" & Range("E3") & "&q=q&y=0&z=" & _ Symbol & "&x=.csv" Range("b5") = qurl QueryQuote: With ActiveSheet.QueryTables.Add(Connection:="URL;" & qurl, Destination:=DataSheet.Range("C7")) .BackgroundQuery = True .TablesOnlyFromHTML = False .Refresh BackgroundQuery:=False .SaveData = True End With Range("C7").CurrentRegion.TextToColumns Destination:=Range("C7"), DataType:=xlDelimited, _ TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _ Semicolon:=False, Comma:=True, Space:=False, other:=False Range(Range("C7"), Range("C7").End(xlDown)).NumberFormat = "mmm d/yy" Range(Range("D7"), Range("G7").End(xlDown)).NumberFormat = "0.00" Range(Range("H7"), Range("H7").End(xlDown)).NumberFormat = "0,000" Range(Range("I7"), Range("I7").End(xlDown)).NumberFormat = "0.00" End Sub
In Matlab there is build-in function named "fetch" for requesting data from Yahoo! data servers. Tags - download , data
234
235
Managing Diversification
Needless to say, diversification plays a pivotal role in investment, not only for risk management, but for return generation. Attilio Meucci and his colleagues have another wonderful paper on managing diversification: Quotation We propose a unified, fully general methodology to analyze and act on diversification in any environment, including long-short trades in highly correlated markets. First, we build the diversification distribution, i.e. the distribution of the uncorrelated bets in the portfolio that are consistent with the portfolio constraints. Next, we summarize the wealth of information provided by the diversification distribution into one single diversification index, the effective number of bets, based on the entropy of the diversification distribution. Then, we introduce the mean-diversification efficient frontier, a diversification approach to portfolio optimization. Finally, we describe how to perform meandiversification optimization in practice in the presence of transaction and market impact costs, by only trading a few optimally chosen securities.
http://www.mathworks.com/matlabcentral/
236
237
After you are lucky enough to get an admission from one of these Top programs, you might wonder how to arrange money for enrolling in a graduate school? Is money a real concern for you? Getting an admission to a graduate is not an easy job but the big cheese is to collect money to pay tuition. All students would be pleased to recognise that state and private lenders offer awards and scholarships for you. It doesn't matter whether you have just finished undergraduate level or have been working for some years. The scholarships are available almost for all but standards changes within financial institutions. Some lenders award on merit basis with a proved track record in undergraduate school and some grants are provided on the basis of the amount required for the full graduate school degree program. To apply for a scholarship is not that easy as it looks to be. one source to search and apply for a scholarship I have ever tried is Find scholarships today at ScholarshipExperts.com providing US & international students with customized scholarship info!
238
, should you are interested, please take a try. Good luck to all of you (including me) for job hunting or graduate school application. Enjoy life. Tags - scholarship , mfe
239
He is a such an important person to my quant-related life, his book Introduction to the Mathematics Of Financial Derivatives is so clear and easy to understand for anybody without any stochastic background, which helped me to work through my first master thesis at 2004; and his another book Principles of Financial Engineering is almost a mustowned one... Silent Salute! Tags - salih-neftci
240
To download, either search "Binary Option" on Gphone, or simply go to the author's blog http://jwdevg1.blogspot.com/2009/04/binary-optioncalculator-published.html Tags - gphone , calculator , binary , option
241
242
243
244
Finally, Happy easter day to all of you, while I will have to stay at home preparing interview
Tags - gmm
245
246
247
Allan variance
Long term memory has frequently been observed in time series. Statistical theory for long term memory stochastic processes is largely different from the standard time series analysis, which assumes short term memory. The Allen variance is a particular measure of variability developed for long term memory processes. Taken from Wikipedia, "The Allan variance, named after David W. Allan, is a measurement of stability in clocks and oscillators. It is also known as the two-sample variance. It is defined as one half of the time average of the squares of the differences between successive readings of the fractional frequency error sampled over the sampling period." I am not quite convinced how to use Allan variance for stock returns, that is, given stock return time series, can we better estimate its long term variance by Allan variance? any idea? Allan variance Matlab code is easy to write and can also be downloaded at: http://www.alamath.com/ index.php?option=com_content&task=view&id=19&Itemid=31
Tags - variance
248
249
250
251
found
http://www.flickr.com/search/
Tags - protest
252
MFE toolbox
Oxford MFE package was shared there, here is a new MFE Matlab toolbox accompanying the book "Modeling and Forecasting Electricity Loads and Prices: A Statistical Approach", which is grouped into the following seven categories: 1. Time series, 2. Distributions, 3. Tests and goodness-of-fit functions, 4. Markov regime switching (MRS) models, 5. GUI functions, 6. Demos, 7. Data files. Selected functions are: armaacvf - Autocovariance function of an ARMA process. average - Weighted average. decompB - Moving average with rolling volatility daily data decomposition. rollingvol - Annual rolling volatility. empcdf - Empirical cumulative distribution function (cdf). hypest - Estimate parameters of the hyperbolic distribution. nigcdf - NIG cumulative distribution function (cdf). nigest - Estimate parameters of the NIG distribution. nigloglik - NIG log-likelihood function. nigpdf - NIG probability density function (pdf). stabcdf - (Alpha-)stable cumulative distribution function (cdf). stabcull - Quantile parameter estimates of a stable distribution. stabreg - Regression parameter estimates of a stable distribution. edftests - Empirical distribution function (edf) goodness-of-fit statistics (Kolmogorov and Anderson-Darling). Downloading the toolbox at: http://www.im.pwr.wroc.pl/~rweron/ MFE.html More about the book at: http://www.riskey.cn/2009/04/modeling-andforecasting-electricity-loads-and-prices-a-statistical-approach-the-wileyfinance-series-hardcover/ Tags - mfe , matlab , toolbox
253
254
255
256
257
258
VIX calculation
CBOE Volatility Index, VIX, was originally designed to measure the markets expectation of 30-day volatility implied by at-the-money S&P 100 Index (OEX) option prices. Now VIX is used to reflect a new way to measure expected volatility, one that continues to be widely used by financial theorists, risk managers and volatility traders alike. The new VIX is based on the S&P 500 Index (SPX), the core index for U.S. equities, and estimates expected volatility by averaging the weighted prices of SPX puts and calls over a wide range of strike prices. By supplying a script for replicating volatility exposure with a portfolio of SPX options, this new methodology transformed VIX from an abstract concept into a practical standard for trading and hedging volatility. Introduced by this paper http://www.cboe.com/micro/vix/ vixwhite.pdf, VIX calculation is done step-by step as: 1), Select the options to be used in the VIX calculation; 2), Calculate volatility for both near-term and next-term options; 3), Calculate the 30-day weighted average of variance, then take the square root of that value and multiply by 100 to get VIX. Matlab code: http://docs.google.com/Doc?id=ddb2j6dw_12fjk57bfx Tags - volatility , vix
259
260
261
262
263
3.1 Stationary Vector Autoregression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 3.1.1 Vector Autoregression estimation: vectorar . . . . . . . . . . . . . . . . . . . . . . . 43 3.1.2 Granger Causality Testing: grangercause . . . . . . . . . . . . . . . . . . . . . . . . 50 3.1.3 Impulse Response function calculation: impulseresponse . . . . . . . . . . . . . . 53 4 Volatility Modeling 57 4.1 GARCH Model Estimation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 4.1.1 ARCH/GARCH/GJR-GARCH/TARCH/AVGARCH/ZARCH Estimation: tarch . . . . . . 57 4.1.2 Some behind the scenes choices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 4.1.3 EGARCH Estimation: egarch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 4.1.4 APARCH Estimation: aparch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66 5 Density Estimation 71 5.1 Kernel Density Estimation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71 Code and documention are available http://www.kevinsheppard.com/wiki/MFE_Toolbox Tags - garch at:
264
Quant salary
Hutson has published its quant salary survey results in Asian market, http://china.hudson.com/documents/Hudson-Asia-Banking-FinancialServices-Salary-Information.pdf, focusing on Banking and Financial services sector. The figure looks not bad at all, given the terrible market of 2008. I have to say for many cases the quant salary does not mean the exact number the quant get, especially in China, other income exceeding salary is pretty possible. I also had a survey for quant salary in mainland, China, results are shown below (basic salary + bonus, about 1~3 years work experience in Chinese Yuan): number percentage of voters 50K ~ 80K 11.4% 80K ~ 100K 7.89% 100K ~ 120K 5.26% 120K ~ 150K 22.81% 150K ~ 200K 7.02% 200K ~ 300K 7.89% >300K 37.72% Considering the average annual salary for Chinese fresh master graduates is about 60K, quant salary is exicting, isn't it? Tags - salary
265
Video lectures
Just share with you guys two free online video lecture sites I have recently used, both time- and cost- saving, isn't it? enjoy. http://videolectures.net/Top/Computer_Science/Machine_Learning/ http://videolectures.net/ Tags - video
266
A scatter plot of the return of S&P 500 index and that of its implied volatility difference series is shown above, clearly the dependence is stronger in left-up corner than right-down corner. Interested reader shall refer to the following papers and Matlab codes for detail: Modelling Asymmetric Exchange Rate Dependence, 2006, International Economic Review, 47(2), 527-556. Paper (PDF), Abstract (HTML), Slides June01 (PDF), Code (MATLAB) -- This paper was previously circulated as Modelling Time-Varying Exchange Rate Dependence Using the Conditional Copula, University of California, San Diego, Discussion Paper 01-09. -- The Joe-Clayton and symmetrised Joe-Clayton copula density functions can be found here (PDF). Matlab functions for these can be found here. http://econ.duke.edu/~ap172/research.html
267
268
269
PDF file with Matlab codes included: http://dsp.vscht.cz/ konference_matlab/MATLAB07/prispevky/kladivko_k/kladivko_k.pdf For those intested: a small re-organization of the blog has been undertaken, we moved all codes collection posts under category Quant code, which makes browse easier and more convenient (hopefully). In addition, we added Quant newssection where selected news and resources, focusing on Asian Quant markets, will be published. Hope this change won't bring trouble to you, thanks. Tags - cox ingersoll ross
270
271
272
Besides the code for CDS, a Yield Curve Specifications PDF file about how the yield curve is constructed and calculated is also available at the webpage, enjoy! http://www.cdsmodel.com/ Tags - cds , credit
273
274
Main Benefits: much less time spent chasing bugs and debugging; higher quality of code and software; provides documentation of which functionality has been tested; greater confidence to make changes to existing code since unit tests will catch incompatibilities early. Sounds nice? Downloading packages at: http://mlunit.dohmke.de/Main_Page for Matlab http://docs.python.org/library/unittest.html for Python http://cran.r-project.org/web/packages/RUnit/index.html for R. Tags - code , test
275
276
wavelet analysis
WaveLab is a collection of Matlab functions to implement a variety of algorithms related to wavelet analysis. A partial list of the techniques made available: orthogonal and biorthogonal wavelet transforms, translation-invariant wavelets, interpolating wavelet transforms, cosine packets, wavelet packets, matching pursuit, ...... downloading at http://www-stat.stanford.edu/~wavelab/ Wavelab_850/index_wavelab850.html Tags - wavelet
277
278
279
http://www.sci.usq.edu.au/staff/dunn/glmlab/glmlab.html
Tags - regression
280
281
282
283
284
285
286
Merry Christmas
Merry Christmas to you all and happy 2009 new year. Blog will take several days off.
287
288
289
290
291
292
Convert Splus to R
Suppose you have got used to Splus and want to switch to R software (why bother to change? R is free while Splus is not, fair enough?), what can you do? since there are many functions in S-PLUS that are missing in R, one way is to understand the functions and write your owns, working N hours without sleep (N>?). however, you can avoid doing like that if you are as headche as me whenever you think of this solution. There is a package named Splus2R, which is to facilitate the conversion of S-PLUS packages to R packages, this package provides some missing S-PLUS functionality in R. I have not tested the package, though, will update later. Here is downloading link: http://cran.r-project.org/web/packages/splus2R/ index.html. Tags - splus , r
293
294
295
http://www.mathworks.com/matlabcentral/fileexchange/16884
296
297
298
299
300
301
OptionCity Calculator
Key Benefits of the OptionCity Calculator * Flexible models with stochastic volatility and stock price jumps * Option prices with Greeks (sensitivity to parameters) * Realistic Smile charts * Fast evaluations * Self-validating results. (You validate calculations by selecting a different numerical method: Lattice, Series, or Monte Carlo) The program is a downloadable executable for MS Windows systems: http://www.optioncity.net/calculator.htm Tags - calculator , option
302
303
304
Tags - neural-network
305
306
307
308
309
310
311
312
313
314
315
316
317
318
Econometrics Software
Dozens of Matlab code for Econometrics study, including: Brock, Dechert& Scheinkman (1986) test for independence based on the correlation dimension Significance level of the BDS statistic in small samples Geweke &Porter-Hudak (1983) estimation of fractional differencing parameter Heteroskedasticity-consistent variance-ratio evaluationfor any q spacing Engle's(1982) test for ARCH Box-Pierce(1970) Q test using Ljung & Box's (1978) finite-sample correction Phillips-Perron test of the unit-root hypothesis in a Dickey-Fuller regression Durbin h statistic and significance of the hypothesis of no serial correlation Durbin-Watson d-statistic and significance level for the null hypothesis: DW = 2 http://ww61.tiki.ne.jp/~kanzler/ index.htm#L.%20Kanzler:%20Software Tags - econometrics
319
320
For a collection of reference paper and an online application please see http://www.blacklitterman.org/blapplet.html Tags - allocation , black-litterman
321
322
323
324
325
326
327
paper and code can be downloaded at http://web.wits.ac.za/NR/ rdonlyres/98E22C37-FA41-4C5B-8F11-F44BED5FF4C7/0/ nimalinmoodley.zip Tags - heston
328
329
330
331
332
333
334
335
336
Collection of R codes
R-Cookbook.com is a collection of "recipes"--problems, solutions, and working examples--contributed by the R community in order to share code, promote the use of R, and make the learning process more efficient for new users. http://www.r-cookbook.com/
337
338
339
Career change
Arrived in London today, new job will start from tomorrow, the first few weeks will be busy as i need to get used to the new life here. I will try to update new code link as possible as i can. thx for your support.
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
Arithmetic Game
One of my friends sent me an interesting site: Arithmetic game, (please help us develop by submitting a site in your favorites), The Arithmetic Game is a speed drill where you are given two minutes to solve as many arithmetic problems as you can, problems including addition, subtraction, multiplication, and division, for each problem answered correctly you will get score, test how many scores you can achieve. The highest score so far is 137, amazing... http://zetamac.com/arithmetic/ This game helps me recall the exam I took for a quantitative trader position several months ago, i failed Tags - game
356
Asian options are options where the payoff depends on the average price of the underlying asset during at least some part of the life of the option. The payoff from an average price call is max(Save - K, 0) where Save is the average value of the underlying asset calculated over a predetermined averaging period. Average price options are less expensive than regular options. Besides anti-thetic sampling method, control variate is another popular way for variance reduction, given the condition we can find a good proxy product, whose pricing formula is easy to get, in our case, geometric average asian option is used as control variate for arithemetic average asian option, here is a M file demonstrating Monte Carlo simulation on an arithmetic average price Asian option using a geometric average price Asian as control variate. http://personal.strath.ac.uk/d.j.higham/ch22.m. Tags - asian , option
357
358
As we know from empirical research, one of the main problems with the BlackScholes model is that the data suggest that the log returns of stocks/indices are not Normally distributed as in the BlackScholes model. The log returns of most financial assets do not follow a Normal law. They are skewed and have an actual kurtosis higher than that of the Normal distribution. Other more flexible distributions are needed. Moreover, not only do we need a more flexible static distribution, but in order to model the behaviour through time we need more flexible stochastic processes (which generalize Brownian motion). Looking at the definition of Brownian motion, we would like to have a similar,i.e. with independent and stationary increments, process, based on a more general distribution than the normal. However, in order to define such a stochastic process with independent and stationary increments, the distribution has to be infinitely divisible, such processes are called Lvy processes, one example of such process is normal inverse gaussian (NIG).
Normal Inverse Gauss option pricer (with Esscher transform correction), Excel + DLL, and a Maple worksheet with short explanations can be downloaded at http://www.axelvogt.de/axalom/ NIG_tiny_withDLL.zip, more are at the main page of author http://www.axelvogt.de/axalom/index.html.
359
360
361
362
363
364
365
366
367
368
369
370
371
here is a simulation of Brownian paths, brownian-bridge type simulation. Click to download Tags - brownian-bridge
372
Swaption valuation
A swaption is an over-the-counter derivative on a swap. Normally, the underlying swap is a vanilla interest rate swap. Nevertheless, "swaption" could be applied to relate to a derivative about whatever kind of swap. Swaptions could be European, American, or even Bermudan type. They can be physically settled, in which case a derivative is really participated into at exercise date. They can be cash settled as well, in which example the market price of the underlying swap is cleared at maturity. it is frequently more handy to address in terms of two common kinds of swaption: A payer swaption is a call option on a pay-fixed swap, the swaption holder has the right to pay fixed rate on a swap. A receiver swaption is a call option on a receive fixed swap, the swaption holder has the right to receive fixed rate on a swap. a spreedsheet showing how to price a swaption in a tree can be downloaded at: http://www.anassabri.info/ValuingSwaptions.xls wiki(Swaption) Tags - swaption
373
374
375
376
377
Finance IQ test
Weekend Time! interested into doing a short test on your finance IQ? Finance IQ is designed to test your knowledge in finance. The questions database includes various categories to choose, for instance, you can choose to test your Risk IQ or Options IQ, level could be from as easy as the definition of European option, black scholes to FRM test or even more advanced. Take a rest & have fun. Kind reminding: today is the last day of Beijing Olimpic and closing ceremony will be staging. http://www.fintools.com/docs/FinanceIQ.xls Tags - iq
378
379
380
Visualize Copulas
In those Copula codes you can get a rough idea what copula is, how to estimate and simulate it, how to test its performance, etc., to help you visualize what on earth the copula should look like, below R code draws plots of some widely used copulas. PS: I just finished my Copuls exam one hour ago, performance...um.... Fighting... http://www.fam.tuwien.ac.at/~mkeller/R-progs/copula.R Tags - copula
381
Java Quantlib
Many people know QuantLib, which is a free/open-source library for quantitative finance for modeling, trading, and risk management in reallife written in C++, for those people prefer Java language, they have to read & understand C++ codes and transfer them to Java code. JQuantLib is aiming at these Java-fans group, Quotation JQuantLib is a free, open-source, comprehensive framework for quantitative finance, written in Java. It provides "quants" and Java application developers several mathematical and statistical tools needed for the valuation of financial instruments, among other features.
382
SABR code in VBA and C is available together with a PDF: http://www.axelvogt.de/axalom/SABR.pdf http://www.axelvogt.de/axalom/SABR_Code_VB_and_C.txt wiki(SABR Volatility Model) Tags - stochastic , volatility
383
384
385
386
387
388
Process Simulation in R
Simple demonstration codes for process simulation in R, including Brownian motion simulation, Poisson process simulatio, Euler scheme simulation for Geometric Brownian motion, the mean-reverting process, and the process with two 'attractors', etc. http://www.math.ku.dk/~rolf/teaching/mfe04/MiscInfo.html#Code Tags - simulation
389
Optimization packages
Optimization models play an increasingly important role in financial decisions. Many computational nance problems ranging from asset allocation to risk management, from option pricing to model calibration can be solved efficiently using modern optimization techniques. Several classes of optimization problems including linear, quadratic, integer, dynamic, stochastic, conic, and robust programming are often encountered in financial models. This site collects dozens of optimization packages in different programming languages, you will find one for you.
390
391
392
R code can be downloaded at http://www.math.ku.dk/~rolf/teaching/ mfe04/MiscInfo.html#Code wiki(Vasicek model) Tags - vasicek , cox ingersoll ross
393
394
395
396
397
398
399
400
401
Modeling
Under
Non-Gaussian
This site stores matlab codes accompanying the book Financial Modeling Under Non-Gaussian Distributions, a wonderful and easy to read book, which was used by my professor last semester, you can imagine how much this site has helped me, Cheers. http://www.hec.unil.ch/MatlabCodes/ Tags - matlab
402
403
404
Closed expressions and Approximate Models for various Financial Option on Equity Binary Tree method to Price Options on Equity Monte Carlo pricer of Exotics Monte Carlo Pricer of American Calls and Puts Monte Carlo Pricer of European Barrier, Knock in and out Options Monte Carlo Pricer European Spread Options Monte Carlo Pricer of Interest Rate Derivatives (One factor) Monte Carlo Pricer Ho Lee Model Monte Carlo Pricer Hull White Model Monte Carlo Pricer Black Derman Toy Model Monte Carlo Pricer Brace Gatarek Musiela / Jamishidian Model Monte Carlo pricer of exotics with constant Jump-Diffussion Monte Carlo Pricer of Barrier, Knock in and out Options with JumpDiffusion Monte Carlo Pricer European Spread Options with Jump-Diffusion
Closed expressions and Approximate Models for various Financial Option on Equity Binary Tree method to Price Options on Equity Monte Carlo pricer of Exotics Monte Carlo Pricer of American Calls and Puts Monte Carlo Pricer of European Barrier, Knock in and out Options Monte Carlo Pricer European Spread Options Monte Carlo Pricer of Interest Rate Derivatives (One factor) Monte Carlo Pricer Ho Lee Model
405
Monte Carlo Pricer Hull White Model Monte Carlo Pricer Black Derman Toy Model Monte Carlo Pricer Brace Gatarek Musiela / Jamishidian Model Monte Carlo pricer of exotics with constant Jump-Diffussion Monte Carlo Pricer of Barrier, Knock in and out Options with JumpDiffusion Monte Carlo Pricer European Spread Options with Jump-Diffusion http://www.javaquant.net/downloads.html wiki(Black Derman Toy) Tags - bdt , monte carlo
406
407
Tags - fama
408
409
Quantile Regression
Quantile regression is a statistical technique intended to estimate, and conduct inference about, conditional quantile functions. Just as classical linear regression methods based on minimizing sums of squared residuals enable one to estimate models for conditional mean functions, quantile regression methods offer a mechanism for estimating models for the conditional median function, and the full range of other conditional quantile functions. By supplementing the estimation of conditional mean functions with techniques for estimating an entire family of conditional quantile functions, quantile regression is capable of providing a more complete statistical analysis of the stochastic relationships among random variables.
410
411
412
413
EWMA Volatility
VB function to calculate 'exponentially weighted moving average' volatilites (=RiskMetrics volatility forecasting) with or without assuming a zero mean return. http://www.andreassteiner.net/performanceanalysis/ ?Downloads:VBA
414
415
Closed expressions and Approximate Models for various Financial Option on Equity Binary Tree method to Price Options on Equity Monte Carlo pricer of Exotics Monte Carlo Pricer of American Calls and Puts Monte Carlo Pricer of European Barrier, Knock in and out Options Monte Carlo Pricer European Spread Options Monte Carlo Pricer of Interest Rate Derivatives (One factor) Monte Carlo Pricer Ho Lee Model Monte Carlo Pricer Hull White Model Monte Carlo Pricer Black Derman Toy Model Monte Carlo Pricer Brace Gatarek Musiela / Jamishidian Model Monte Carlo pricer of exotics with constant Jump-Diffussion Monte Carlo Pricer of Barrier, Knock in and out Options with JumpDiffusion Monte Carlo Pricer European Spread Options with Jump-Diffusion
416
Monte Carlo Pricer of Barrier, Knock in and out Options with Jump-Diffusion
how to price barrier options with jump-diffusion by monte carlo simulations, codes are in Java language. http://www.javaquant.net/downloads.html
417
418
419
420
421
422
423
424
425
426
427
Unzip the EquityDerivGUI file to a directory of your local computer, change the directory to be the current directory of your matlab, run main file DerivativeGui.m. tested under Matlab7.0.1. Click to download Tags - derivative , matlab , gui
428
429
430
431
432
433
434
435
Quasi-maximum likelihood
Quasi-maximum likelihood toolbox in matlab. http://www.mathtools.net/files/net/qmle.zip
436
437
438
439
440
A lightweight applications
C++
library
for
quantitative
finance
What is Terreneuve? Simply: "A lightweight C++ library for quantitative finance applications." In more detail, Terreneuve is our team name for the project in the Fall 2005 Computing in Finance course at NYU's Courant Institute Masters in Math Finance. Working from this specification we hope to design a useable C++ library for some important quantitative finance applications. Our target audience (aside from our prof ;-)) is students in quantitative finance and those seeking a gentle introduction to financial computing. Obviously, we also intend to use the project as a learning opportunity. We refer those looking for a more comprehensive (and complex) library to the quantlib project. http://terreneuve.sourceforge.net/
441
442
443
Tags - gauss
444
445
446
447
448
Spreadsheet Programs
To help you in finding the spreadsheet that you might want, I have categorized the spreadsheets into the following groups: 1. Corporate finance spreadsheets: These spreadsheets are most useful if you are interested in conventional corporate financial analysis. It includes spreadsheets to analyze a project's cashflows and viability, a company's risk profile, its optimal capital structure and debt type, andwhether it is paying out what it can afford to in dividends. 2. Valuation Inputs Spreadsheets: In this section, you will find spreadsheets that allow you to a. Estimate the right discount rate to use for your firm, starting with the risk premium in your cost of equity and concluding with the cost of capital for your firm. b. Convert R&D and operating leases into capitalized assets c. estimate the right capital expenditures and diagnose the terminal value assumptions to see if they are reasonable. 3. Valuation Model Reconciliation: In this section, you will find spreadsheets that reconcile different DCF approaches - FCFE versus Dividend Discount Model, FCFE versus FCFF model, EVA versus Cost of capital and Net Debt versus Gross Debt Approaches. 4 . Big-picture valuation spreadsheets: If you are looking for one spreadsheet to help you in valuing a company, I would recommend one of these 'ginzu' spreadsheets. While they require a large number of inputs, they are flexible enough to allow you to value just about any company. You do have to decide whether you want to use a dividend, FCFE or FCFF model spreadsheet. If you have no idea which one will work for you, I would suggest that you try the "right model" spreadsheet first. 5 . Focused valuation spreadsheets: If you have a clear choice in terms of models - stable growth dividend discount, 2-stage FCFE etc. - you can download a spreadsheet for the specific model in this section. ...... http://pages.stern.nyu.edu/~adamodar/New_Home_Page/ spreadsh.htm Tags - excel
449
450
451
452
453
454
Contact us
abiao: PhD candidate in finance, UK (2009 ~ present) MSc in quantitative finance, Switzerland (2007 ~ 2008) Quant researcher, UK, (2008~2009) Quant analyst, China, (2004~2007) Skills: Matlab, VBA, S+/R, C++ bo: MSc in computational finance, China Researcher, China Skills: VBA, Eview Please leave message here, follow my twitter or write to abiao @ mathfinance.cn (remove space) for any issue regarding suggestion, cooperation, ad on this blog, complaint, sharing quant code related site, project outsourcing, internship, part-time job, freelance, etc., thank you. Should you are interested into posting your articles on mathfinance.cn, please read our paid contributor and guest post policies.
About MathFinance.cn: Blog on Quantitative finance code, methods in math finance focusing on derivative pricing, quantitative trading and quantitative risk management. Several features: 1, one of the few mainly quant oriented blogs; 2, received on average 500~600 unique visitors and 1200+ pageviews per day; 3, visitors are mostly from US, UK, Canada, France, and Germany. As of 24/04/2010, MathFinance.cn is: #5 site in 'Quantitative Finance' * #7 site in 'Quant' * #5 site in "Math Finance" ** #9 site in "Quant Jobs" ** *by xmarks.com, **by Google.com Quantitative Finance Collector is a Top Site in Quantitative Finance Review This Site Quantitative Finance Collector is a Top Site in Quant
455
456
457