Hi Pavel,
Thank you for all your efforts. But the code is not working in my end , I also see that your output in the FloatingEquityDailyReport is not correct and does not match my output that I sent in the last message, which on April 07th is {"date":"07-04-2022","Min_Equity":26065.25,"timestamp_min_equity":"2022-04-07 09:10:48","MaxEquity":27080.25,"timestamp_max_equity":"2022-04-07 19:43:03"}, .
The min_equity was not 13 and max_equity also was not 19 on April 07th. It is also critical that I get the date right based on the timezone in which this trigger function is called, as you can imagine April 07th 23:59:59 in Bucharest will be April 08, 02:59:59 in India (depending on DayLight Savings) .
It took me 15 mins to write the code in python and it is sad that MongoDB is not considering the option to allow MongoDB users to code Atlas/Realm trigger functions in python. Perhaps I hope this will change in the future. Anyways, I think it is much too difficult to write this code in Javascript, so I will just write a python function and schedule it using AWS Lambda or Windows Task Scheduler in an AWS VPS.
Best Regards,
Dilip