What is the QuantConnect way to do Futures Rollover?

Querying for the first contract of the chain gives you the front month contract but it doesn't give you the contract you should rollover into *before* the current contract expires.

What we need to know is the date of expiration and do the rollover into the next symbol.

When I debug the symbol and the symbol value, I noticed that the symbol value has 2 extra digits.

For example, ES20U19, is a ES futures contract that expires in the month of Sept in 2019, but what does the "20" represent? It turns out that the 3rd and 4th digits is the date of expiration in the given month and year of the symbol.

2019-07-07T18:00:00.0000000 ES X80C8BOXQZUP ES20U19
2019-09-22T18:00:00.0000000 ES XAHXWTZAPNGH ES20Z19
2019-12-22T18:00:00.0000000 ES XCZJLC9NOB29 ES20H20
2020-03-22T18:00:00.0000000 ES XFH59UK0MYO1 ES19M20
2020-06-21T23:59:00.0000000 ES XHYQYCUDLM9T ES18U20
So then, my question is, do you have an API to extract the expiration date of the given symbol? Or, do I need to create a function to extract the expiration date from the given symbol?

Author