Skip to content

Conversation

@omariqbalnaru
Copy link

Problem

The PSX website changed the date column name from "TIME" to "DATE", causing the library to fail with the error:
"None of ['TIME'] are in the columns"

Solution

Updated all references from "TIME" to "DATE":

  • Updated headers list (line 20)
  • Updated column check in toframe() method (line 81)
  • Updated set_index() call (line 85)

Testing

Tested successfully with multiple PSX stocks (GTYR, GAL, PAEL, PSO, PPL, SNGP, GHNI, PIOC, GLAXO, CPHL, LOTCHEM, MARI, ENGROH, EFERT, SHFA, CRTM, SLGL, FCEPL, DGKC, BIPL).

All stocks fetched successfully with the updated code.

Impact

This fixes the broken library and makes it work with the current PSX website structure (as of October 2025).

Changes Made

# Before
headers = ['TIME', 'OPEN', 'HIGH', 'LOW', 'CLOSE', 'VOLUME']
if key == "TIME":
    value = datetime.strptime(value, "%b %d, %Y")
return pd.DataFrame(stocks, columns=self.headers).set_index("TIME")

# After  
headers = ['DATE', 'OPEN', 'HIGH', 'LOW', 'CLOSE', 'VOLUME']
if key == "DATE":
    value = datetime.strptime(value, "%b %d, %Y")
return pd.DataFrame(stocks, columns=self.headers).set_index("DATE")

The PSX website changed the column name from 'TIME' to 'DATE', which was causing the library to fail with 'None of ['TIME'] are in the columns' error.

Changes:
- Updated headers list to use 'DATE' instead of 'TIME'
- Updated toframe() method to check for 'DATE' column
- Updated set_index() to use 'DATE' instead of 'TIME'

Tested successfully with multiple PSX stocks.
@ameerusman
Copy link

ameerusman commented Nov 10, 2025

@omariqbalnaru Issue has been fixed in the main (the latest release 0.7 does not have it fixed).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants