That’s the rationale behind a bot, created by Google lead software engineer Max Braun, that monitors Twitter for presidential tweets about publicly traded companies, then buys or short-sells stock based on whether Donald Trump is attacking or praising the firm.

Braun’s simulation of his software’s performance brought returns averaging 59 percent, he wrote in a Medium post.

“For your convenience, it also tweets out a summary as @Trump2Cash each time it springs into action,” wrote Braun, who was the tech lead on the software platform for the Google Glass “smart” eyeglasses.

The effects of Trump’s twittering on the stock market have been documented.

“After President Trump slammed Lockheed Martin on Dec. 23 for the “tremendous cost” of its fighter jets, the company’s stock price dropped $2.75 (2 percent),” according to a Washington Post article Feb. 8. “Less than two weeks later, he blasted General Motors for assembling cars in Mexico, and the automaker’s share value fell 24 cents (.7 percent).

“Then he took aim at Toyota for building a new Mexican plant, delivering an apparent 64-cent blow (.07 percent).”

Braun indicated he didn’t make the bot to line his own wallet — he’ll donate his personal profit from the bot to Planned Parenthood, the American Civil Liberties Union and the National Resources Defense Council.

If that list of groups which have all made public statements against Trump suggests Braun’s bot was built on an ideological basis, his explanation will not surprise.

“Like many who call the United States their home, I have been worried and confused by the start to Donald Trump’s presidency,” wrote Braun, who works on robots in Google’s “X” lab for experimental “moonshots.”

“It’s hard to know how to react to the misdirected anger, the blatant racism, and the ‘alternative facts,’ which are increasingly threatening our civil liberties and our planet.

“It’s important that we take to the streets and fight back … Personally, I have a very particular set of skills, skills that allow me to have some fun with Mr. Trump’s emotional incontinence and maybe effect positive change along the way.”

However, two days after Braun published the essay Feb. 6, investors threw a wrench in the works, after Trump on Twitter attacked fashion retailer Nordstrom for dropping his daughter Ivanka’s brand.

Braun’s bot gave Nordstrom a thumbs-down in the wake of the tweet. The stock rose right after Trump tweeted, then slipped, then climbed again, finishing the day up 4 percent at $44.53, according to the Washington Post.

As of early afternoon Feb. 10, Nordstrom’s share price was up even more, at $45.

I was paid $104000 in 2016 by doing an online job a­n­d I did that by wor­king part time f­o­r few hrs on daily basis. I followed an earning opportunity I found on-line and I am so amazed that I was able to earn such great money. It’s very user friendly a­­n­­d I’m just so happy that i learned about it. Here is what i do… http://statictab.com/dntj48t