25 ms·
Trump2cash – A stock trading bot powered by Trump tweets
- B1FF_PSUVM 10y ago> mention any publicly traded companies How often did that happen in the past? (Not paying attention, specialty of the house ;-)
- redlum1 10y agoYou can check that at https://twitter.com/Trump2Cash https://twitter.com/Trump2Cash.
- deleted 10y ago[deleted]
- chis 10y agoPretty clever and effective message. I'd put money on this being shared by all my friends on Facebook in a few days. Trump's last couple tweets have backfired and actually increased his targets' stock price though. You might have to flip the algorithm around if this continues.
- espadrine 10y agoI read it as the stock market betting on the constitution. Mr Trump is not allowed to impact Nordstrom negatively for his daughter's sake. But most of the other tweets are about cases where he could harm them as POTUS.
- phalangion 10y agoIf he can't do anything, why would the stock change at all?
- espadrine 10y agoSpeculation again: it highlighted that Nordstrom would not be pressured into a decision that would yield poorer results.
- MBCook 10y agoWouldn't that be illegal? If you trade fast enough it still works. Nordstroms took a hit for few minutes before coming out slightly ahead.
- Klockan 10y ago> Nordstroms took a hit for few minutes before coming out slightly ahead. That effect is most likely due to automated traders trying to profit from Trumps tweets.
- DanBC 10y agoBut see this, which says his tweets generally don't make much difference: https://www.ft.com/content/a962c1f8-ee44-11e6-930f-061b01e23655 https://www.ft.com/content/a962c1f8-ee44-11e6-930f-061b01e23...
- tmalsburg2 10y agoThis is fun. However, does this bot perform better than a random bot? and if yes, how much?
- parhurs 10y agoI'm sure the data is inconclusive for now.
- Kurtz79 10y agoI'm also sure that a fair number of data samples could be obtained in a very short time.
- tmalsburg2 10y agoNot sure, every Trump tweet that makes a positive or negative statement about a company adds one data point. So the number of samples is going to be rather small. However, whether the bot can be shown to perform significantly better than chance also depends on the size of the effect of a Trump tweet. If they produce huge bumps, a small number of tweets might be enough to show that this bot is working. Would be nice to be able to put a number on this.
- cxseven 10y agoAccording to http://trump2cash.biz/ http://trump2cash.biz/ , "Overall, the algorithm seems to succeed more often than not: The simulated fund has an annualized return of about 59% since inception. There are limits to the simulation and the underlying data, so take it all with a grain of salt."
- tmalsburg2 10y agoYes, I saw that. What we don't know is whether the bot just got lucky. Inferential stats are needed to determine this.
- jagermo 10y agoNordstrom went up after Trumps rant, didn't it? But all in all this looks like a fun thing to do.
- jnaddef 10y agoIf many people use this bot, it will make Trump's comments actually effective, which is a pretty bad idea imho. What about a bot which would do just the opposite?
- rhaps0dy 10y agoI think you have this backwards. If Trump tweets a negative sentiment, the bot buys from the company. If everyone did that, the price would go up - just the opposite of the current effect!
- etatoby 10y agoI know very little of the stock market, but shouldn't the bot buy shares when he tweets positive comments? Because that's when the stock is expected to rise and you can sell it later for a profit.
- duozerk 10y agoIndeed, but the comment you're responding to was tongue-in-cheek, specifically suggesting that Trump being positive of a stock is a negative indicator for it.
- slig 10y agoYou seem to have got it backwards: from https://github.com/maxbbraun/trump2cash/blob/02e66eddc4ea0666e4be1abec302cad7c48f2053/trading.py#L153-L161 https://github.com/maxbbraun/trump2cash/blob/02e66eddc4ea066... # Determine bull or bear based on sentiment direction. if sentiment > 0: strategy["action"] = "bull" strategy["reason"] = "positive sentiment" return strategy else: # sentiment < 0 strategy["action"] = "bear" strategy["reason"] = "negative sentiment" return strategy
- makerofthings 10y agoI like this. I think something similar for Theresa May and the GBP:EUR exchange rate might be a good addition.
- thenomad 10y agoWon't work as well: the market now prices in the drop in GBP after she speaks, so as soon as there's even a hint she's going to say something substantive, the market drops like a stone, then recovers a bit if she doesn't say anything too awful.
- captainmuon 10y agoBrilliant. I've been thinking about something like this for a while. Why don't you take it to the next level? Provoke Trump on Twitter, associating yourself with a company. Then short that company's stock and wait until he lashes out against them. Profit!
- rtpg 10y agoIt's weird because he probably doesn't read his mentions... except sometimes he RT's someone in his mentions? Is he looking?
- angry-hacker 10y agoHe's not the only one handing his Twitter account I'm sure.
- imafish 10y agoYes. Surely, he must have several other insane people helping him. I.e. that much insanity cannot physically be contained in a single human being.
- jmkni 10y agoEvery time he Tweets something, he gets tens of thousands of responses in a matter of minutes, and when he's not tweeting anything, people are still tweeting at him constantly. There's no way he even reads 1% of it.
- nodesocket 10y agoNovel project, but not useful. Trump tweeted thanks to Intel on Feb 8th which was a super positive tweet. Since then $INTC is down about 2.6%.
- xuki 10y agoHe tweeted negatively about Nordstrom, stock went up. We might be onto something here...
- ISL 10y agoOne can easily place bets on the volatility of a stock. If you expect it to move, but you don't know which direction, that is tradeable knowledge.
- Gupie 10y agoIt would work better is you knew in advance what Trump is going to tweet, not possible of course unless you work for twitter or for Trump?!
- laumars 10y agoThat would likely be classed as "insider trading": https://en.wikipedia.org/wiki/Insider_trading https://en.wikipedia.org/wiki/Insider_trading
- ryanlol 10y agoFor that you'd have to be an "insider" which obviously isn't the case here.
- laumars 10y agoYou don't need to be hired by the company to be classed as an insider (though that obviously also counts). If you are privy to non-public information (which you would be if you were forewarned about a Trump PR stunt before it happened) and then you trade stock based on that information then legally you could be classed as an insider. In fact that wiki link I posted earlier previously says just this: https://en.wikipedia.org/wiki/Insider_trading#Definition_of_.22insider.22 https://en.wikipedia.org/wiki/Insider_trading#Definition_of_... (last paragraph on 'Definition of "Insider"')
- ryanlol 10y agoWho is the "insider" in this context then? Here's a hypothetical scenario: My buddy Sean from the white house texted me a few days ago that "Trump is going to make negative comments about Nordstrom soon", I shorted Nordstrom stock based on this information and made huge profits when Trump said the things Sean promised he would. Do you think someone would be guilty of insider trading here? Nobody involved is connected to Nordstrom in any way.
- 10y ago
- hmate9 10y agoI think Nordstrom stock went up after a negative tweet because it was seen as good publicity for the company. Trump didn't actually "threaten" to retaliate or anything, whereas for companies like Ford or GM he actually said he would impose a heavy "border tax" if they opened factories elsewhere.
- beaconstudios 10y agoperhaps further sentiment analysis could be used to determine whether the tweet implies the company can expect government action for/against them.
- hmate9 10y agoMaybe a bit difficult to do so because of the limited amount of data, but we could maybe only look at the tweets with positive sentiment, in which case the stock price will likely go up. As it is good publicity for the company and Trump was positive about the stock as well.
- martin-adams 10y agoThis could make quite a fun experiment to see if it works. Crowdsource an investment of something like $10,000 and let it run for a year. At the end, donate all proceeds to charity.
- grif-fin 10y agoGood idea! Where to begin? Shall we go for refugee charity?
- mc42 10y agoI would say to organizations that directly support people, be it Direct Relief, The ACLU, or Charity: water. Other good options are FIRST, Girls Who Code, and The Geek Group, all orgs that focus on STEM Education and getting people into the STEM fields. Just to name a few groups to directly counterbalance his behavior.
- pc86 10y ago> Other good options are FIRST, Girls Who Code, and The Geek Group, all orgs that focus on STEM Education and getting people into the STEM fields. How do these technical organizations counterbalance anything he is doing?
- alkonaut 10y agoACLU!
- mc42 10y agoOh my goodness, I actually forgot them... Editing my comment, thank you!
- cLeEOGPw 10y agoTo Trump charity foundation.
- 10y ago
- gurgus 10y agoCool project! Makes me want to think of another fun way of crowdsourcing stock tips for fun. Maybe something like TwitchPlaysWallStreet?
- butler14 10y agoAn ad agency did this 3 weeks ago https://www.t-3.com/works/the-trump-and-dump-bot/ https://www.t-3.com/works/the-trump-and-dump-bot/
- AznHisoka 10y agoHow many times do we have to go over this? stocks are a random walk.
- Kadin 10y agoThat may or may not be true, but it's irrelevant in this case. The bot is basically front-running the market, or trying to anyway, by trading directly on a stimulus that the market (potentially) takes time to internalize and react to. If this worked, I'd expect the HF funds to start doing it too, and even faster, and then the advantage would be destroyed.
- lorenzhs 10y agoThis is not front running (which is illegal). It's trying to be faster than people who trade manually based on the same info. The term front running has a pretty clear definition, it's roughly when a broker trades on your orders before executing them.
- paulpauper 10y agothe problem is hedge funds are already on his twitter like white on rice. Maybe there is hope in looking for breaking news from less-followed accounts.
- ldev 10y ago>Girls Who Code Sexism is good as long as victims are men.
- kohanz 10y agoThe most prejudiced among us are always those quick to make the issue about themselves (poor me!) when someone tries to do something good for an underrepresented group. I assume you've never been to a "Girls who code" event (I have, and I'm a man), but if you had, I don't know how any reasonable person could think "this is a bad thing".
- mc42 10y agoPrecisely. Though I've never been to one personally (as a man), the women I know who have attended their events seem to benefit from it, as have the few men I know who have. The name may be "Girls Who Code", but the Boy Scouts & Girl Scouts aren't just boys and girls respectively.
- tombrossman 10y agoSexism[0] isn't the right word here, since it implies the belief that the victims are less able, which women are clearly not. I won't assume you hold that belief. Discrimination[1] is more neutral and is the better word to describe this situation. I do occasional technical talks or workshops for free and some organisers have asked to make them 'girls only'. I've always declined and made it clear that everyone will be welcome. I don't see any malice in people who want to do gender-specific events, but I do not agree that excluding people is the way to go. I say good luck to you if you are doing 'girls only' events. You are welcome to come to mine too, even though as a man I may not be welcome at yours. [0]http://dictionary.cambridge.org/dictionary/english/sexism http://dictionary.cambridge.org/dictionary/english/sexism [1]http://dictionary.cambridge.org/dictionary/english/discrimination http://dictionary.cambridge.org/dictionary/english/discrimin...
- kohanz 10y agoI presume that you also refuse to do talks or workshops where all the speakers, panelists or mentors are of one gender or race? If so, good on you. Look, you sound like a nice guy, so I don't mean this as a personal attack, but your take on this is a classic example of how good people can fall into the trap of their own privilege. You don't do events where men/boys are not allowed to attend (e.g. girls who code) and that sounds noble and ideal. However, it somewhat ignores the fact that the reason these events have come into existence is that our profession has for decades suffered from massive amounts of systemic discrimination (sexism in particular). Just because it's not encoded in a written set of rules, doesn't mean it hasn't always been present. For men/boys, there are infinitely more events to attend where the gender balance will always be swung widely in their favor. When a woman developer joins/joined an all-male development team, do you think they have the luxury of being able to say "No, I won't do that"? Sure, there's no rule saying the team should be only male, but that's the "systemic" part. This is the "privilege" I'm referring to. You can say "no", because there are plenty of other talks and workshops for you to take part in. There is little to no negative impact on you from refusing those invites. What if women-only workshops were the predominant event out there? I don't think events like Girls Who Code are the final solution. I agree with you that, in the end, an industry and events open to everyone is the solution. However, we've reached such a massive imbalance by operating via the status quo that I think things like Girls Who Code, despite being "discriminatory" by a textbook definition, have a net positive effect, rather than the opposite. I'll happily volunteer my time to teach more girls to again when I have the chance. I don't think the lip-service of saying our industry and events are open to both men and women will tip the scales towards equality.
- karangoeluw 10y agoI actually did some basic analysis of this recently - can you really make money in the stock market trading on Trump's tweets. https://medium.com/karan/can-you-really-make-money-when-realdonaldtrump-tweets-about-a-company-1f99a9e337ca#.d8q5fmp9c https://medium.com/karan/can-you-really-make-money-when-real... My answer was maybe but I'd rather not put my money at the mercy of a lunatic.
- tedmiston 10y agoFrom the admittedly small data set of 6 tweets, it looks like the answer is "no" with one exception where the market took over an hour to react. I'm curious why the Ford lag time was so different.
- justinlaster 10y agoBecause Ford's actions had been expected/known for some time. Trump literally had nothing to do with it. You don't just spin up factories like an EC2 instance. His other tweets regarding other companies were all future-tense, and companies he is in a position to bully. Except for Nordstrom, of course.
- deelowe 10y agoYour answer according to the article actually appears to be "no."
- throwaway2048 10y ago
- dsacco 10y agoVery cool. Funds have been capitalizing on Trump's tweets since at least December (but probably November) of 2016: https://www.bloomberg.com/view/articles/2016-12-07/flash-crashes-and-trump-trading https://www.bloomberg.com/view/articles/2016-12-07/flash-cra... I'd be interested in learning why TradeKing was used , as I haven't used it myself - was it for an especially solid API, or just because TradeKing is easy to get set up and doesn't require a minimum investment? If anyone wants to play around with this and has at least $10k to play with, Interactive Brokers will give you better fees. OP, you might be interested in Quantopian's Zipline algorithmic trading library, which is also in Python: https://github.com/quantopian/zipline https://github.com/quantopian/zipline Also, I feel like there should be a disclaimer that given how accessible this strategy is (both in required skill and resources) and how much attention the Trump tweets phenomenon has gotten, any alpha from this has been almost certainly lost to other firms. This is a cool project, but it's probably not actually an effective strategy anymore.
- joeyspn 10y ago> OP, you might be interested in Quantopian's Zipline algorithmic trading library, which is also in Python: https://github.com/quantopian/zipline https://github.com/quantopian/zipline Or backtrader (backtesting and live trading with Oanda and IB) https://github.com/mementum/backtrader https://github.com/mementum/backtrader
- dsacco 10y agoNice, now I've got something else to play with this weekend.
- citruspi 10y ago> If anyone wants to play around with this and has at least $10k to play with, Interactive Brokers will give you better fees. For anyone 25 or younger who's reading this, the required minimum for you is $3k[0]. [0]: https://www.interactivebrokers.com/en/index.php?f=4969 https://www.interactivebrokers.com/en/index.php?f=4969
- mburst 10y ago
- chatwinra 10y agoYou know at the end of Men in Black it zooms out and our galaxy is just one marble in a galactic game? I feel like this game is just a small scale version of the one being played by a higher force by making Trump president.
- fredley 10y agoThe higher force being Putin? /s (sort of)
- swalsh 10y agoThe fact that Trump has the vocabulary of an 8th grader makes this a lot easier.
- FatAmericanDev 10y agoAs does most of the country...
- mikeash 10y agoFrom a brief search, most presidential candidates speak at around an 8th grade level. (Which makes sense. They need to appeal to a broad audience, and speaking at a higher level is usually counterproductive anyway unless you have a specialized audience.) Trump's speaking level is more like 3rd or 4th grade.
- wahern 10y agoFrom a recent Fresh Air interview with Trevor Noah. Earlier on he explains with a more personal anecdote why simpler language matters. But is there such a thing as too simple? Is 8th grade language more effective than 4th grade language? Later on Trevor Noah says You know, funny enough, one of the biggest moments of realization was when Donald Trump won the election because when I came into the show, I said, I think this guy can win. This was when he first came down that escalator. He gave his first speech. And then I was like, wow, this guy's going to do well. And I remember people laughed at me. People were like, oh, you silly ignorant person who's just come to this world. You clearly shouldn't be at "The Daily Show" 'cause you don't know what you're talking about. And I was like, but I don't know. He seems like he connects with people. I can relate to him as a performer. I can see what tools he's using. He's good at riffing. He's good at taking the crowd on a journey. I can see what he's doing. And people would say - and all throughout the race - and there were times when, on the show, I would mention it. You know, I mean, that's why I said Trump reminds me of an African dictator. And that's where that came from because everyone said to me, this guy is - he's just a fool. He's just - he's a buffoon. I said, yeah, you can say that. But I've seen this before. I have seen this before. I've seen clowns that go on to take over their countries. I've seen buffoons who end up ruling their worlds. And it came to pass. Source: http://www.npr.org/2016/12/16/505847054/trevor-noah-says-he-grew-up-in-the-shadow-of-a-giant-his-mom
- mhuffman 10y agoI have been doing the opposite. Whenever Trump signs on executive order or signals an intention, I presume it will either fail or will end in bad results for the poor and middle class. Then, working as if that were true, I see if there are any stocks or ETFs that would benefit from that and buy some. I have been doing pretty good!
- emcq 10y agoThe market as a whole is going up. Are your seeing above market average returns?
- mhuffman 10y agoVery much so! [1] You can even see on the chart how there was very little until inauguration, giant leaps after unpopular EO's, and you can even see the portfolio drop when Trump took a beat and eased up on the EOs after Feb 3rd. [1] http://i.imgur.com/OoeMEJF.png http://i.imgur.com/OoeMEJF.png
- carlmcqueen 10y agoRegardless of this bot being complete, there are better options already mentioned using options instead of short term stock purchases. Looks like deciding the sentiment of the tweet is still on the to-do list. def get_sentiment(self, text): """Extracts a sentiment score [-1, 1] from text.""" # TODO: Determine sentiment targeted at the specific entity.
- thedrake 10y agoanother version could be to capitialize on this: "The efficient markets hypothesis may be "the best established fact in all of social sciences," but the best established fact in all of financial markets is that, when there is news about a big famous private company going public or being acquired, the shares of a tiny obscure public company with a similar name will shoot up. I don't know what that tells you about the efficient markets hypothesis, but it happened to Nestor, Inc., and to Tweeter Home Entertainment, and to Oculus VisionTech Inc., and now it has happened to SNAP Interactive Inc.: In what is almost surely a case of mistaken identity, investors sent shares in a little known startup called SNAP Interactive Inc., ticker STVI, surging 164 percent in the four days since Snap Inc. filed for a $3 billion initial public offering. The $69 million SNAP Interactive makes mobile dating apps, while the IPO aspirant is the parent of the popular Snapchat photo-sharing app. These stories are always less impressive when expressed in dollar terms than they are in percentages. In the four trading days since Snap Inc. filed its S-1, SNAP Interactive has traded 19,963 shares, worth less than $200,000, according to Bloomberg data. If you had a cunning plan to buy up SNAP shares and sell them for a quick profit when Snap filed to go public, it might have worked, but not in particularly huge size." article here: https://www.bloomberg.com/view/articles/2017-02-09/quasi-indexers-growth-and-confusion https://www.bloomberg.com/view/articles/2017-02-09/quasi-ind...
- warbiscuit 10y agoThere was an article a while back -- https://news.ycombinator.com/item?id=1144548 https://news.ycombinator.com/item?id=1144548 -- purporting that the efficient market hypothesis is true if and only if P = NP. ... which I'd argue implies social science is overly optimistic about that hypothesis.
- idanoeman 10y agoThat also implies that if the market is very close to efficient, you need absolutely massive amounts of computational power to bring it even closer (i.e. to make money). So even if it is inefficient, that doesn't mean anyone can reasonably expect to find exploitable patterns.
- 10y ago
- theocean154 10y agoI have one of these as well, but i would've died if it was live trading during the nordstrom incident. They've gone up quite a bit since then.
- djb_hackernews 10y ago>This bot watches Donald Trump's tweets and waits for him to mention any publicly traded companies. Ok, simple enough, go on. > When he does, it uses sentiment analysis to determine whether his opinions are positive or negative toward those companies. Eh, sentiment analysis isn't perfect but it has come a long way, plus Trump does typically say what he means in simplistic language. > The bot then automatically executes trades on the relevant stocks according to the expected market reaction. Ah market psychology. Stop. Do not pass Go. Do not collect $200. This is the tricky bit that a toy project will never get right and turns your slick algorithmic trading project into a monkey and a dart board. Though this is a sweet example of an API mashup.
- willis77 10y agoCan confirm. I've been running this bot for 8 minutes and currently have a $7.8 million short position against the fake NYT. SEE YOU IN COURT, @maxbbraun!
- maxsilver 10y agoSo, we should just invert the bots request. If Trump reacts negatively, the bot interprets that as a buy. And a positive Trump reaction should be a sell. Now your holding lots of Nordstrom and NYT, and riding the wave up. Congrats, your going to be a millionaire!
- ellisv 10y agoInstead of sentiment analysis directly maybe use a model to predict whether the stock is going to rise or fall.
- deleted 10y ago[deleted]
- sandworm101 10y agoInvert references to media-related companies. And double down on references to defence contractors.
- gliese1337 10y agoThis bot watches Donald Trump's tweets and waits for him to mention any publicly traded companies. When he does, it uses sentiment analysis to determine whether his opinions are positive or negative toward those companies. The bot then automatically executes trades on the relevant stocks according to the expected market reaction. OK, so what's the expected market reaction? If Trump hates your company, does that make your stock go up, or down?
- jbmorgado 10y agoDown on the immediate, up after some hours: The article just mentions how it ended the day (UP), but it started by going DOWN quite a few % after Trump spoke against it: http://fox6now.com/2017/02/09/nordstrom-stock-defies-president-trump/amp/ http://fox6now.com/2017/02/09/nordstrom-stock-defies-preside...
- AltGr 10y agoI can't state how stupid this is. As if that person's bullshit's power of nuisance wasn't large enough, let's add automated echo chambers with a direct effect on the economy! Don't be surprised if this crazy economic system can collapse any seconds with ideas like this.
- alex- 10y agoAs the poster doesn't this gives Trump the power to manipulate markets with nothing more than a tweet? You could argue he already has this power, but before the message needed to resonate with a large collective of people. Any public figure (like Warren Buffet, etc) can express an opinion that might effect the stock they are commenting on. However as this group of people automate trades on only the contents of his tweets (and not say the contents of the tweet as well as past company performance, current POTUS approval ratings, dividend plans etc) he gains a scary amount of control over the markets. To put another way. The only people who know what he will tweet earlier than these bots are Trump and maybe a select group of people he tells before hand.
- drak0n1c 10y agoPoliticians impacting the stock market is nothing new. Pipeline and coal companies plummeted with Obama's executive orders, and the executive branch DOJ created a huge drop in prison stocks with what was effectively an indirect tweet. Solar stocks zig zagged according to the latest Solyndra and renewables subsidy activity. The only thing new is Twitter as a more easily machine-readable mouthpiece. Congress actually gets a free pass on buying and selling stocks with insider information and many have done so for decades: http://www.cbsnews.com/news/congress-trading-stock-on-inside-information/ http://www.cbsnews.com/news/congress-trading-stock-on-inside...
- dlgeek 10y agoI think what's novel/different here is the examples you all cited are examples of market reaction to government action, compared to, let's call it "executive sentiment". The distinction here is people are anticipating future actions based a politician expressing feelings rather than taking action.
- rthomas6 10y ago(I know this is just for fun, but...) I believe this won't work because of high-frequency trading. By the few seconds this latent python script will take to get the tweet, analyze the tweet, and execute a trade, high-speed bots will have already done something similar to a price level they decided was appropriate using sophisticated algorithms. So basically, instead of this bot betting that Trump's tweets will change stock prices, you're actually betting on the HFT bots being wrong about how much Trump's tweets change stock prices.
- Paradigma11 10y agoThis implies that HFT algos know of Trumps tweets. Is this really done?