original_docstring: 
          used when first time download stock data.
          
docstring: used when first time download stock data.
docstring_tokens: used when first time download stock data .
code: def init_stock_data(self, stock_code):
          """
          used when first time download stock data.
          """
          result = self.get_trade_data(stock_code, self.today)
          result.columns = ['trade_date', 'stock_code',
                            'stock_name', 'close_price',
                            'highest_price', 'lowest_price',
                            'open_price', 'prev_close_price',
                            'change_rate', 'amplitude',
                            'volume', 'turnover']
          result = self.data_cleaning(result)
          columetype = {
              'trade_date': Date,
              'stock_name': NVARCHAR(length=10),
              'close_price': DECIMAL(7, 3),
              'highest_price': DECIMAL(7, 3),
              'lowest_price': DECIMAL(7, 3),
              'open_price': DECIMAL(7, 3),
              'prev_close_price': DECIMAL(7, 3),
              'change_rate': DECIMAL(7, 3),
              'amplitude': DECIMAL(7, 4),
              'volume': Integer(),
              'turnover': DECIMAL(20, 2)
          }
          try:
              result.to_sql(name=stock_code,
                            con=self.mysql.engine,
                            if_exists='append',
                            index=False,
                            dtype=columetype)
              query = self.mysql.session.query(
                  formStockManager.stock_code,
                  formStockManager.update_date
              ).filter_by(stock_code=stock_code)
              if query:
                  query.update(
                      {"update_date": self.Today})
              self.mysql.session.commit()
          except Exception as e:
              ERROR(f"Problem when initially download {stock_code} data.")
code_tokens: def init_stock_data ( self , stock_code ) : result = self . get_trade_data ( stock_code , self . today ) result . columns = [ 'trade_date' , 'stock_code' , 'stock_name' , 'close_price' , 'highest_price' , 'lowest_price' , 'open_price' , 'prev_close_price' , 'change_rate' , 'amplitude' , 'volume' , 'turnover' ] result = self . data_cleaning ( result ) columetype = { 'trade_date' : Date , 'stock_name' : NVARCHAR ( length = 10 ) , 'close_price' : DECIMAL ( 7 , 3 ) , 'highest_price' : DECIMAL ( 7 , 3 ) , 'lowest_price' : DECIMAL ( 7 , 3 ) , 'open_price' : DECIMAL ( 7 , 3 ) , 'prev_close_price' : DECIMAL ( 7 , 3 ) , 'change_rate' : DECIMAL ( 7 , 3 ) , 'amplitude' : DECIMAL ( 7 , 4 ) , 'volume' : Integer ( ) , 'turnover' : DECIMAL ( 20 , 2 ) } try : result . to_sql ( name = stock_code , con = self . mysql . engine , if_exists = 'append' , index = False , dtype = columetype ) query = self . mysql . session . query ( formStockManager . stock_code , formStockManager . update_date ) . filter_by ( stock_code = stock_code ) if query : query . update ( { "update_date" : self . Today } ) self . mysql . session . commit ( ) except Exception as e : ERROR ( f"Problem when initially download {stock_code} data." )
short_docstring: used when first time download stock data.
short_docstring_tokens: used when first time download stock data .
comment: """
          used when first time download stock data.
          """