Spaces:
Runtime error
Runtime error
{ | |
"Function: get_stock_code": "def get_stock_code(stock_name: str) -> str:\n # 读取本地文件,获取股票代码\n # 输入是股票的名字str格式\n # 输出是股票的代码str格式\n # 例如输入'贵州茅台',输出'600519.SH'\n # '600519.SH' = get_stock_code('贵州茅台')\n\n \n Reads a local file to retrieve the stock code of a given stock name.\n Args:\n - stock_name (str): The name of the stock.\n Returns:\n - str: The stock code of the given stock name.\n \n\n # The input of the function is a stock name in string format, and the output is the corresponding stock code in string format.\n # For example, if we call get_stock_code('贵州茅台'), it will return '600519.SH'.\n", | |
"Function: get_stock_prices": "def get_stock_prices(stock_symbol: str, start_date: str, end_date: str) -> pd.DataFrame:\n # 通过tushare pro获取对应的股票的价格信息的日频数据\n # 输入是股票的名字,开始日期和结束日期,均是str格式\n # 输出是股票的价格数据dataframe格式,包括日期,开盘价,收盘价,最高价,最低价,成交量,成交额\n # 例如stock_symbol='600519.SH',start_date='20200120',end_start='20220222'\n # 输出是dataframe格式的股票价格数据,每行是一天的股票信息数据\n '''\n ts_code trade_date open ... pct_chg vol amount\n 800 600519.SH 20200102 1128.00 ... -4.4801 148099.16 1.669684e+07\n 799 600519.SH 20200103 1117.00 ... -4.5522 130318.78 1.426638e+07\n 798 600519.SH 20200106 1070.86 ... -0.0528 63414.78 6.853918e+06\n '''\n\n \n Retrieves the daily price data for a given stock symbol during a specific time period from tushare pro API.\n\n Args:\n - stock_symbol (str): The stock symbol code, e.g. '600519.SH'.\n - start_date (str): The start date of the time period in the format 'YYYYMMDD'.\n - end_date (str): The end date of the time period in the format 'YYYYMMDD'.\n\n Returns:\n - pd.DataFrame: A dataframe that contains the daily data for the given stock symbol during the specified time period.\n \n # The input of the function is a stock symbol code in string format, a start date and an end date, both in the format 'YYYYMMDD'.\n # The output of the function is a pandas dataframe\n # The dataframe contains the daily price data for the given stock symbol during the specified time period.\n # The dataframe includes the following columns: ts_code, trade_date, open, high, low, close, pre_close, change, pct_chg, vol, and amount.\n # Each row in the dataframe represents the price data for a single trading day.", | |
"Function: plot_stock_prices": "def plot_stock_prices(stock_prices: pd.DataFrame, stock_name: str, index: str) -> None:\\n # 这个函数是用于绘制股票价格的折线图, 输入是股票的信息的dataframe以及股票的名字,以及需要绘制的指标\\n # 输出是绘制的该股票该段时间内对应指标的走势图\\n # index可以是'open','close','high','low','pct_chg','vol','amount'\\n # 例如plot_stock_prices(stock_prices, '贵州茅台', 'close')\\n \"\"\"\\n Plots the stock prices of a given stock symbol during a specific time period for a specified index.\\n\\n Args:\\n - stock_prices (pd.DataFrame): A pandas dataframe that contains the daily price data for the given stock symbol during the specified time period.\\n - stock_name (str): The name of the stock.\\n - index (str): The name of the index that we want to plot. It can be one of 'open', 'close', 'high', 'low', 'pct_chg', 'vol', or 'amount'.\\n\\n Returns:\\n - None: The function only plots the stock price data for the specified index.\\n \"\"\"\\n # The input of the function is a pandas dataframe that contains the daily data for a given stock symbol during a specific time period and the name of the stock in string format, and the index name of the price data that we want to plot in string format.\\n # The output of the function is a plot that shows the stock price data for the specified index during the specified time period.\\n # The function plots the specified index against the trade_date column of the dataframe, sets the x-axis label to 'Date', and sets the y-axis label to the 'index' of the stock.\\n # The function also rotates the x-axis labels by 45 degrees to improve readability, sets the grid, and shows the plot.", | |
"Function: save_stock_prices_to_csv": "def save_stock_prices_to_csv(stock_prices: pd.DataFrame, stock_name: str, file_path: str) -> None:\\n # 保存特定股票的数据到本地csv文件\\n # 输入是股票的价格信息dataframe格式,股票的名字,以及保存的文件夹路径\\n # 输出是保存到本地的csv文件\\n # 例如stock_prices=dataframe, stock_name='贵州茅台', file_path='./data/'\\n # 如果文件夹不存在则创建\\n\\n \"\"\"\\n Saves the price data of a specific stock symbol during a specific time period to a local CSV file.\\n\\n Args:\\n - stock_prices (pd.DataFrame): A pandas dataframe that contains the daily price data for the given stock symbol during the specified time period.\\n - stock_name (str): The name of the stock.\\n - file_path (str): The file path where the CSV file will be saved.\\n\\n Returns:\\n - None: The function only saves the CSV file to the specified file path.\\n \"\"\"\\n # The function checks if the directory to save the CSV file exists and creates it if it does not exist.\\n # The function then saves the price data of the specified stock symbol during the specified time period to a local CSV file with the name {stock_name}_price_data.csv in the specified file path.\n\n\n\n\n", | |
"Function: compare_stocks_Earnings_Rate": "def compare_stocks_Earnings_Rate(stock_pool: dict, start_date: str, end_date: str) -> None:\n # 比较给定时间里多只股票的累计的收益率\n # 输入是股票的名字和代码的组成的字典,dict格式key是股票代码str,value是股票名称str,以及开始日期str和结束日期str\n # 输出是绘制的每只股票该段时间累计收益率的走势图\n # 例如stock_pool = {'600519.SH':'贵州茅台', '000858.SZ':'五粮液', '000568.SZ':'泸州老窖'}, start_date='20200120', end_start='20220222'\n \n Compares the cumulative earnings rate of multiple stocks during a given time period.\n\n Args:\n - stock_pool (dict): A dictionary of stock codes and names. Key is the stock code (str) and value is the stock name (str).\n - start_date (str): The start date of the time period in the format 'YYYYMMDD'.\n - end_date (str): The end date of the time period in the format 'YYYYMMDD'.\n\n Returns:\n - None: The function only plots the cumulative earnings rate trends of the given stocks during the given time period.\n \n # The input of the function is a dictionary of stock codes and names in string format, the start date of the time period in string format, and the end date of the time period in string format.\n # The output of the function is a plot that shows the cumulative earnings rate trends of the given stocks during the given time period.\n # The function iterates over the dictionary of stock codes and names, calls the get_stock_prices function to retrieve the earning rate of each stock during the specified time period, computes the cumulative earnings rate for each stock using the price data,\n # and plots the cumulative earnings rate trends of the given stocks during the given time period.\n # The function sets the x-axis label to 'Date', the y-axis label to 'Cumulative Earnings Rate (%).'", | |
"Function: get_company_info": "def get_company_info(stock_code: str, stock_name:str) -> None:\n # 获取公司信息, 包括ts_code: str 股票代码, exchange:str 交易所代码SSE上交所 SZSE深交所, chairman:str 法人代表, manager:str 总经理, secretary:str 董秘\n # reg_capital:float 注册资本, setup_date:str 注册日期, province:str 所在省份 ,city:str 所在城市\n # introduction:str 公司介绍, website:str 公司主页 , email:str 电子邮件, office:str 办公室\n # ann_date: str 公告日期, business_scope:str 经营范围, employees:int 员工人数, main_business:str 主要业务及产品." | |
} |