Margin calculator api is not working