Theoretically, to get the x-axis range value, you can access it directly from the layout if it is already set before.
If you have a Figure object:
range = fig.layout.xaxis.range # returns a tuple (min, max)
But when used with the candlestick example from the docs, code above return None
because we haven’t set the range before.
I think what you’re trying to achive is similar to this other post and currently it is not supported.