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

1.4 KiB
Raw Permalink Blame History

Home > bitburner > Stock > getPosition

Stock.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

const [sharesLong, avgLongPrice, sharesShort, avgShortPrice] = ns.stock.getPosition("ECP");