Real-time APIs are updated as transactions occur to reflect a comprehensive view of a customer’s investments and the performance of their portfolio.

## Cash balances

Use the [Money Endpoint](🔗) to access realtime snapshots of an account's cash balance.

There are multiple types of cash balances shown above, all of which you’ll want to use differently:

  • **Buying Power** (`cashAvailableForTrade`) — This represents the amount of cash a user can use to buy securities. The customer above can place $400 worth of buy trades right now.

  • **Available for withdrawal** (`cashAvailableForWithdrawal`) — The amount of money that can be withdrawn from the Account. This customer can only withdraw $100 today. This is due to $300 that is not yet settled (likely from a recent sale), and displayed in the cashSettlement array.

  • **Cash Balance** (`cashBalance`) — The amount of cash this customer owns. This customer holds $500, but can only invest $400. This is likely due to an outstanding buy order that has not yet been completed.

## Asset positions

The [Positions Endpoint](🔗) will return a list of held Positions in an Account.

A full description of properties can be found in the API specification. As an example, for this customer:

  • $33.18 worth of ABCD is owned

  • A total of $18.94 was invested into ABCD, meaning a total profit of $14.24

  • All 0.2426 held shares are available to be sold

## Account performance

At the end of each trading day, DriveWealth captures several metrics for each Account. These metrics can be used to show a change in value over time, and include the following:

  • **Realized P/L** – The actual (realized) profit or loss.

  • **Unrealized Day P/L** – The daily, uncaptured, profit or loss on open positions

  • **Cumulative Realized P/L** – The aggregate realized P/L from inception of the account (each day adds to previous days)

  • **Equity** – The total invested equity (excluding cash)

  • **Cash** – The total cash balance (settled and unsettled)

  • **Deposits** – The cumulative amount in deposits since inception

  • **Withdrawals** – The cumulative amount in withdrawals since inception

  • **Fees** – Total dollar amount of fees calculated from 4pm ET of previous day until current time.

Access these metrics via the [Performance Endpoint](🔗):

The “performance” array will hold a performance object based on the date range or period set in the query parameters. For example, if you want to retrieve the performance metrics from January to April:

Likewise, if you want to retrieve the performance for a specific period (e.g 2 weeks, 1 month, 10 days) from the current day then you can make the following type of request:

## Margin details

Customers trading with leverage have additional balances they need to monitor in addition to the other metrics shown above. Read [Enabling leverage](🔗) to learn how to create an Account that tracks these values.

For this Account, there are some prudent details important to show to a customer:

  • **longMarketValue** – The real time dollar value of the current holdings in the margin account.

  • **debitBalance** – This represents the real time value of debt in the margin account. A positive number is a debit balance while a negative amount is a credit balance. A customer will pay interest on any debit balance amount.

  • **equity** – The amount of equity the user holds based on their contributions to the account.

  • **equityRequired** – Minimum equity required to stay above a DriveWealth house margin call. If the account is in a margin call (house or exchange) this field will also appear in the `marginCall` object.

  • **rtExcessEquity** – Equity in excess of equityRequired calculated in real time (more is good).

Trading on margin refers to the practice of borrowing money from a broker (DriveWealth) to trade securities. This allows traders to potentially increase their returns by leveraging their capital, but it also increases the risk of losses. The borrowed money is known as a margin loan, and the trader is required to maintain a minimum level of equity in their account, known as the minimum margin (`equityRequired`), to cover potential losses. A margin call occurs when the value of a trader's securities in a margin account drops to a level where the equity falls below the minimum margin requirement set by the broker.

John purchases $10,000 worth of stock using a 2:1 margin loan. This means John contributed $5,000 of his own money and borrowed an additional $5,000 on margin. DriveWealth requires a minimum margin of 30-35%, so John must maintain at least $3,500 in equity in the account. If the value of the stock (`longMarketValue`) drops to $8,000, John's equity would fall to $3,000 ($8,000 value of stock - $5,000 margin loan), which is below the minimum margin requirement (`equityRequired`). This would trigger a margin call, and John would be required to deposit additional funds or securities into the account to bring the equity back up to the minimum level.

It's important to note that if a customer is unable to meet a margin call, DriveWealth can sell securities in the account to bring the equity back up to the minimum level, which could result in significant realized losses for the customer.

If a customer is issued a margin call because they haven’t contributed enough equity to the Account, you’ll see additional data in that same API:

This customer must deposit $500 to clear the margin call.