bitburner-src/markdown/bitburner.tix.getposition.md
T.J. Eckman 33f0150d25
BUGFIX: Memory Leak in NetscriptPorts (#399)
Co-authored-by: Snarling <84951833+Snarling@users.noreply.github.com>
2023-02-27 19:54:04 -05:00

1.4 KiB
Raw Blame History

Home > bitburner > TIX > getPosition

TIX.getPosition() method

Returns the players position in a stock.

Signature:

getPosition(sym: string): [number, number, number, number];

Parameters

Parameter Type Description
sym string Stock symbol.

Returns:

number, number, number, number

Array of four elements that represents the players position in a stock.

Remarks

RAM cost: 2 GB Returns an array of four elements that represents the players position in a stock.

The first element in 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.

Example 1

// NS1
var pos = stock.getPosition("ECP");
var shares      = pos[0];
var avgPx       = pos[1];
var sharesShort = pos[2];
var avgPxShort  = pos[3];

Example 2

// NS2
const [shares, avgPx, sharesShort, avgPxShort] = ns.stock.getPosition("ECP");