Michael J Bommarito II's blog

Now Available on SSRN: A Profitable Trading and Risk Management Strategy Despite Transaction Cost

A few weeks ago, I mentioned my joint paper with A. DuranA Profitable Trading and Risk Management Strategy Despite Transaction Cost.  You can now obtain a copy of this paper on SSRN.  Feel free to send an email with any feedback you might have. 

Paper: A Profitable Trading and Risk Management Strategy Despite Transaction Cost

Readers might be interested in an article that A. Duran and I have coming out in Quantitative Finance this year entitled A Profitable Trading and Risk Management Strategy Despite Transaction Cost.  In the article, a number of the tools I've presented on the blog here have been used in the development of strategy which outperforms the S&P500 in rigorous out-of-sample testing.   We've made sure to check the robustness of the results, and have performed Monte Carlo simulations while varying the sets of stocks and time periods used in the calculation. 

While you're waiting for its publication in Quantitative Finance, you might check out the abstract over at SSRN.

Visualizing Bank Failures, 2008 - 2009

As detailed on my Computational Legal Studies blog, coauthored with Daniel Katz, the following video shows a dynamic visualization of bank failures over the past two years.

Read more here

Visualizing Bank Failures ( 2008-2009 ) from Michael J Bommarito II on Vimeo.

Cash for Clunkers – Visualization and Analysis

As detailed on my Computational Legal Studies blog, coauthored with Daniel Katz, the following video shows a dynamic visualization of the Cash for Clunkers program:

Read the full post here.

 

"Fannie Mae Eases Credit To Aid Mortgage Lending" circa 1999, NY Times

http://query.nytimes.com/gst/fullpage.html?res=9C0DE7DB153EF933A0575AC0A96F958260&sec=&spon=&partner=permalink&exprod=permalink
Paragraph 8:
"''From the perspective of many people, including me, this is another thrift industry growing up around us,'' said Peter Wallison a resident fellow at the American Enterprise Institute. ''If they fail, the government will have to step up and bail them out the way it stepped up and bailed out the thrift industry.''"

Comparison of ETFs and CEFs: Dollars Traded Per Day vs Total Assets

This picture should be pretty straightforward.  The numbers are the natural log of the average dollars traded per day YTD and the natural log of total assets held.  Note the distinct clustering of the two asset types.

Using Matlab's Database Toolbox with MySQL Connector/J

I normally don't delve too much into the programmatic details of my work, but I've seen enough interest in this topic that I figured I'd lend a helping hand to those fellow frustrated souls.

There are a few awkward, non-native MEX implementations of various database interfaces.  However, Matlab has its own database toolbox built around ODBC/JDBC, and when developing distributable software, one always hopes to minimize third-party library usage.  As a result, I've put a good deal of effort into integrating Matlab with both MySQL and SQLite.  In fact, the data for every post on this site is stored in a 2GB MySQL database server running on my laptop.

As you can see, this requires only that you distribute the platform-independent JAR.  No DLLs, no MEX compilation.

% Database Server
host = 'localhost';

% Database Username/Password

user = 'user';
password = 'password';

% Database Name
dbName = 'assets'; 

% JDBC Parameters
jdbcString = sprintf('jdbc:mysql://%s/%s', host, dbName);
jdbcDriver = 'com.mysql.jdbc.Driver';


% Set this to the path to your MySQL Connector/J JAR
javaaddpath('mysql-connector-java-5.1.6-bin.jar')

% Create the database connection object
dbConn = database(dbName, user , password, jdbcDriver, jdbcString);

% Check to make sure that we successfully connected
if isconnection(dbConn)
    % Fetch the symbol, market cap, and last close for the 10 largest
% market cap ETFs
    result = get(fetch(exec(dbConn, 'SELECT info.symbol,info.marketcap,series.close FROM info, series WHERE info.type=''ETF'' AND info.id = series.symbolid AND series.date = ''2008-04-11'' ORDER BY marketcap DESC LIMIT 10')), 'Data');
    disp(result);

% If the connection failed, print the error message
else
    disp(sprintf('Connection failed: %s', dbConn.Message));
end

% Close the connection so we don't run out of MySQL threads
close(dbConn); 
 

Output:
    'SPY'     [8.2300e+010]    [133.3800]
    'EFA'     [4.5420e+010]    [ 72.6400]
    'EEM'     [2.3850e+010]    [139.3400]
    'GLD'     [1.9260e+010]    [ 91.3000]
    'QQQQ'    [1.7040e+010]    [ 44.2800]
    'IVV'     [1.6410e+010]    [133.5200]
    'IWF'     [1.2860e+010]    [ 55.2500]
    'DIA'     [1.0830e+010]    [123.3400]
    'IWM'     [1.0470e+010]    [ 68.7200]
    'VTI'     [9.7800e+009]    [132.2900]