mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-28 13:01:38 +00:00
Fix the cramer function (#1435)
This commit is contained in:
@@ -9,8 +9,6 @@ import numpy as np
|
||||
import yfinance as yf
|
||||
from bs4 import BeautifulSoup
|
||||
|
||||
from gamestonk_terminal.helper_funcs import get_user_agent
|
||||
|
||||
|
||||
def get_cramer_daily(inverse: bool = True) -> pd.DataFrame:
|
||||
"""Scrape the daily recommendations of Jim Cramer
|
||||
@@ -25,8 +23,18 @@ def get_cramer_daily(inverse: bool = True) -> pd.DataFrame:
|
||||
pd.DataFrame
|
||||
Datafreme of daily Cramer recommendations
|
||||
"""
|
||||
cramer_link = "https://madmoney.thestreet.com/screener/index.cfm"
|
||||
r = requests.get(cramer_link, headers={"User-Agent": get_user_agent()})
|
||||
|
||||
link = (
|
||||
"https://madmoney.thestreet.com/screener/index.cfm?showview=stocks&showrows=500"
|
||||
)
|
||||
r = requests.post(
|
||||
link,
|
||||
headers={
|
||||
"Content-Type": "application/x-www-form-urlencoded",
|
||||
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) "
|
||||
"AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.3 Safari/605.1.15",
|
||||
},
|
||||
)
|
||||
if r.status_code != 200:
|
||||
return pd.DataFrame()
|
||||
soup = BeautifulSoup(r.text, "html.parser")
|
||||
@@ -45,7 +53,7 @@ def get_cramer_daily(inverse: bool = True) -> pd.DataFrame:
|
||||
for tr in trs[1:]:
|
||||
rec.append(recs[tr.find_all("td")[3].find("img")["src"][-5]])
|
||||
|
||||
df = pd.read_html("https://madmoney.thestreet.com/screener/index.cfm")[0]
|
||||
df = pd.read_html(r.text)[0]
|
||||
df["Symbol"] = df.Company.apply(lambda x: re.findall(r"[\w]+", x)[-1])
|
||||
last_price = []
|
||||
for ticker in df.Symbol:
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,10 +1,20 @@
|
||||
,Date,Company,Symbol,Price,LastPrice,Change (%),Recommendation
|
||||
0,03/01,Academy Sports and Outdoo ,ASO,30.65,30.65,0.0,Buy
|
||||
1,03/01,Salesforce ,CRM,208.89,208.89,0.0,Buy
|
||||
2,03/01,Coterra Energy ,CTRA,24.36,24.36,0.0,Buy
|
||||
3,03/01,Domino's Pizza ,DPZ,432.21,432.21,0.0,Buy
|
||||
4,03/01,Nio ,NIO,21.87,21.87,0.0,Sell
|
||||
5,03/01,Origin Materials ,ORGN,5.51,5.51,0.0,Sell
|
||||
6,03/01,Rent-A-Center ,RCII,27.08,27.08,0.0,Sell
|
||||
7,03/01,B. Riley Financial ,RILY,59.07,59.07,0.0,Sell
|
||||
8,03/01,Stem ,STEM,9.33,9.33,0.0,Sell
|
||||
0,03/02,AEO ,AEO,21.33,19.34,-10.290000000000001,Buy
|
||||
1,03/02,Cemig ,CIG,2.61,2.67,2.25,Buy
|
||||
2,03/02,DigitalBridge ,DBRG,7.4,7.37,-0.41000000000000003,Sell
|
||||
3,03/02,Dow ,DOW,59.2,59.67,0.79,Buy
|
||||
4,03/02,Ford Motor ,F,18.1,17.6,-2.8400000000000003,Buy
|
||||
5,03/02,Foot Locker ,FL,30.98,31.0,0.06,Sell
|
||||
6,03/02,Innovative Industrial Pro ,IIPR,190.26,187.48,-1.48,Buy
|
||||
7,03/02,International Paper ,IP,42.01,42.23,0.52,Buy
|
||||
8,03/02,Nordstrom ,JWN,26.93,25.68,-4.87,Buy
|
||||
9,03/02,Kontoor Brands ,KTB,48.03,45.55,-5.4399999999999995,Buy
|
||||
10,03/02,Masimo ,MASI,153.63,152.46,-0.77,Buy
|
||||
11,03/02,Morgan Stanley ,MS,88.38,87.78,-0.6799999999999999,Buy
|
||||
12,03/02,Norwegian Cruise Line ,NCLH,19.06,18.56,-2.69,Buy
|
||||
13,03/02,Newell Brands ,NWL,23.68,23.82,0.59,Buy
|
||||
14,03/02,Okta ,OKTA,182.7,167.98,-8.76,Buy
|
||||
15,03/02,Pfizer ,PFE,47.7,47.83,0.27,Buy
|
||||
16,03/02,Snowflake ,SNOW,264.69,224.02,-18.15,Buy
|
||||
17,03/02,Simon Property Group ,SPG,138.77,139.41,0.45999999999999996,Buy
|
||||
18,03/02,Tesla ,TSLA,879.89,839.29,-4.84,Sell
|
||||
|
||||
|
@@ -1,10 +1,20 @@
|
||||
,Date,Company,Symbol,Price,LastPrice,Change (%),Recommendation,InverseCramer
|
||||
0,03/01,Academy Sports and Outdoo ,ASO,30.65,30.65,0.0,Buy,Sell
|
||||
1,03/01,Salesforce ,CRM,208.89,208.89,0.0,Buy,Sell
|
||||
2,03/01,Coterra Energy ,CTRA,24.36,24.36,0.0,Buy,Sell
|
||||
3,03/01,Domino's Pizza ,DPZ,432.21,432.21,0.0,Buy,Sell
|
||||
4,03/01,Nio ,NIO,21.87,21.87,0.0,Sell,Buy
|
||||
5,03/01,Origin Materials ,ORGN,5.51,5.51,0.0,Sell,Buy
|
||||
6,03/01,Rent-A-Center ,RCII,27.08,27.08,0.0,Sell,Buy
|
||||
7,03/01,B. Riley Financial ,RILY,59.07,59.07,0.0,Sell,Buy
|
||||
8,03/01,Stem ,STEM,9.33,9.33,0.0,Sell,Buy
|
||||
0,03/02,AEO ,AEO,21.33,19.34,-10.290000000000001,Buy,Sell
|
||||
1,03/02,Cemig ,CIG,2.61,2.67,2.25,Buy,Sell
|
||||
2,03/02,DigitalBridge ,DBRG,7.4,7.37,-0.41000000000000003,Sell,Buy
|
||||
3,03/02,Dow ,DOW,59.2,59.67,0.79,Buy,Sell
|
||||
4,03/02,Ford Motor ,F,18.1,17.6,-2.8400000000000003,Buy,Sell
|
||||
5,03/02,Foot Locker ,FL,30.98,31.0,0.06,Sell,Buy
|
||||
6,03/02,Innovative Industrial Pro ,IIPR,190.26,187.48,-1.48,Buy,Sell
|
||||
7,03/02,International Paper ,IP,42.01,42.23,0.52,Buy,Sell
|
||||
8,03/02,Nordstrom ,JWN,26.93,25.68,-4.87,Buy,Sell
|
||||
9,03/02,Kontoor Brands ,KTB,48.03,45.55,-5.4399999999999995,Buy,Sell
|
||||
10,03/02,Masimo ,MASI,153.63,152.46,-0.77,Buy,Sell
|
||||
11,03/02,Morgan Stanley ,MS,88.38,87.78,-0.6799999999999999,Buy,Sell
|
||||
12,03/02,Norwegian Cruise Line ,NCLH,19.06,18.56,-2.69,Buy,Sell
|
||||
13,03/02,Newell Brands ,NWL,23.68,23.82,0.59,Buy,Sell
|
||||
14,03/02,Okta ,OKTA,182.7,167.98,-8.76,Buy,Sell
|
||||
15,03/02,Pfizer ,PFE,47.7,47.83,0.27,Buy,Sell
|
||||
16,03/02,Snowflake ,SNOW,264.69,224.02,-18.15,Buy,Sell
|
||||
17,03/02,Simon Property Group ,SPG,138.77,139.41,0.45999999999999996,Buy,Sell
|
||||
18,03/02,Tesla ,TSLA,879.89,839.29,-4.84,Sell,Buy
|
||||
|
||||
|
@@ -1,12 +1,22 @@
|
||||
|
||||
Company Symbol Price LastPrice Change (%) Recommendation
|
||||
0 Academy Sports and Outdoo ASO 30.65 30.65 0.0 Buy
|
||||
1 Salesforce CRM 208.89 208.89 0.0 Buy
|
||||
2 Coterra Energy CTRA 24.36 24.36 0.0 Buy
|
||||
3 Domino's Pizza DPZ 432.21 432.21 0.0 Buy
|
||||
4 Nio NIO 21.87 21.87 0.0 Sell
|
||||
5 Origin Materials ORGN 5.51 5.51 0.0 Sell
|
||||
6 Rent-A-Center RCII 27.08 27.08 0.0 Sell
|
||||
7 B. Riley Financial RILY 59.07 59.07 0.0 Sell
|
||||
8 Stem STEM 9.33 9.33 0.0 Sell
|
||||
Company Symbol Price LastPrice Change (%) Recommendation
|
||||
0 AEO AEO 21.33 19.34 -10.29 Buy
|
||||
1 Cemig CIG 2.61 2.67 2.25 Buy
|
||||
2 DigitalBridge DBRG 7.40 7.37 -0.41 Sell
|
||||
3 Dow DOW 59.20 59.67 0.79 Buy
|
||||
4 Ford Motor F 18.10 17.60 -2.84 Buy
|
||||
5 Foot Locker FL 30.98 31.00 0.06 Sell
|
||||
6 Innovative Industrial Pro IIPR 190.26 187.48 -1.48 Buy
|
||||
7 International Paper IP 42.01 42.23 0.52 Buy
|
||||
8 Nordstrom JWN 26.93 25.68 -4.87 Buy
|
||||
9 Kontoor Brands KTB 48.03 45.55 -5.44 Buy
|
||||
10 Masimo MASI 153.63 152.46 -0.77 Buy
|
||||
11 Morgan Stanley MS 88.38 87.78 -0.68 Buy
|
||||
12 Norwegian Cruise Line NCLH 19.06 18.56 -2.69 Buy
|
||||
13 Newell Brands NWL 23.68 23.82 0.59 Buy
|
||||
14 Okta OKTA 182.70 167.98 -8.76 Buy
|
||||
15 Pfizer PFE 47.70 47.83 0.27 Buy
|
||||
16 Snowflake SNOW 264.69 224.02 -18.15 Buy
|
||||
17 Simon Property Group SPG 138.77 139.41 0.46 Buy
|
||||
18 Tesla TSLA 879.89 839.29 -4.84 Sell
|
||||
|
||||
|
||||
@@ -1,12 +1,22 @@
|
||||
|
||||
Company Symbol Price LastPrice Change (%) Recommendation InverseCramer
|
||||
0 Academy Sports and Outdoo ASO 30.65 30.65 0.0 Buy Sell
|
||||
1 Salesforce CRM 208.89 208.89 0.0 Buy Sell
|
||||
2 Coterra Energy CTRA 24.36 24.36 0.0 Buy Sell
|
||||
3 Domino's Pizza DPZ 432.21 432.21 0.0 Buy Sell
|
||||
4 Nio NIO 21.87 21.87 0.0 Sell Buy
|
||||
5 Origin Materials ORGN 5.51 5.51 0.0 Sell Buy
|
||||
6 Rent-A-Center RCII 27.08 27.08 0.0 Sell Buy
|
||||
7 B. Riley Financial RILY 59.07 59.07 0.0 Sell Buy
|
||||
8 Stem STEM 9.33 9.33 0.0 Sell Buy
|
||||
Company Symbol Price LastPrice Change (%) Recommendation InverseCramer
|
||||
0 AEO AEO 21.33 19.34 -10.29 Buy Sell
|
||||
1 Cemig CIG 2.61 2.67 2.25 Buy Sell
|
||||
2 DigitalBridge DBRG 7.40 7.37 -0.41 Sell Buy
|
||||
3 Dow DOW 59.20 59.67 0.79 Buy Sell
|
||||
4 Ford Motor F 18.10 17.60 -2.84 Buy Sell
|
||||
5 Foot Locker FL 30.98 31.00 0.06 Sell Buy
|
||||
6 Innovative Industrial Pro IIPR 190.26 187.48 -1.48 Buy Sell
|
||||
7 International Paper IP 42.01 42.23 0.52 Buy Sell
|
||||
8 Nordstrom JWN 26.93 25.68 -4.87 Buy Sell
|
||||
9 Kontoor Brands KTB 48.03 45.55 -5.44 Buy Sell
|
||||
10 Masimo MASI 153.63 152.46 -0.77 Buy Sell
|
||||
11 Morgan Stanley MS 88.38 87.78 -0.68 Buy Sell
|
||||
12 Norwegian Cruise Line NCLH 19.06 18.56 -2.69 Buy Sell
|
||||
13 Newell Brands NWL 23.68 23.82 0.59 Buy Sell
|
||||
14 Okta OKTA 182.70 167.98 -8.76 Buy Sell
|
||||
15 Pfizer PFE 47.70 47.83 0.27 Buy Sell
|
||||
16 Snowflake SNOW 264.69 224.02 -18.15 Buy Sell
|
||||
17 Simon Property Group SPG 138.77 139.41 0.46 Buy Sell
|
||||
18 Tesla TSLA 879.89 839.29 -4.84 Sell Buy
|
||||
|
||||
|
||||
Reference in New Issue
Block a user