class_docstr: StockPortfolio is the main class of `pyrtfolio` which is going to manage all the introduced stocks.
  
  This class is the one that contains the stocks information and the one that will be used by the user in order to
  generate a custom portfolio. So on, this function implements the methods to calculate all the values required in a
  basic portfolio and, as already mentioned, the method to add stocks.
  
  Attributes:
      stocks (:obj:`list`, protected):
          this list contains all the introduced stocks, which will later be used to generate the portfolio.
      stock_objs (:obj:`list`, protected):
          this list contains all the introduced Stock objects, in order to be able to refresh them.
      data (:obj:`pandas.DataFrame`): it is the generated portfolio, once the addition of every stock is validated.
class_docstr_tok: ["StockPortfolio","is","the","main","class","of","`","pyrtfolio","`","which","is","going","to","manage","all","the","introduced","stocks",".","This","class","is","the","one","that","contains","the","stocks","information","and","the","one","that","will","be","used","by","the","user","in","order","to","generate","a","custom","portfolio",".","So","on",",","this","function","implements","the","methods","to","calculate","all","the","values","required","in","a","basic","portfolio","and",",","as","already","mentioned",",","the","method","to","add","stocks",".","Attributes",":","stocks","(",":","obj",":","`","list","`",",","protected",")",":","this","list","contains","all","the","introduced","stocks",",","which","will","later","be","used","to","generate","the","portfolio",".","stock_objs","(",":","obj",":","`","list","`",",","protected",")",":","this","list","contains","all","the","introduced","Stock","objects",",","in","order","to","be","able","to","refresh","them",".","data","(",":","obj",":","`","pandas.DataFrame","`",")",":","it","is","the","generated","portfolio",",","once","the","addition","of","every","stock","is","validated","."]
docstr: Method to get the stock information once it is validated.
  
  This method retrieves the historical data of the introduced Stock in order to get its current 
  price which will be used for the required calculations to generate the StockPortfolio. So on,
  this function is both going to retrieve Stock data and calculate the required values for the 
  StockPortfolio.
  
  Args:
      stock (:obj:`pyrtfolio.Stock`): Stock object with all its information after validated.
  
  Returns:
      :obj:`dict` - stock_information:
          Returns a :obj:`dict` which contains all the values from the introduced Stock in order to create its
          portfolio row.
docstr_tok: ["Method","to","get","the","stock","information","once","it","is","validated",".","This","method","retrieves","the","historical","data","of","the","introduced","Stock","in","order","to","get","its","current","price","which","will","be","used","for","the","required","calculations","to","generate","the","StockPortfolio",".","So","on",",","this","function","is","both","going","to","retrieve","Stock","data","and","calculate","the","required","values","for","the","StockPortfolio",".","Args",":","stock","(",":","obj",":","`","pyrtfolio.Stock","`",")",":","Stock","object","with","all","its","information","after","validated",".","Returns",":",":","obj",":","`","dict","`","-","stock_information",":","Returns","a",":","obj",":","`","dict","`","which","contains","all","the","values","from","the","introduced","Stock","in","order","to","create","its","portfolio","row","."]
code: def __get_stock_info(self, stock):
      """Method to get the stock information once it is validated.
  
      This method retrieves the historical data of the introduced Stock in order to get its current
      price which will be used for the required calculations to generate the StockPortfolio. So on,
      this function is both going to retrieve Stock data and calculate the required values for the
      StockPortfolio.
  
      Args:
          stock (:obj:`pyrtfolio.Stock`): Stock object with all its information after validated.
  
      Returns:
          :obj:`dict` - stock_information:
              Returns a :obj:`dict` which contains all the values from the introduced Stock in order to create its
              portfolio row.
  
      """
      stocks = investpy.get_stocks(country=stock.stock_country)
  
      stock_name = stocks.loc[
          (
              stocks["symbol"].str.lower() == stock.stock_symbol.lower()
          ).idxmax(),
          "name",
      ]
  
      data = investpy.get_stock_historical_data(
          stock=stock.stock_symbol,
          country=stock.stock_country,
          from_date=stock.purchase_date,
          to_date=date.today().strftime("%d/%m/%Y"),
      )
  
      currency = data["Currency"][0]
  
      purchase_cost = self.calculate_purchase_cost(
          cost_per_share=stock.cost_per_share,
          num_of_shares=stock.num_of_shares,
      )
  
      current_price = self.get_current_price(data=data)
  
      gross_current_value = self.calculate_gross_current_value(
          current_price=current_price, num_of_shares=stock.num_of_shares
      )
  
      dividends = investpy.get_stock_dividends(
          stock=stock.stock_symbol, country=stock.stock_country
      )
  
      dividends = dividends.loc[
          dividends["Payment Date"]
          < pd.to_datetime(stock.purchase_date, dayfirst=True)
      ].reset_index(drop=True)
  
      if len(dividends) > 0:
          total_dividends = self.calculate_total_dividends(
              dividends=dividends, num_of_shares=stock.num_of_shares
          )
      else:
          total_dividends = 0
  
      net_current_value = self.calculate_net_current_value(
          gross_current_value=gross_current_value,
          total_dividends=total_dividends,
      )
  
      total_gain_loss = self.calculate_total_gain_loss(
          net_current_value=net_current_value,
          purchase_cost=purchase_cost,
      )
  
      total_gain_loss_percentage = (
          self.calculate_total_gain_loss_percentage(
              total_gain_loss=total_gain_loss,
              purchase_cost=purchase_cost,
          )
      )
  
      info = {
          "stock_symbol": stock.stock_symbol,
          "stock_name": stock_name,
          "stock_country": stock.stock_country,
          "stock_currency": currency,
          "purchase_date": stock.purchase_date,
          "num_of_shares": stock.num_of_shares,
          "cost_per_share": stock.cost_per_share,
          "purchase_cost": purchase_cost,
          "current_price": current_price,
          "gross_current_value": gross_current_value,
          "total_dividends": total_dividends,
          "net_current_value": net_current_value,
          "total_gain_loss": total_gain_loss,
          "total_gain_loss_percentage": total_gain_loss_percentage,
      }
  
      return info
  
file_path: pyrtfolio/pyrtfolio/StockPortfolio.py
imports: from datetime import date
  import investpy
  import pandas
  from pyrtfolio.Stock import Stock
label_desc: Use image node_id 3 for calling the StockPortfolio obj's underlying member method code with example usage: obj.__get_stock_info(stock) and returns: info