Why i am getting error while fetching historical data

C:\Users\vishw>cd “C:\python project\scripts\ALGO_TRADING_SHOONYA”

C:\python project\scripts\ALGO_TRADING_SHOONYA>python upstox_test_fetch.py
HTTP 400
:warning: Error 400: {“status”:“error”,“errors”:[{“errorCode”:“UDAPI1015”,“message”:“to_date must be greater than or equal to from_date and Date should be in valid format: yyyy-mm-dd”,“propertyPath”:“”,“invalidValue”:{“fromDate”:“2025-01-04”,“toDate”:“2025-01-01”},“error_code”:“UDAPI1015”,“property_path”:“”,"invalid_val

Hi @VISHWA_1231464

The error message indicates that your to_date (2025-01-01) is earlier than your from_date (2025-01-04). The API requires that the to_date be greater than or equal to the from_date, and both dates need to be in the correct yyyy-mm-dd format.

To fix this, please adjust your request so that to_date is after from_date. For example, you could change from_date to 2025-01-04 and to_date to a later date like 2025-01-05.