bitburner-src/markdown/bitburner.tix.getposition.md

57 lines
1.4 KiB
Markdown
Raw Normal View History

2021-10-30 18:34:14 +02:00
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [bitburner](./bitburner.md) &gt; [TIX](./bitburner.tix.md) &gt; [getPosition](./bitburner.tix.getposition.md)
## TIX.getPosition() method
2021-10-30 22:03:34 +02:00
Returns the players position in a stock.
2021-10-30 18:34:14 +02:00
<b>Signature:</b>
```typescript
2021-11-03 05:27:21 +01:00
getPosition(sym: string): [number, number, number, number];
2021-10-30 18:34:14 +02:00
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
2021-11-03 05:27:21 +01:00
| sym | string | Stock symbol. |
2021-10-30 18:34:14 +02:00
<b>Returns:</b>
\[number, number, number, number\]
Array of four elements that represents the players position in a stock.
## Remarks
2021-10-30 22:03:34 +02:00
RAM cost: 2 GB Returns an array of four elements that represents the players position in a stock.
The first element is the returned array is the number of shares the player owns of the stock in the Long position. The second element in the array is the average price of the players shares in the Long position.
The third element in the array is the number of shares the player owns of the stock in the Short position. The fourth element in the array is the average price of the players Short position.
All elements in the returned array are numeric.
2021-10-30 18:34:14 +02:00
2022-01-08 19:25:06 +01:00
## Example 1
2021-10-30 18:34:14 +02:00
2021-10-30 21:46:34 +02:00
```ts
2022-01-08 19:25:06 +01:00
// NS1
var pos = stock.getPosition("ECP");
var shares = pos[0];
var avgPx = pos[1];
var sharesShort = pos[2];
var avgPxShort = pos[3];
```
## Example 2
```ts
// NS2
const [shares, avgPx, sharesShort, avgPxShort] = ns.stock.getPosition("ECP");
2021-10-30 18:34:14 +02:00
```