Example on viewing gain/loss of your portfolio

You can use the information from the account endpoint to do things like calculating the daily profit or loss of your account.

Example in python:

import alpaca_trade_api as tradeapi

if __name__ == '__main__':
    With the Alpaca API, you can check on your daily profit or loss by
    comparing your current balance to yesterday's balance.

    # First, open the API connection
    api = tradeapi.REST(

    # Get account info
    account = api.get_account()

    # Check our current balance vs. our balance at the last market close
    balance_change = float(account.equity) - float(account.last_equity)
    print(f'Today\'s portfolio balance change: ${balance_change}')

You can view the full example in C# and python on our documentation site.