From 5e14d07d9a648071dce101173bdce681c22de8af Mon Sep 17 00:00:00 2001 From: Duck McSouls Date: Sat, 1 Oct 2022 09:59:44 +1000 Subject: [PATCH 1/3] DOC: `stock.getPrice()`: typo fixes Some typographical fixes for the documentation of `stock.getPrice()`. The line for RAM cost should be separated by a blank line from the sentence about the definition of a stock's price. Otherwise `npm run doc` would cram those information together onto one line. --- src/ScriptEditor/NetscriptDefinitions.d.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ScriptEditor/NetscriptDefinitions.d.ts b/src/ScriptEditor/NetscriptDefinitions.d.ts index 903f65400..ff935814c 100644 --- a/src/ScriptEditor/NetscriptDefinitions.d.ts +++ b/src/ScriptEditor/NetscriptDefinitions.d.ts @@ -1089,11 +1089,12 @@ export interface TIX { getSymbols(): string[]; /** - * Returns the price of a stock + * Returns the price of a stock. * * @remarks * RAM cost: 2 GB - * The stock’s price is the average of its bid and ask price. + * + * The stock’s price is the average of its bid and ask prices. * * @example * ```ts From 4cf270138d2c1b73a0333abf8b43d46a250d814c Mon Sep 17 00:00:00 2001 From: Duck McSouls Date: Sat, 1 Oct 2022 10:07:20 +1000 Subject: [PATCH 2/3] DOC: `stock.getPrice()`: typo fix in examples Fixes #4184. The hard-coded stock symbol `"FISG"` should be `"FSIG"`. The updated examples do not use a hard-coded stock symbol. The documentation is updated to explain under which circumstances a player can run the function `stock.getPrice()`. --- src/ScriptEditor/NetscriptDefinitions.d.ts | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/ScriptEditor/NetscriptDefinitions.d.ts b/src/ScriptEditor/NetscriptDefinitions.d.ts index ff935814c..4a502871a 100644 --- a/src/ScriptEditor/NetscriptDefinitions.d.ts +++ b/src/ScriptEditor/NetscriptDefinitions.d.ts @@ -1094,17 +1094,26 @@ export interface TIX { * @remarks * RAM cost: 2 GB * - * The stock’s price is the average of its bid and ask prices. + * The stock’s price is the average of its bid and ask prices. This function requires + * that you have the following: + * + * 1. WSE Account + * + * 1. TIX API Access * * @example * ```ts * // NS1 - * stock.getPrice("FISG"); + * var sym = stock.getSymbols()[0]; + * tprint("Stock symbol: " + sym); + * tprint("Stock price: " + stock.getPrice(sym)); * ``` * @example * ```ts * // NS2 - * ns.stock.getPrice("FISG"); + * const sym = ns.stock.getSymbols()[0]; + * ns.tprint("Stock symbol: " + sym); + * ns.tprint("Stock price: " + ns.stock.getPrice(sym)); * ``` * @param sym - Stock symbol. * @returns The price of a stock. From 01e7ce2a05f14db6c6b4aff24f01ae4c582288cf Mon Sep 17 00:00:00 2001 From: Duck McSouls Date: Sun, 2 Oct 2022 11:39:54 +1100 Subject: [PATCH 3/3] DOC: `stock.getPrice()`: a simple example Fixes #4184. The hard-coded stock symbol `"FISG"` should be `"FSIG"`. --- src/ScriptEditor/NetscriptDefinitions.d.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/ScriptEditor/NetscriptDefinitions.d.ts b/src/ScriptEditor/NetscriptDefinitions.d.ts index 4a502871a..504b19780 100644 --- a/src/ScriptEditor/NetscriptDefinitions.d.ts +++ b/src/ScriptEditor/NetscriptDefinitions.d.ts @@ -1104,6 +1104,10 @@ export interface TIX { * @example * ```ts * // NS1 + * stock.getPrice("FSIG"); + * + * // Choose the first stock symbol from the array of stock symbols. Get the price + * // of the corresponding stock. * var sym = stock.getSymbols()[0]; * tprint("Stock symbol: " + sym); * tprint("Stock price: " + stock.getPrice(sym)); @@ -1111,6 +1115,10 @@ export interface TIX { * @example * ```ts * // NS2 + * ns.stock.getPrice("FSIG"); + * + * // Choose the first stock symbol from the array of stock symbols. Get the price + * // of the corresponding stock. * const sym = ns.stock.getSymbols()[0]; * ns.tprint("Stock symbol: " + sym); * ns.tprint("Stock price: " + ns.stock.getPrice(sym));