Format Y axis Tickmarks

I am really struggling to format my y-axis tick marks the way I want them. I understand that it is based on d3 formatting, but it doesn’t seem to be working for me (quite possibly user error). I am passing formatting into

yaxis=dict(tickformat=‘put formatting here’)

Desired Format = $0.5M. And if negative it should be ($0.5M).

I’m using

yaxis=dict(tickformat=’($.2s’)

which results in numbers like -500000. I also tried to pass in just ‘(’ which per the docs should be ( - nothing for zero or positive and parentheses for negative, and I’m still getting numbers like -500000. I’m not understanding why I can’t get there. Please help!

Thanks in advance.