Stoozy / mercury

Event Driven Backtesting Framework
MIT License
1 stars 5 forks source link

Date and Time Parsing #2

Open Stoozy opened 1 year ago

Stoozy commented 1 year ago

Currently, parse_date in the util.cc file gets called every event in order to check if the date and time is in range of start_date and end_date found in the config file. Need a way to optimize this or get rid of it completely.

Avdhesh-Varshney commented 1 year ago

It means to generate current date and time in YYYY-MM-DD format and return it. Or take a date in any format and extract date and return into the required format? Can you clarify me, so that i can contribute under hacktoberfest 2023?

Stoozy commented 1 year ago

One way to prevent calling parse_date during runtime would be to cache every valid event (making sure the event is in between start_date and end_date). Take a look at market.cc, validate the events as I do now, then keep it in a vector before actually running the market simulation. There would be no reason to parse every event, it's already in the vector.