TheStreet.com Ratings provides exclusive stock, ETF and mutual fund ratings and commentary based on award-winning, proprietary tools. Its "safety first" approach to investing aims to reduce risk while seeking total return performance.BOSTON ( TheStreet) -- TheStreet.com's stock-rating model upgraded Canadian Pacific Railway ( CP) to "buy." The numbers: Second-quarter revenue decreased 16% to $1 billion as net income inched up 2% to $157 million. Earnings per share fell 7% to 93 cents, hurt by a significantly higher share count. The operating margin climbed from 21% to 22% and the net margin jumped from 13% to 15%. A quick ratio of 0.6 indicates a weak liquidity position, but the cash balance has grown 313% to $157 million since the year-earlier quarter. And a debt-to-equity ratio of 0.7 demonstrates reasonable leverage. The stock: Canadian Pacific has increased 33% in 2009, beating major U.S. indices. At a 2009 price-to-earnings ratio of 17, the stock is on par with the S&P 500 Index, but at a discount to its peer group. The model upgraded transaction-processor MasterCard ( MA) to "buy." The numbers: Second-quarter revenue increased 3% to $1.3 billion as the company swung to a profit of $349 million, or $2.67 per share, from a loss of $746 million, or $5.74 per share, in the year-earlier period, helped by improved pricing, more transactions processed, and fewer rebates and incentives. The operating margin increased from 33% to 44% and the net margin climbed from negative territory to 27%. MasterCard has an outstanding financial position, especially when considering its size. A quick ratio of 1.3 indicates strong liquidity and the balance sheet holds just $21 million of debt, reflecting minimal leverage. The stock: MasterCard is up 36% in 2009, beating major U.S. indices. The stock trades at a 2009 price-to-earnings ratio of 18 and a 2010 P/E ratio of 15, but offers a dividend yield below 1%.