## Buying Power

The buying power attribute of an account tells how much capital can be invested before the system will reject orders. Buying power serves as a check to keep a strategy from bankrupting your fund.

### Buying power example

Let's start with a simple example of how buying power is calculated and how it allows orders to be accepted or rejected. At the start of simulation, assume our buying power is set to $1,000,000.

The first order placed is to buy 1000 shares of GOOG at the current market price ($866.34). The simulator checks the expected capital risk (1000 shares * $866.34 == $866,340.00). $866,340.00 < $1,000,000, so the order is accepted, placed, and then filled. After filling this order, the available buying power is $1,000,000 - $866,340 == $133,660.

Next, our trading strategy places a limit sell order for 2000 shares of MSFT with a limit price of $64.70. The simulator checks the expected capital risk (2000 shares * $64.70 == $129,400.00) $129,400.00 < $133,660, so the order is accepted and placed, but not filled yet because MSFT is currently trading at $65.00. This limit order will be pending until it becomes marketable.

After placing the second order, the available buying power is $4,260.

If the strategy places a buy order for 10 shares of GOOG, the order will be rejected because 10 shares * 866.34 == $8,663.40 > $4,260.

Even if the limit-sell order for MSFT is not filled, it is still factored into the buying power calculations.

### Account-level Calculations

Buying power is the limit of how much capital can be risked at any given time. Capital risked is the sum of all capital tied up in open inventory and pending orders.

If an order is expected to decrease a position, it does not contribute to capital risked, and hence cannot cause buying power to be exceeded.

### Symbol-level Calculations

Each symbol is limited to consume at most 1/3 of the overall buying power. So, in our example above, the first order for 1000 shares of GOOG would normally be rejected because it is consuming more than $1,000,000/3.