Files
bitburner-src/markdown/bitburner.stock.getsalegain.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; [getSaleGain](./bitburner.stock.getsalegain.md)
## Stock.getSaleGain() method
Calculate profit of selling stocks.
**Signature:**
```typescript
getSaleGain(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 sell.
</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
Gain from selling a given number of shares of a stock.
## Remarks
RAM cost: 2 GB
Calculates and returns how much you would gain from selling a given number of shares of a stock. This takes into account spread, large transactions influencing the price of the stock and commission fees.