I don't think HubSpot's API has that feature. You can get the total amount and the stage for each object record and then calculate it in your own system or you can also create a HubSpot report if you don't need to integrate that with another tool.
Can you please suggest me how to get the total amount and the stage for each object record. I tried to get deals with stages but there is a limit to get 100 records at a time.
That's true! HubSpot's batch API has a limitation of just 100 records each time. If you have a HubSpot Enterprise account, you can use a Workflow with webhook to make HubSpot send data to your endpoint. Or you can export regularly export your Deal Pipeline and then just sum everything. If you don't have HubSpot Enterprise but have a little extra time, you can create a custom app Workflow action that sends webhooks.