The Federal Reserve Bank of New York has been probing major financial firms' exposure to BP Plc to ensure that if the oil giant buckles under the costs of the Gulf oil spill, it won't put Wall Street or the global financial system at risk, according to two sources familiar with the matter.

After poring over documents and asking banks about their exposure to BP over the past two weeks, the Fed found no systemic risk, and hasn't asked firms to alter their credit relationships with BP, the sources told Reuters.

The Fed gave banks' exposure to BP a passing grade, said one of the sources on condition of anonymity.

Beyond's BP survival prospects, the Fed examination underscores market uncertainty about how the spill's staggering clean-up bill might affect Wall Street, a fragile economic recovery, or the multitrillion dollar energy market.

BP until recently had stellar credit ratings and generated $30 billion of cash from its oil and gas production and trading over the last year, making it a golden counterparty for many financial firms that trade in energy, including the largest Wall Street banks.

Since April, when it began trying to plug an oil spill that has spewed up to 60,000 barrels a day into the U.S. Gulf, the company has lost $100 billion in stock market value and suffered several credit downgrades.

The soaring liability risk raised concern in banking circles that the company's financial woes could spread outside BP, prompting the Fed's examination.

Should the unexpected happen, and BP file for bankruptcy, the economic stakes are huge, potentially affecting the portfolios of some of the world's top banks and funds, not to mention up to 23,000 American jobs, the price of oil, and the easy credit that banks give to big oil companies.

Fed and BP officials declined comment. Banks that trade with BP wouldn't comment publicly.

OIL MAJOR ON FED RADAR

Looking at credit relationships is a routine part of the Fed's role. But exposure to oil majors has rarely been on the Fed's radar, sources said, since the companies control huge physical assets and produce cash commodities.

After being subject to harsh criticism for regulatory lapses in the run-up to the financial crisis, the Fed has worked to expand its policing of system-wide financial risk.

The examination came as some banks that trade with BP ran their own models to gauge losses if BP eventually fails to meet credit obligations.

We would be fine, said one London-based banker, whose bank buys credit default swap (CDS) protection before it enters any long-term swaps with BP.

The cost of those swaps have surged ten-fold since late April, lifting the price BP must pay to trade with the bank.

Other BP trading partners have already restricted the duration of trades they do with the firm, whose portfolio gives it the largest footprint in energy markets among oil majors.

Bank of America Merrill Lynch ordered oil traders to limit the time frame of oil trades with BP to one year. Last week, a firm that trades multi-year electricity swaps with BP followed suit, telling traders to cut back swaps to one year, a source told Reuters.

CNBC reported on Monday that Credit Suisse has cut the threshold for BP to pay margin when it trades with the bank.

Traders from three U.S. oil refiners said they have not changed trading terms with BP, but are considering it.

BP appears to have reduced its speculative oil trading, focusing instead on managing its own physical positions, two European traders said.

Unlike more conservative peers, such as Exxon Mobil, BP is deeply entwined in most energy trading markets, both for hedging purposes and as a speculator, and its books included billions of dollars in swaps on less-regulated over-the-counter markets.

BP's annual trading profits have sometimes run into the billions, analysts said.

But BP's golden trading pedigree is now losing some luster as counterparties size up the firm's spill costs.

The company has said it does not expect trouble meeting obligations, touting its ability to raise cash and credit even as it contends with the spill.

As we recently told investors, over the last four quarters we've generated $30 billion of cash flow, said BP spokesman Toby Odone.

BP told investors it held over $15 billion in available cash and credit on June 16. BP has since increased both by quite a bit, a source close to BP said.

The company also cut dividend payments to preserve cash.

SPILL BILL

Market concerns persist in spite of BP's efforts. Central to them -- and to the Fed examination -- is what might happen if BP can't bear an escalating spill bill, which may be rising by $250 million every day if the U.S. government seeks the maximum fines for polluters.

Everyone whose firm does business with BP will be looking closely at the risks now, said Dominick Chirichella, a senior partner at New York-based Energy Management Institute.

They have a lot of cash, but if they go into Chapter 11 then it's just a mess to collect anything.

BP has spent $2.4 billion in the clean-up effort, and set aside $20 billion to pay off claims against it, which total 74,000 so far.

Under the Clean Water Act, the U.S. may seek fines up to $4,300 per barrel of oil spilled into Federal waters.

Fitch Ratings recently downgraded BP's credit rating by six notches to just above junk grade. Standard & Poor's and Moody's also cut BP's ratings, which measure the likelihood of BP defaulting on debt.

The ratings also affect the way companies trade. BP's own guidelines say the oil giant may ask counterparties whose ratings are cut for higher margin or collateral. BP's limits its exposure to junk-rated counterparties to 20 percent.

BP reported having $7.82 billion in derivative assets in its held for trading portfolio at the end of 2009, including swaps, with natural gas as its biggest position.

BP reported $5.92 billion in fair value for trading liabilities on its books at the time.

(Additional reporting by Robert Campbell in Mexico City, Ikuko Kurahone in London, and Elinor Comlay in New York; Editing by Marguerita Choy)