thinh-vu / vnstock

A powerful Python library for getting rich data from the Vietnam Stock Market using just a few lines of code
https://vnstocks.com
Other
513 stars 132 forks source link

Báo lỗi cho tính năng lấy Company Insider Deals #142

Closed yellow1912 closed 1 month ago

yellow1912 commented 1 month ago

Mã công ty bị lỗi: BBM

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/pandas/core/indexes/base.py", line 3790, in get_loc
    return self._engine.get_loc(casted_key)
  File "index.pyx", line 152, in pandas._libs.index.IndexEngine.get_loc
  File "index.pyx", line 181, in pandas._libs.index.IndexEngine.get_loc
  File "pandas/_libs/hashtable_class_helper.pxi", line 7080, in pandas._libs.hashtable.PyObjectHashTable.get_item
  File "pandas/_libs/hashtable_class_helper.pxi", line 7088, in pandas._libs.hashtable.PyObjectHashTable.get_item
KeyError: 'dealAnnounceDate'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/vnstock3/common/data/data_explorer.py", line 305, in insider_deals
    return self.data_source.insider_deals(**kwargs)
  File "/usr/local/lib/python3.10/dist-packages/vnstock3/explorer/tcbs/company.py", line 162, in insider_deals
    df['dealAnnounceDate'] = pd.to_datetime(df['dealAnnounceDate'], format='%d/%m/%y')
  File "/usr/local/lib/python3.10/dist-packages/pandas/core/frame.py", line 3893, in __getitem__
    indexer = self.columns.get_loc(key)
  File "/usr/local/lib/python3.10/dist-packages/pandas/core/indexes/base.py", line 3797, in get_loc
    raise KeyError(key) from err
KeyError: 'dealAnnounceDate'
thinh-vu commented 1 month ago

Cám ơn @yellow1912 đã báo lỗi. Mình đã bổ sung cơ chế xử lý lỗi trong bản tiếp theo v3.0.7