Files
bitburner-src/markdown/bitburner.stock.getpurchasecost.md

95 lines
1.2 KiB
Markdown

<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [bitburner](./bitburner.md) &gt; [Stock](./bitburner.stock.md) &gt; [getPurchaseCost](./bitburner.stock.getpurchasecost.md)
## Stock.getPurchaseCost() method
Calculates cost of buying stocks.
**Signature:**
```typescript
getPurchaseCost(sym: string, shares: number, positionType: PositionType): number;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
sym
</td><td>
string
</td><td>
Stock symbol.
</td></tr>
<tr><td>
shares
</td><td>
number
</td><td>
Number of shares to purchase.
</td></tr>
<tr><td>
positionType
</td><td>
[PositionType](./bitburner.positiontype.md)
</td><td>
Specifies whether the order is a Long ("L") or Short ("S") position.
</td></tr>
</tbody></table>
**Returns:**
number
Cost to buy a given number of shares of a stock.
## Remarks
RAM cost: 2 GB
Calculates and returns how much it would cost to buy a given number of shares of a stock. This takes into account spread, large transactions influencing the price of the stock and commission fees.