Thanks for the answer. I wish Lightspeed had some sort of sockets interface into their system...re-implementing everything into C++ isn't a pleasant prospect. Is there anything in the pipeline?
The question gets asked this way as a form of public venting, the IB API tells you you have 20% margin, next second, your orders are getting rejected because of some market spike, but of course you get nothing through the API to tell you about the obviously changed margins. So I started calculating the PM for myself so I could track it in real-time. So to undermine that, post Covid meltdown they change the rules almost every day...