from typing import List
from typing import Dict
import requests


def get_stalker(user: str, limit: int = 30) -> List[Dict]:
    """Gets messages from given user [Source: stocktwits]

    Parameters
    ----------
    user : str
        User to get posts for
    limit : int, optional
        Number of posts to get, by default 30
    """
    result = requests.get(f"https://api.stocktwits.com/api/2/streams/user/{user}.json")
    if result.status_code == 200:
        return list(result.json()["messages"][:limit])

    return []