(Bloomberg) -- Foreign investors that had bet against Japanese equities are now scrambling to cover their shorts, triggering a stellar rebound in the nation’s stocks.

They sold more than $41 billion of Japanese stock futures in the first five months of the year, the most since at least 2015, according to data from Japan Exchange Group. Yet in the second half of May they turned net buyers, loading up about $7 billion.

Foreigners, mainly from Europe, sold off stock futures in huge volumes in Japan -- a highly liquid market -- in the wake of the coronavirus to either hedge their positions or make speculative bets, according to Masanori Ikunaga, a fund manager at Sumitomo Mitsui DS Asset Management Co. The doomsday scenario those investors had expected didn’t pan out, thanks to stock buying by the Bank of Japan.

“Foreigners are left with losses on their positions,” Ikunaga said. “They can’t help but hurry to buy and cover their positions at high prices.”

Since the depths of the March selloff, Japan’s main two equity gauges have defied the heavy foreign selling, scoring returns that are among the best in Asia. The Topix has risen almost 30% from its recent low while the Nikkei 225 Stock Average has rebounded 37%, thanks to aggressive buying by the BOJ and domestic investors.

While overseas traders rush to cover their bets, the sustainability of their recent buying “will have to do with whether economic indicators continue to improve or not,” said Kazuyuki Terao, Tokyo-based chief investment officer at Allianz Global. “Because the downdraft had been so steep, there is a good chance economic indicators will improve. As long as they do, the foreign buying may continue.”

The last day to trade June futures contracts on the Nikkei 225 Stock Average is next Thursday. Ikunaga of Sumitomo Mitsui DS Asset expects the foreign buying to fade following their expiry.

“This foreign buying was triggered under unusual market circumstances,” he said. “Caution will be needed for market participants once this buying runs its course.”

©2020 Bloomberg L.P.