In addition, do you take into account commision?
I think this question was answered via private email. For the sake of creating a canonical answer here on the site:
You can use the C2 Data Services API to request cmd=getopenpositions.
To learn more, see:
Is “getopenpositions” still a valid command for the URL API? I don’t see it listed in the article here and cannot seem to get “getopenpositons” to work for me like the commands in the article. Is there a new similar command if this one is no longer valid? I would really like a command to do this.