Kweku Adoboli, 32, who stands accused of committing Britain's biggest ever fraud, has claimed senior managers were fully aware of his activities and encouraged him to take risks to make profits for UBS.
He denies any wrongdoing, saying he was pressured by managers to take risks.
But prosecutors claim that in a bid to boost his status and bonuses Adoboli exceeded his trading limits and faked records to cover his tracks.
Prosecution lawyer Sasha Wass told jurors that he was "a gamble or two away from destroying Switzerland's largest bank for his own gain".
"He did all of this by exceeding his trading limits, by inventing fictitious deals to conceal this and then he lied to his bosses," Wass said.
"Mr Adoboli's motive for this behaviour was to increase his bonus, his status within the bank, his job prospects and of course his ego," she said.
"Like most gamblers, he believed he had the magic touch," Wass said.
"Like most gamblers, when he lost, he caused chaos and disaster to himself and all of those around him."
Southwark Crown Court in London heard during the two-month trial that at one point he was at risk of causing the bank losses of $12 billion.
But Adoboli, the privately-educated son of a Ghanaian former UN official, told jurors that he had dedicated his life to benefiting the bank and viewed his colleagues at UBS's London offices as "family".
He was in tears as he gave evidence, saying what he had done was "not fraudulent — it is finding a way to do your job".
Adoboli is accused of two counts of fraud and four counts of false accounting between October 2008 and September 2011.