SHANGHAI (Reuters) - Short-term funding costs in China shot to their stiffest level in nearly 10 years on Thursday on fears of a cash crunch heading into its most important holiday of the year, but ended well off the day’s highs as state banks stepped in to offer more yuan supplies.

A 100 Yuan note is seen in this illustration picture in Beijing March 7, 2011. REUTERS/David Gray/File Photo

Chinese households and companies usually withdraw huge amounts of cash from banks ahead of the week-long Lunar New Year holiday, which starts on Jan. 27.

This year, the holiday also extends over the month-end, when corporate cash demand increases and some tax payments are due, adding to the drain.

While liquidity always tightens in China ahead of big holidays, and the People’s Bank of China (PBOC) routinely pumps more funds into markets to ensure there is ample liquidity, some traders say its injections have barely been keeping up with heavier demand this year.

A key overnight rate for borrowing funds surged to as high as 22.099 percent in early trade on Thursday - the highest since data became available in April 2007.

It was later pulled lower by speculation that authorities were ready to pump more liquidity into the market, but remained at a highly elevated level.

The onshore overnight implied deposit rate for yuan CNYONID=CNR finished the day at 8.602 percent, but was still well above Tuesday's close of 4.357 percent.

Some money rates and trading floor blood pressures shot up on Wednesday after the central bank surprised markets by not rolling over medium-term lending facility (MLF) loans which were due to mature that day.

Further MLF loans are due to mature on Thursday. The two batches of loans total 216.5 billion yuan ($31.5 billion), according to Reuters calculations.

The sudden surge in funding rates has also sparked volatility in the foreign exchange market, forcing traders with short positions against the yuan to bail out of their positions.

That has led to a solid strengthening in the beleaguered currency this week, though it dipped on Thursday on signs that state banks may be offering additional yuan supplies and after an overnight bounce in the U.S. dollar.

Spot yuan CNY=CFXS settled at 6.8760 per dollar at 4:30 p.m. (0830 GMT), 328 pips weaker than the previous late session close.

But it is up more than half a percent so far this week, on course for its best week since July. It has firmed around 1.1 percent so far this year as Chinese authorities try to slow capital outflows and quash speculators betting on further currency declines.

The official yuan midpoint CNY=PBOC was fixed at 6.8568 per dollar prior to the market open, 43 pips weaker than the previous fixing of 6.8525.

Analysts said Thursday’s fixing was set at a firmer level than their models had suggested.

The volume-weighted average rate of the benchmark seven-day repo CN7DRP=CFXS traded in the interbank market, considered the best indicator of general liquidity in China, also pulled back slightly on Thursday while remaining at high levels.

It closed at 2.6336 percent, compared with the previous close of 2.7607 percent, which was the highest since July 2015.

“The market has calmed down slightly. (But) we have U.S. President-elect Donald Trump’s inauguration in two days and that may create volatility again,” said a trader at a Chinese bank in Shanghai.

Chinese authorities are widely believed to have been involved in a sharp spike in offshore yuan funding costs earlier this month to support the currency. But it is still trading at more than eight-year lows.

The unexpectedly sharp onshore cash pinch comes despite central bank injections of a net 1.035 trillion yuan ($150.87 billion) through open market operations so far this week, nearly 10 times the amount it injected last week.

“Companies’ quarterly payments starting Jan.16 and seasonal cash demand are the key factors draining money out,” said a liquidity trader at a Chinese bank in Shanghai.

Some traders said they heard that the central bank had asked commercial banks in the morning about potential demand for MLF loans, but there was no indication if the bank would inject the funds later in the day.

“We hope the central bank will roll over the maturing MLF loans (on Thursday), but no one knows whether it will do it or not,” the trader said.

In offshore markets, the yuan was 0.5 percent firmer than onshore at 6.8438 per dollar.

Highlighting investors' strongly bearish views on the yuan, offshore one-year non-deliverable forwards contracts (NDFs)CNY1YNDFOR= traded at 7.1195, 3.69 percent weaker than the midpoint.

NDFs are considered the best available proxy for forward-looking market expectations of the yuan’s value.