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
510 stars 132 forks source link

Dữ liệu data bị trùng #76

Closed yellow1912 closed 2 months ago

yellow1912 commented 11 months ago

Mô tả lỗi Một số trường hợp data dữ liệu trả về bị trùng, ví dụ

image

Đây là data của vjc, khi xuất ra csv thì có đến 2 dòng cùng 1 ngày

thinh-vu commented 11 months ago

@yellow1912 Chào bạn, bạn chia sẻ cụ thể giúp mình dữ liệu trùng này xuất hiện ở hàm nào, điều kiện bạn gặp lỗi cụ thể hơn nha. Hiện tại với thông tin như này khá mơ hồ, mình không thể xác thực được.

yellow1912 commented 11 months ago
date_format = "%Y-%m-%d"
default_start_date = datetime.strptime('2020-01-01', date_format).date()
end_date = datetime.today().date()
data = stock_historical_data('VJC', default_start_date.strftime(date_format), end_date.strftime(date_format), '1D', 'stock')
boolean = not data["time"].is_unique      # True (credit to @Carsten)
print(data[data.duplicated(['time'], keep=False)])
print(boolean)
quit()

image

Đây nha bạn