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(
        'your_api_key_here',
        'your_api_secret_here',
        'https://paper-api.alpaca.markets'
    )

    # 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.

I’ve tried several simple examples found in Alpaca documentation in order to get some data from the API, the above included. Below is a screenshot off the output of this build in Repl. I have also tried following the tutorial @ Buying Crypto using Alpaca Snapshot and Crypto APIs and other videos and getting similar results.