Python-Powered Profits: Trade Smarter, Not Harder!

Getting recommendations for trading.


Even if you are already armed with Technical analysis tools and Fundamental analysis information, very often for efficient buy/sell decisions you might neen second opinion like trading recommendetions from professional traders. To trust them or not is completely up to you, but very soon you will feel to like and use this nice to have option.

Trading recommendations using Python.
Trading recommendations meme.

Python Knowledge Base: Make coding great again.
- Updated: 2024-11-20 by Andrey BRATUS, Senior Data Analyst.




    In our case we will use Python to access trading recommendations from Mboum Finance Official API which provides recommendations from analyst firms for any stock/ticker.
    To use necessary API you need to get "your-api-key" directly from Mboum Finance, or using rapidapi.com, the way I recommend. Output data is in JSON format which can be easily converted to any suitable form for further visualisation and analysis, recommendations will come for any specified stock/ticker in poins set from strongBuy to strongSell estimations for different time periods.



  1. Python code to get trading recommendations:


  2. 
    import requests
    
    url = "https://mboum-finance.p.rapidapi.com/qu/quote/recommendation-trend"
    
    querystring = {"symbol":"AAPL"}
    
    headers = {
    "X-RapidAPI-Key": "your-api-key",
    "X-RapidAPI-Host": "mboum-finance.p.rapidapi.com"
    }
    
    response = requests.request("GET", url, headers=headers, params=querystring)
    
    print(response.text)
    


  3. Trading recommendations output:


  4. 
    {
        "recommendationTrend": {
            "trend": [
                {
                    "period": "0m",
                    "strongBuy": 11,
                    "buy": 21,
                    "hold": 6,
                    "sell": 0,
                    "strongSell": 0
                },
                {
                    "period": "-1m",
                    "strongBuy": 14,
                    "buy": 25,
                    "hold": 7,
                    "sell": 1,
                    "strongSell": 0
                },
                {
                    "period": "-2m",
                    "strongBuy": 14,
                    "buy": 24,
                    "hold": 8,
                    "sell": 0,
                    "strongSell": 0
                },
                {
                    "period": "-3m",
                    "strongBuy": 13,
                    "buy": 20,
                    "hold": 8,
                    "sell": 0,
                    "strongSell": 0
                }
            ],
            "maxAge": 86400
        }
    }
    




See also related topics: