NEW YORK (AP) — Sam Bankman-Fried authorized the illegal use of FTX customers’ funds and assets to plug financial gaps at an affiliated hedge fund from the exchange’s earliest days, FTX’s co-founder Gary Wang told a New York jury on Friday, as prosecutors pressed their case that Bankman-Fried was the mastermind behind one of the biggest frauds in U.S. history. Eventually, the losses at the hedge fund, Alameda Research, became so large that there was no way to hide them any longer, Wang said in his second day of testimony. “FTX was not fine,” Wang said, referring to the now-infamous tweet that Bankman-Fried wrote only a few days before the exchange filed for bankruptcy in November 2022. Prosecutors allege that Bankman-Fried, 31, stole billions of dollars from investors and customers in order to fund a lavish lifestyle in The Bahamas and buy the influence of politicians, celebrities and the public. Wang was FTX’s chief technology officer and is part of what has been referred to as the “inner circle” of FTX executives who have agreed to testify against Bankman-Fried in exchange for leniency in their own criminal cases. He is expected to finish his testimony Tuesday. Wang has pleaded guilty to wire fraud, securities and commodities fraud as part of his agreement with prosecutors. Prosecutors hope to have Caroline Ellison, the former CEO of Alameda and Bankman-Fried’s ex-girlfriend, take the stand Tuesday. Wang and Bankman-Fried started Alameda in 2017, then founded FTX in 2019. Wang told the jury that, at the direction of Bankman-Fried, he inserted code into FTX’s operations that would give Alameda Research the ability to make nearly unlimited withdrawals from FTX and have a line of credit up to $65 billion. Alameda was given these privileges initially because the hedge fund was the primary market maker for FTX’s customers in the exchange’s early days. Alameda took advantage of its unlimited withdrawal capabilities and lines of credit from the start, Wang said, in the forms of cryptocurrencies as well as dollars. Initially it was only a few million dollars but grew over the years. “It withdrew more funds than it had on exchange,” Wang said adding that the money that it withdrew “was money from (FTX) customers.” The relationship was effectively a two-way street, where the exchange could help out the hedge fund and vice versa as FTX quickly grew between 2019 and 2022. At one point, when a loophole in FTX’s software was exploited to cause hundreds of millions of dollars in paper losses on a particular cryptocurrency, Wang said Bankman-Fried ordered that loss to be moved onto Alameda’s balance sheet because FTX’s financial condition was more visible to the public while Alameda’s balance sheet was not. Alameda’s deep financial ties to FTX were in contrast to Bankman-Fried’s public statements that the hedge fund was “no different” from any other FTX customer. The losses at Alameda reached as much as $14 billion in the months leading up to the exchange’s bankruptcy. Bankman-Fried and Wang discussed solutions to the problems at Alameda in the summer of 2022, including shutting down the hedge fund, but by then it was too late. “(Alameda) had no way of repaying this,” Wang testified. FTX filed for bankruptcy Nov. 11. Wang testified that, within hours of FTX filing for bankruptcy, Bankman-Fried ordered him to send the bulk of FTX’s remaining assets to the securities regulators in The Bahamas instead of to the U.S. authorities handling the bankruptcy. Bankman-Fried said the Bahamian regulators “seemed more friendly to him, and they seemed more likely to let him stay in control of the company compared to the U.S.,” Wang testified. Following this exchange, Wang contacted the FBI on Nov. 17, saying he knew what he had done was wrong and he wanted to avoid a long prison sentence for his crimes. In opening statements this week, Bankman-Fried’s lawyers claimed that Wang and other FTX lieutenants failed to do their jobs, including setting up appropriate financial hedges that would have protected FTX from last year’s crash in crypto prices. They said Bankman-Fried believed he was managing a liquidity crisis caused by cryptocurrency values that collapsed by over 70% and criticism from one of his biggest competitors that caused a run on his companies by customers seeking to recover their deposits. In their cross examination of Wang on Friday, Bankman-Fried’s lawyers tried to downplay any special relationship between Alameda and FTX, saying it was not unusual for market-making entities such as Alameda to have losses or borrow funds from an exchange. Copyright 2023 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.