Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/psx/web.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

class DataReader:

headers = ['TIME', 'OPEN', 'HIGH', 'LOW', 'CLOSE', 'VOLUME']
headers = ['DATE', 'OPEN', 'HIGH', 'LOW', 'CLOSE', 'VOLUME']

def __init__(self):
self.__history = "https://dps.psx.com.pk/historical"
Expand Down Expand Up @@ -78,11 +78,11 @@ def toframe(self, data):
cols = [col.getText() for col in row.select("td")]

for key, value in zip(self.headers, cols):
if key == "TIME":
if key == "DATE":
value = datetime.strptime(value, "%b %d, %Y")
stocks[key].append(value)

return pd.DataFrame(stocks, columns=self.headers).set_index("TIME")
return pd.DataFrame(stocks, columns=self.headers).set_index("DATE")

def daterange(self, start: date, end: date) -> list:
period = end - start
Expand Down