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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
##Variables
|
| 2 |
+
|
| 3 |
+
import os
|
| 4 |
+
|
| 5 |
+
CONFIG = {
|
| 6 |
+
"bearer_token": os.environ.get("bearer_token")
|
| 7 |
+
}
|
| 8 |
+
|
| 9 |
+
sent_model_id = 'nickmuchi/optimum-finbert-tone-finetuned-fintwitter-classification'
|
| 10 |
+
topic_model_id = 'nickmuchi/optimum-finbert-tone-finetuned-finance-topic-classification'
|
| 11 |
+
task = 'text-classification'
|
| 12 |
+
|
| 13 |
+
sentiments = {"0": "Bearish", "1": "Bullish", "2": "Neutral"}
|
| 14 |
+
|
| 15 |
+
topics = {
|
| 16 |
+
"0": "Analyst Update",
|
| 17 |
+
"1": "Fed | Central Banks",
|
| 18 |
+
"2": "Company | Product News",
|
| 19 |
+
"3": "Treasuries | Corporate Debt",
|
| 20 |
+
"4": "Dividend",
|
| 21 |
+
"5": "Earnings",
|
| 22 |
+
"6": "Energy | Oil",
|
| 23 |
+
"7": "Financials",
|
| 24 |
+
"8": "Currencies",
|
| 25 |
+
"9": "General News | Opinion",
|
| 26 |
+
"10": "Gold | Metals | Materials",
|
| 27 |
+
"11": "IPO",
|
| 28 |
+
"12": "Legal | Regulation",
|
| 29 |
+
"13": "M&A | Investments",
|
| 30 |
+
"14": "Macro",
|
| 31 |
+
"15": "Markets",
|
| 32 |
+
"16": "Politics",
|
| 33 |
+
"17": "Personnel Change",
|
| 34 |
+
"18": "Stock Commentary",
|
| 35 |
+
"19": "Stock Movement",
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
user_name = [
|
| 39 |
+
"Investing.com",
|
| 40 |
+
"(((The Daily Shot)))",
|
| 41 |
+
"Bloomberg Markets",
|
| 42 |
+
"FirstSquawk",
|
| 43 |
+
"MarketWatch",
|
| 44 |
+
"markets",
|
| 45 |
+
"FinancialTimes",
|
| 46 |
+
"CNBC",
|
| 47 |
+
"ReutersBiz",
|
| 48 |
+
"BreakingNews",
|
| 49 |
+
"LiveSquawk",
|
| 50 |
+
"NYSE",
|
| 51 |
+
"WSJmarkets",
|
| 52 |
+
"FT",
|
| 53 |
+
"TheStreet",
|
| 54 |
+
"ftfinancenews",
|
| 55 |
+
"BloombergTV",
|
| 56 |
+
"Nasdaq",
|
| 57 |
+
"NYSE",
|
| 58 |
+
"federalreserve",
|
| 59 |
+
"NewYorkFed",
|
| 60 |
+
"sffed",
|
| 61 |
+
"WSJCentralBanks",
|
| 62 |
+
"RichmondFed",
|
| 63 |
+
"ecb",
|
| 64 |
+
"stlouisfed",
|
| 65 |
+
"WorldBank",
|
| 66 |
+
"MarketCurrents",
|
| 67 |
+
"OpenOutcrier",
|
| 68 |
+
"BullTradeFinder",
|
| 69 |
+
"WallStChatter",
|
| 70 |
+
"Briefingcom",
|
| 71 |
+
"SeekingAlpha",
|
| 72 |
+
"realDonaldTrump",
|
| 73 |
+
"AswathDamodaran",
|
| 74 |
+
"ukarlewitz",
|
| 75 |
+
"alphatrends",
|
| 76 |
+
"Investor666",
|
| 77 |
+
"ACInvestorBlog",
|
| 78 |
+
"ZorTrades",
|
| 79 |
+
"ScottNations",
|
| 80 |
+
"TradersCorner",
|
| 81 |
+
"TraderGoalieOne",
|
| 82 |
+
"option_snipper",
|
| 83 |
+
"jasonleavitt",
|
| 84 |
+
"LMT978",
|
| 85 |
+
"OptionsHawk",
|
| 86 |
+
"andrewbtodd",
|
| 87 |
+
"Terri1618",
|
| 88 |
+
"SunriseTrader",
|
| 89 |
+
"traderstewie",
|
| 90 |
+
"TMLTrader",
|
| 91 |
+
"IncredibleTrade",
|
| 92 |
+
"NYFedResearch",
|
| 93 |
+
"YahooFinance",
|
| 94 |
+
"business",
|
| 95 |
+
"economics",
|
| 96 |
+
"IMFNews",
|
| 97 |
+
"Market_Screener",
|
| 98 |
+
"QuickTake",
|
| 99 |
+
"NewsFromBW",
|
| 100 |
+
"BNCommodities",
|
| 101 |
+
]
|
| 102 |
+
|
| 103 |
+
user_id = [
|
| 104 |
+
"988955288",
|
| 105 |
+
"423769635",
|
| 106 |
+
"69620713",
|
| 107 |
+
"59393368",
|
| 108 |
+
"3295423333",
|
| 109 |
+
"624413",
|
| 110 |
+
"69620713",
|
| 111 |
+
"4898091",
|
| 112 |
+
"20402945",
|
| 113 |
+
"15110357",
|
| 114 |
+
"6017542",
|
| 115 |
+
"21323268",
|
| 116 |
+
"28164923",
|
| 117 |
+
"18949452",
|
| 118 |
+
"15281391",
|
| 119 |
+
"11014272",
|
| 120 |
+
"35002876",
|
| 121 |
+
"18639734",
|
| 122 |
+
"21323268",
|
| 123 |
+
"26538229",
|
| 124 |
+
"15072071",
|
| 125 |
+
"117237387",
|
| 126 |
+
"327484803",
|
| 127 |
+
"16532451",
|
| 128 |
+
"83466368",
|
| 129 |
+
"71567590",
|
| 130 |
+
"27860681",
|
| 131 |
+
"15296897",
|
| 132 |
+
"2334614718",
|
| 133 |
+
"2222635612",
|
| 134 |
+
"3382363841",
|
| 135 |
+
"72928001",
|
| 136 |
+
"23059499",
|
| 137 |
+
"25073877",
|
| 138 |
+
"33216611",
|
| 139 |
+
"37284991",
|
| 140 |
+
"15246621",
|
| 141 |
+
"293458690",
|
| 142 |
+
"55561590",
|
| 143 |
+
"18560146",
|
| 144 |
+
"244978426",
|
| 145 |
+
"85523269",
|
| 146 |
+
"276714687",
|
| 147 |
+
"2806294664",
|
| 148 |
+
"16205561",
|
| 149 |
+
"1064700308",
|
| 150 |
+
"61342056",
|
| 151 |
+
"184126162",
|
| 152 |
+
"405820375",
|
| 153 |
+
"787439438964068352",
|
| 154 |
+
"52166809",
|
| 155 |
+
"2715646770",
|
| 156 |
+
"47247213",
|
| 157 |
+
"374672240",
|
| 158 |
+
"19546277",
|
| 159 |
+
"34713362",
|
| 160 |
+
"144274618",
|
| 161 |
+
"25098482",
|
| 162 |
+
"102325185",
|
| 163 |
+
"252751061",
|
| 164 |
+
"976297820532518914",
|
| 165 |
+
"804556370",
|
| 166 |
+
]
|
| 167 |
+
|
| 168 |
+
def convert_user_names(user_name: list):
|
| 169 |
+
'''convert user_names to tweepy format'''
|
| 170 |
+
users = []
|
| 171 |
+
for user in user_name:
|
| 172 |
+
users.append(f"from:{user}")
|
| 173 |
+
|
| 174 |
+
return " OR ".join(users)
|