Showing posts with label finance. Show all posts
Showing posts with label finance. Show all posts
Wednesday, June 26, 2013
Thursday, May 23, 2013
nadex.com
nadex exchange based in chicago. binary and bull spread options trading, legal for u.s. residents.
Wednesday, April 10, 2013
quandl
http://www.quandl.com/
amazing amount of economic indicators, financial, and social data for free, in convenient formats. if i need any time series in the future, i'll check to make sure it's not there already.
quantopian already has hooks to grab data from there.
amazing amount of economic indicators, financial, and social data for free, in convenient formats. if i need any time series in the future, i'll check to make sure it's not there already.
quantopian already has hooks to grab data from there.
Friday, April 5, 2013
When cointegration of a pair breaks down
interesting article with more info on multivariate cointagration and pairs trading (or other multiples trading). comments contain lots of other links.
http://epchan.blogspot.ca/2011/06/when-cointegration-of-pair-breaks-down.html
http://epchan.blogspot.ca/2011/06/when-cointegration-of-pair-breaks-down.html
Thursday, February 28, 2013
investor sentiment metrics
interesting quick overview of ways to measure investor sentiment as a market indicator. following is a snippet with 6 examples.
http://www.ft.com/cms/s/0/9200dbf4-7b6f-11e2-8eed-00144feabdc0.html#axzz2MBYXC97A
Panic or euphoria: six ways to measure the market
● AAII bull-bear ratio
Nothing illustrates the flakiness of some sentiment measures more than the weekly survey by the American Association of Individual Investors. Widely used as a guide to the proportion of bulls and bears in the market, it involves sometimes fewer than 100 self-selected investors reporting their mood. Yet its long history and broad accuracy – super-bullish at market peaks, uber-bearish when the market bottoms out – has made it a favourite.
● Investors Intelligence
There are some very shrewd writers of investment newsletters (Jim Grant of Grant’s Interest Rate Observer is an example). Taken as a whole, newsletters capture the feeling in the market. Investors Intelligence categorises each newsletter as bullish or bearish; the spread between the two shows when writers are becoming emotionally attached to the market.
● Futures market positioning
Many investors try to copy what the “smart money” is up to. They would do better to watch it as a contrary indicator, preparing to do the opposite. Positions in S&P 500 derivatives (not the e-mini) offer a handy guide to how sophisticated traders feel about the market. The net positioning shown in the chart can be used to test whether they are too optimistic or pessimistic.
● Equity put/call ratio
The options market offers investors the chance to buy insurance for their portfolios or speculate on future gains. The ratio between put options (which make money if the market falls) and calls (which profit from rising markets) is an immediately-available guide to how relatively sophisticated investors feel. When it becomes very high, investors are extremely cautious, when very low, they feel no need for insurance.
● Combined measures
Lots of consultancies and investment banks produce combined measures, all constructed somewhat differently. Shown here is one, from Absolute Strategy Research, which combines the different investor surveys into a single poll of polls. At the moment it suggests investors feel dangerously sanguine.
● Investment bank equity weighting
The model contrarian would only invest in things that made them feel physically sick and only sell when convinced they should buy more. Merrill Lynch strategists measure recommendations from the rest of Wall Street’s strategists, and suggest doing the opposite. At the moment the Street’s strategists have a low weighting in equities. Merrill sees this as a bullish signal for shares.
http://www.ft.com/cms/s/0/9200dbf4-7b6f-11e2-8eed-00144feabdc0.html#axzz2MBYXC97A
Panic or euphoria: six ways to measure the market
● AAII bull-bear ratio
Nothing illustrates the flakiness of some sentiment measures more than the weekly survey by the American Association of Individual Investors. Widely used as a guide to the proportion of bulls and bears in the market, it involves sometimes fewer than 100 self-selected investors reporting their mood. Yet its long history and broad accuracy – super-bullish at market peaks, uber-bearish when the market bottoms out – has made it a favourite.
● Investors Intelligence
There are some very shrewd writers of investment newsletters (Jim Grant of Grant’s Interest Rate Observer is an example). Taken as a whole, newsletters capture the feeling in the market. Investors Intelligence categorises each newsletter as bullish or bearish; the spread between the two shows when writers are becoming emotionally attached to the market.
● Futures market positioning
Many investors try to copy what the “smart money” is up to. They would do better to watch it as a contrary indicator, preparing to do the opposite. Positions in S&P 500 derivatives (not the e-mini) offer a handy guide to how sophisticated traders feel about the market. The net positioning shown in the chart can be used to test whether they are too optimistic or pessimistic.
● Equity put/call ratio
The options market offers investors the chance to buy insurance for their portfolios or speculate on future gains. The ratio between put options (which make money if the market falls) and calls (which profit from rising markets) is an immediately-available guide to how relatively sophisticated investors feel. When it becomes very high, investors are extremely cautious, when very low, they feel no need for insurance.
● Combined measures
Lots of consultancies and investment banks produce combined measures, all constructed somewhat differently. Shown here is one, from Absolute Strategy Research, which combines the different investor surveys into a single poll of polls. At the moment it suggests investors feel dangerously sanguine.
● Investment bank equity weighting
The model contrarian would only invest in things that made them feel physically sick and only sell when convinced they should buy more. Merrill Lynch strategists measure recommendations from the rest of Wall Street’s strategists, and suggest doing the opposite. At the moment the Street’s strategists have a low weighting in equities. Merrill sees this as a bullish signal for shares.
Monday, January 7, 2013
quant finance links
http://www.sierrachart.com/index.php?l=doc/developers.php
came across sierrachart while trying to research restrictions on the use of google finance data (based on http://www.google.com/intl/en/googlefinance/disclaimer/?ei=v2zjUPjvIeOZwQPGhAE ). sierrachart looks like it's written by a loose coalition of general nerds often for their own use, and sold for a fee to non-nerds. they advertise the google finance data importer openly, so i guess google doesn't mind? written in c++, so maybe easy to integrate with other quant libs?
http://www.derivitec.com/
started by a couple of equity derivative quants about a year ago, they sell risk models that go into spreadsheets and compute on the cloud with microsoft azure. head dude wrote a book ( http://www.amazon.com/The-Value-Uncertainty-Dealing-Derivatives/dp/1848167725/ref=sr_1_1?ie=UTF8&qid=1339681713&sr=8-1 ) (not out yet) about how to do risk quantification, including practical considerations. one of the few refs i've seen to model error risk and model parameter uncertainty.
i wanted to see if google would allow people to share the results of computation that used their finance data. the disclaimer statement seems ridiculously restrictive (can't even 'download or save' it? erm, then why is your server giving it to me?) for-fee data services like thomson-reuters ( http://thomsonreuters.com/products_services/financial/financial_products/a-z/datascope_select/#tab1 ) and xignite ( http://www.xignite.com/Product/XigniteBondsRealTime/ ) are very pricey. www.kibot.com is cheaper, but still hundreds of $ for each data type. sierrachart and ninjatrader both advertise their capability to download and extract data from finance.google.com and both show up on the first page of a google search. hmmm.
incidentally, i found (maybe re-found) possibly useful indicator historical data available for free from the world bank (eg, http://data.worldbank.org/data-catalog/world-development-indicators?cid=GPD_WDI ).
also, openquant might be interesting:
http://www.smartquant.com/openquant.php
okay, apparently that one is a few hundred bucks/month. this one is foss:
http://code.google.com/p/openquant/
came across sierrachart while trying to research restrictions on the use of google finance data (based on http://www.google.com/intl/en/googlefinance/disclaimer/?ei=v2zjUPjvIeOZwQPGhAE ). sierrachart looks like it's written by a loose coalition of general nerds often for their own use, and sold for a fee to non-nerds. they advertise the google finance data importer openly, so i guess google doesn't mind? written in c++, so maybe easy to integrate with other quant libs?
http://www.derivitec.com/
started by a couple of equity derivative quants about a year ago, they sell risk models that go into spreadsheets and compute on the cloud with microsoft azure. head dude wrote a book ( http://www.amazon.com/The-Value-Uncertainty-Dealing-Derivatives/dp/1848167725/ref=sr_1_1?ie=UTF8&qid=1339681713&sr=8-1 ) (not out yet) about how to do risk quantification, including practical considerations. one of the few refs i've seen to model error risk and model parameter uncertainty.
i wanted to see if google would allow people to share the results of computation that used their finance data. the disclaimer statement seems ridiculously restrictive (can't even 'download or save' it? erm, then why is your server giving it to me?) for-fee data services like thomson-reuters ( http://thomsonreuters.com/products_services/financial/financial_products/a-z/datascope_select/#tab1 ) and xignite ( http://www.xignite.com/Product/XigniteBondsRealTime/ ) are very pricey. www.kibot.com is cheaper, but still hundreds of $ for each data type. sierrachart and ninjatrader both advertise their capability to download and extract data from finance.google.com and both show up on the first page of a google search. hmmm.
incidentally, i found (maybe re-found) possibly useful indicator historical data available for free from the world bank (eg, http://data.worldbank.org/data-catalog/world-development-indicators?cid=GPD_WDI ).
also, openquant might be interesting:
http://www.smartquant.com/openquant.php
okay, apparently that one is a few hundred bucks/month. this one is foss:
http://code.google.com/p/openquant/
otc derivatives data
the cftc is now in charge of collecting data from off-exchange trades of swaps, etc., thanks to dodd-frank. right now they are doing cdo and rates derivative; equity, forex, and commodities will come later.
i can't find any data on the cftc site except highly aggregated volume data. apparently anyone can apply to become a repository, they can meet the requirements. so far, the dtcc is the best source i can find. they offer rss and csv downloads:
https://rtdata.dtcc.com/gtr/dashboard.do
this could get very interesting, and could change the way investment banks run their business for good.
i can't find any data on the cftc site except highly aggregated volume data. apparently anyone can apply to become a repository, they can meet the requirements. so far, the dtcc is the best source i can find. they offer rss and csv downloads:
https://rtdata.dtcc.com/gtr/dashboard.do
this could get very interesting, and could change the way investment banks run their business for good.
Tuesday, January 31, 2012
Funding beyond discounting: collateralagreements and derivatives pricing
apparently ground-breaking article by vladimir piterbarg, the head of barcap quantitative research and author of a well-known 3 volume series on interest rate modeling.
http://www.scribd.com/doc/34328165/Risk-Magazine-Piterbarg-Funding-Beyond-Discounting-Collateral-Agreements-and-Derivatives-Pricing
important for correctly valuing derivatives, and what the 'risk-free' rate really is.
Tuesday, January 10, 2012
Malliavin calculus
saw a reference to Malliavin calculus. used in financial math to take derivatives of stochastic processes. looks interesting, might be useful to learn some day.
Friday, October 14, 2011
trading strategies
here's an idea: delta hedge triple-leveraged etfs. want to have (price of underlying)/(price of hedge) as high as possible, with high vol on underlying. take advantage of the fact that leveraged etfs rebal their derivative guts daily, so their delta changes with the underlying price. hold the hedge, buy/sell the underlying to match delta, make $$ every time the underlying price bounces up, with very low risk as long as you adjust the hedge daily. if you have too much cash, buy more hedge when the price goes up instead of selling the underlying. look for 3x etfs at http://3xetf.com/ this is very similar to the way people delta hedge options, but very simple to manage and with no trader-type restrictions. another way to do it could be to hold the underlying and buy/sell the hedge. i'll need to check into liquidity/trading cost issues there.
for example:
long term treasuries: hedge tlt (or maybe vglt?) with sbnd.
financials: hedge sef with fas.
real estate: hedge schh with drv.
russia: hedge ? with rusl
s&p500: hedge spy, ivv with spxu
or maybe the factorshares spread etfs?
Tuesday, March 29, 2011
trading optimization
i've been thinking about how to optimize trades for some algorithmic trading. i need to define objective functions, obviously, but how exactly? risk vs. return, but risk (for a liquid asset) depends on a portfolio state between transactions, and returns are realized upon the transaction.
it just occurred to me that i can reduce it to simple shift and scaling operations on a (somewhat unknown) pdf. if i have a certain unhedged amount, x, of a risky asset, and i buy or sell to end up with a*x, then that scales the pdf f(x) to f(a*x)/a. the trade should give me a return, r, so the pdf of my total return after the trade would be something like f(a*x-r)/a. so i know what the shift and the scale are, even though i don't exactly know what f(x) is. now it's a question of whether f(a*x-r)/a is better than f(x), and i trade if it is (i.e., maximize whatever metrics to find the optimal r,a).
does this answer the question of how to place limit orders away from the market prices? i'm not sure yet.
Thursday, March 17, 2011
factor shares
ib is offering its customers commision-free trades on factorshares spread etfs. this looks really interesting: diy hedge fund with asset classes. trying to figure out how the funds operate, based on the holdings info from their website...
each of the 5 has basically $3m in treasuries, $2m in cash, and a thousand in a treasury fund. each one then takes a position in nearest future contract (long and short) for the two spread assets, for 2x the nav/share * 100k shares/unit * 2 units (currently). the treasuries are probably to offset the time discount on the futures contracts, and that and the cash are for margin, obviously. the fund is probably for a little bit of liquidity during the daily rebalance. i'm guessing the nav comes from the $5m risk free + net market value of the futures. the nav/share doesn't exactly match the price, probably given the constraints of the contract sizes and maybe the lower liquidity of the etf at the moment. the futures holdings are updated daily, to restore dollar neutrality (same forward contract dollar amounts). for the current number of shares and risk-free holdings, the funds basically started at $25/share. the s&p e minis are apparently for lots of 50. the 30yr tbill futures are for lots of 100.
the 5 etfs are s&p/tbill, tbill/s&p, s&p/usd, oil/s&p, gold/s&p, where each is bull/bear. 2x leverage on each leg, for a 4x total leverage (but still just 2x on the spread).
right now the volume is pretty light, around 10k/day, since they just lauched a few weeks ago. i wonder if there is any arbitrage opportunity for these, knowing their methodology. especially for s&p/tbill vs. tbill/s&p.
does the rebalance accumulate anything based on independent underlying price movements? no, because all the money gained from selling an advancing future is put into the one that declined, and the same thing will happen at the end of the next day. but if i rebalance between these, it will. i'm just not sure if it's any better than just rebalancing among 2x single asset funds, unless you think they're anticorrelated instead of just uncorrelated. maybe it has the advantage of not needing to rebalance with cash, like single funds would.
one thing maybe i can try is to arb the s&p/tbill vs. tbill/s&p like this: right now fse has 139 emini and -71 tbill, and fsa has -177 emini and 91 tbill. closing for fse was $22.57 and fsa was 28.18. if i could buy 177/139 fse it would cost 28.74, or 91/71 would cost 28.92. so if i had some of each, i could have sold fse and bought fsa near the end of the day, eg sell 9 fse for 203.13 and buy 7 fsa for 197.26. that would be selling a share of 1251 emini, -639 tbill and buying a share of -1239, 637. so the net would be 42, -2.
nav calculation time is based on the first of the futures contracts to settle:
s&b/tbond 3pm (ET)
tbond/s&p 3pm
s&p/usd 3pm
oil/s&p 2:30pm
gold/s&p 1:30pm
the nav must depend on the price of the futures and what exposure they can be rebalanced to.
futures prices might not be as easy to come by, so maybe i could compare to other leveraged etfs like sso, sds, dgl (or iau/gld (not leveraged) or dgp/dzz (monthly, not daily)), dbo (or dig?, uso, oil), tlt (not leveraged), tbt (or pst? no), udn (not leveraged) (or uup, not leveraged and bull instead of bear but much higher volume) (these only use dx contracts, not front month). this wouldn't necessarily be perfect since nav can deviate from price, but it should be close for the heavily traded ones.
here's a good ref list for leveraged etfs
Tuesday, February 1, 2011
quant topics i should learn
looked through a big glossy from wilmott's certificate in quantitative finance. saw some terms that i wasn't sure i knew about. so here's a list, so i can make sure i learn about them and i don't need to take any of their classes.
fokker-planck and kolmogorov
the radon-nikodym derivative
girsanov's theorem
yield, duration, and convexity
stochastic and spot-rate models
affine stochastic models
heath, jarrow and morton
reduced-form model and the hazard rate
structural default models
cds pricing, market approach
synthetic cdo pricing
risk of default, structural and reduced form
copulas
brownian bridge (monte carlo?)
sobol' (quasi monte carlo?)
crank-nicolson
black-litterman (portfolio management)
levy copulas (cdo pricing)
fixed income: bgm, black 76
variance gamma
vg le'vy
stochastic monetary policy models for interest rate derivatives
gram-schmitdt process
Saturday, January 29, 2011
cape -- cyclically adjusted price/earnings
i saw an interesting quote from page 3 of the money pull-out section of the january 8, 2011 issue of the financial times. 'eleven reasons to worry - but two reasons to invest' by merryn somerset webb. i thought the identification of the 'only really reliable long-term indicator' was interesting. i wonder if the assumption that predicted returns can come from either price adjustments as well as earnings depends on a dividend-paying stock.
'as societe generale's albert edwards points out, on a cyclically adjusted price/earnings (cape) ratio, the us market remains seriously overvalued. so, unless this time really is different (and i'd bet a good deal that it is not), we can expect to revert to mean at some point.
let's not forget, as edwards put it, that while the history of the last 130 years or so has been both remarkable and appalling -- "the deaths of empires, the birth of nations, periods of deregulation, periods of re-regulation, world wars, revolutions, plagues and huge technological and medical advances -- "none of these events mattered from the perspective of value" the long run average cape remained much the same.
...
i'm not worried about valuation in the short term. the cape is -- so far -- just about the only really reliable long-term indicator of stock market returns we have. but it is rarely much use to anyone in the shorter term. som, while we need to watch it, we don't need to panic every time it flashes at us.'
Wednesday, January 19, 2011
fifty years in wall street
a highly recommended book on the history of us finance and some of the big names and players during the latter half of the 19th century is out of copyright and available for free online. it's a heft tome (~1000 pages) but you can get plain text, pdf with scanned images, or djvu files here or here. the plain text looks like it was ocr and is pretty good quality, though might cause some problems with tts.
Tuesday, November 23, 2010
15.433
from ocw
3
harry markowitz, 'portfolio selection', journal of finance, march 1952, u. of chicago (grad student)
'the process of selecting a portfolio may be divided into two stages. the first stage starts with observation and experience and ends with beliefs about the future performances of available securities. the second stage starts with the relevant beliefs about future performances and ends with the choice of portfolio'
my code concerns second part for computation, but could also guide quantitative, rational, unemotional thought and validate assumptions made in the first part.
s&p 500 returns look nearly bimodal, with a larger positive mode and smaller negative mode
10 year treasury bills returns have small tails
9
fama french three-factor model
connections to other ratio patterns
estimates for the factors 1963-2000
momentum (short-term positive correlation, long-term reversals) most studied anomaly in finance (2000)
10
equity option valuation
risk neutral pricing
binomial trees
put/call parity
black scholes formula
implied volatility
survey: why do institutions use options?
at page 200, printed landscape (should be portrait)
Friday, September 24, 2010
optimization of conditional value-at-risk
by rockafellar and uryasev
good description of cvar and why it's superior to var (value at risk) for portfolio optimization. they use a math technique sort of like a lagrange multiplier (not really, but works in a similar way) to transform the otherwise 2-step procedure for computing and optimizing conditional value at risk to a single stochastic optimization, convex (piecewise linear). it can then be solved with either linear programming or a nonsmooth optimizer.
interesting side note: they use a sobol sequence to get superior performance over straight-up mc. (the wikipedia article on sobol quasi-random sequences is quite dense and hard to understand, but here's a nice article that shows a monte-carlo integration example with a finance application, refs to niederreiter, sobol, and faure qrs. bottom line: niederreiter is (maybe) best.) also shows examples of portfolio optimization and optimal hedging with a butterfly spread.
certainly this is a better read than the highly mathematical paper that introduced cvar (convex measures of risk and trading constraints by f\"ollmer and schied). all i can really remember about that one is the point about cvar being convex (while var is not) and why that's important: diversification (mathematically, linearly interpolating between two portfolios) should not increase risk.
still, i think it's interesting that an industry-standard book on portfolio optimization like 'active portfolio management' by grinold and khan would brush off all risk metrics other than variance so lightly. maybe return distributions really are close enough to gaussian (with exceptions for derivatives, etc.) that it doesn't matter in practice, as they claim. at least anything that can compute those quantities should also give the variance for comparison.
call number:336.767 GRI ID:2406743083
Active portfolio management : a quantitative approach for providing
superior returns and controlling risk / Richard C. Grinold, Ronald N.
Kahn.
good book to have in the personal library, although there will be an updated version out later this year or next.
Friday, August 20, 2010
trading hocus pocus
i think i found the source for that reference to the use of fibonacci numbers in trading. there's a charlatan in peddling books and software based on numerological mysticism. i can't believe people are paying $500 a pop for his stupid software and >$150 for the book. really makes me wonder why i can't put together some of my code and sell it, if anyone is willing to buy that bovine byproduct. check out this gem from his website:
What's in the book: Fibonacci ratios as market tools.For centuries, scientists, mathematicians, and artisans have discovered that the Fibonacci sequence of numbers is replicated throughout nature. This amazing number series defines the appearance of physical structures, as well as the PROGRESS OF CHANGE AND GROWTH governing dynamic structures and systems.The Fibonacci sequence is found in the structures of trees, plants, and flowers. A regular sequence of Fibonacci numbers occurs in the relationship between a particular branch and the next branch. Fibonacci relationships also exist between leaves and stems. Radio signals generated by pulsars conform to Fibonacci numbers. Research reveals that many natural crystals contain the Fibonacci golden ratio, 1.618. There is even speculation by Dr. John Penrose of the Institute of Mathematics at Oxford, that the golden ratio may provide the crucial link between the sub-atomic and the supra-atomic world!Human behavior has a dualistic nature. We think and act both as individuals and as part of a crowd. A crowd has its own energy and collective mind. It can be viewed as a dynamic system and, as such, it is governed by the same laws that exist throughout nature. Since a crowd is a dynamic system, and since financial and agricultural markets exhibit crowd behavior, it follows logically that Fibonacci relationships should be intrinsic to all liquid markets. These all important numbers and ratios indicate areas of contraction and expansion in price-wave movements. The concepts of Fibonacci support, resistance, and expansion in price function due to the principle inherent in the unfolding of all natural phenomena, including the behavior of crowds and the collective mind. The real difficulty is in the PROPER AND PRACTICAL APPLICATION of this natural phenomena to price movements. It is precisely that difficulty which DiNapoli Levels is designed to address. The text puts it all together in a unified trading approach you can act on!
This book also dispels myths about Fibonacci analysis and only covers those techniques that are useful and practical to employ in real life trading situations.
oh, good. it dispels all the myths and only covers the practical parts of this nonsense.
Wednesday, July 14, 2010
stock index futures and price forecasting
trying to figure out exactly what numbers financial commentators use to make headlines like, "futures point to higher open..." often they point to specific futures contracts, like SPc1, NDc1, or DJc1. the cme group equity futures quotes seem to be what people are referring to (or at least have equivalent price percent changes). unfortunately, the javascript in those pages that handle the quote updates prevents convenient scraping. options pages like these, otoh, are exceedingly easy to scrape as whitespace-delimited plain text. and with the eom (end of month, european-style) options, the price/probability is fairly simple.
if i really need to get at the futures contract prices, i could use bloomberg, which just has static html tables (with major us and world indices on one page).
back on the cme group site, i couldn't find quotes for options for oil, and even the time and price transactions list is another inaccessible js job. however, if i only care about end-of-day data, there are a lot in the ftp server (see the settle/ dir, for example) and other links from the volume:volume & open interest tab of one of the futures pages. daily settlement prices (near the bottom) has links for interest rates, equities, (agricultural) commodities, precious and industrial metals (in comex), oil and energies (in nymex and cme clearport clearing), and fx.
the volume by price data on that page might be particularly useful for building distributions. it combines total volume for the day at a each price, and the historical data available on the ftp server goes back a year and a half. the format is a bit obfuscated, but there are links to one-page format descriptions next to the data links.
one other thought about using derivatives for price forecasting/asset valuation: the price of the derivative depends not only on what people believe about the future price, but also on what everyone knows about the current price. so, if i had intraday data for the derivative price, i should subtract out the effect of the underlying price to get the future price. i wonder if ica on the log derivatives would achieve this... obvious maybe, but worth noting so i don't forget.
Tuesday, June 29, 2010
bond spread data
fred (research.stlouisfed.org) has a lot of economic indicator historical data, including moody's bond yields, but only for aaa and baa. i'd like to find something for more junky bonds....
moodys.com certainly would have these data, along with others i'd like to see. but registration is required and i don't know if that stuff is available for free.
Subscribe to:
Posts (Atom)