# Profit and Loss

The bot dashboard shows the lifetime position metrics for a bot. The daily P&L diagram requires at least 3 data points, i.e., 3 closing values on the portfolio across 3 market days before a graph is displayed. The active profit and loss value is updated each time the page is refreshed. The Activity Window will summarizes all bot activity.

All End-of-Day profit and loss calculations are settled daily at 4:15 Eastern Time (ET) During the 15-minute period after the close, bid/ask spreads can become extremely wide which will cause the Daily P/L on your bot dashboard to become skewed. Do not panic!

## Activity Window

The activity window provides a snapshot overview of the total count for bot automations and decisions along with daily counts for open and closed positions. In addition, any tickers that have been referenced and any warnings or errors are also shown on a daily basis.

Warnings and errors will be cleared and reset prior to the market opening the following day.

### Available Capital (Example)

Assume a new bot is allocated $2,500 capital.

1) A $5 wide put credit spread, and the bot receive $1.75 ($175) as a credit.

2) Another $5 wide put credit spread, and the bot receives $1.50 ($150) as a credit.

The bot now has $2,825 in capital (original $2,500 + $175 + $150). The first put credit spread requires $500 to maintain the position, as does the 2nd credit spread. The maintenance requirement for the open positions is $1,000.

$2,825 - $1,000 = $1,825. The $1,825 is the available capital.

The Available Capital calculation includes pending orders to prevent exceeding max allocation.

## Performance Metrics

### P/L & Return %

The active profit and loss value is updated each time the page is refreshed and is the total of both active and closed positions. (realized / unrealized gains or losses)

Return on investment measures the effectiveness of an investment relative to its initial cost of entry. ROI divides the return of an investment by the cost of the investment.

For example, if an investment cost $5,000 to purchase and is now worth $6,000, the ROI for the investment is 20% ($6,000-$5,000 = $1,000 / $5,000).

### Win Rate

The win rate divides the total number of winning trades by total trades. For example, if an investor has placed 200 trades and has realized a profit on 120 of them, the win rate is 60% (120/200).

While the win rate can identify how successful trades are at generating profit, it is not as important as the profit factor or how much is gained or lost on each trade. For example, an investor may have a 60%-win rate, but if they lose 3x as much when they lose as they make when they win, they will still lose capital over time.

### Max Drawdown

Maximum drawdown is a measure of the greatest fall in value from the peak high point to the lowest point before a new peak is achieved. This is also displayed as a percentage to further help identify how drastic of a peak to valley drawdown has been experienced over the course of the charted performance graph.

If the bot's P/L value does not cross below 0, the performance graph will use 0 as the low point anchor and only display a maximum peak value alongside the current P/L value.

### Profit Factor

The profit factor divides the total amount of money gained by the total amount of money lost. Profit factor is important when used in conjunction with the win rate because it creates a more complete view of trading performance.

For example, if an investor has placed 200 trades with a win rate of 60% and averages $50 per winning trade and $50 per losing trade, their profit factor will be 1.5 with a net profit of $2000 ((120 x $50 = $6,000) / (80 x $50 = $4,000)).

Compare this with an investor who has a 60%-win rate on 200 trades but a profit factor of .5 because they average $50 per winning trade, but $150 per losing trade ((120 x $50 = $6,000) / (80 x $150 = $12,000)). They will have a net loss of -$6,000, despite the same win rate.

### Position Value

The position "value" is a function of the currentPrice of a share or contract multiplied by the number of contracts, where the currentPrice is synonymous with the matched opportunity mark. (market mid price)Each Position is tracked as a combination of legs, where each leg has/is a security object. Every time we quote the Position, we build an opportunity out of all of the position legs and compare it to the saved values for where the Position opened to provide an accurate quote.For example, if we have a 425/400 short put spread and we want to know the P/L, we pull quotes for the 425 put and 400 put independently and then combine them into a short put spread opportunity. This provides the value X of this short put spread right now and now subtract the value of the original position, Y, from X, and that's the P/L.

**To obtain the total open P/L, sum the resultant values for every open position.**