From 26ae4345cfcb93a5829dfabc7bac0b3dc481556a Mon Sep 17 00:00:00 2001 From: Russell Stringer Date: Mon, 10 Jan 2022 15:28:50 -0500 Subject: [PATCH] Try to clear up confusing documentation for TIX.getOrders() api-documenter won't generate property lists for [key: string]: type interfaces, so I tried to put explanations and @links in the appropriate remarks sections. Since the list of stock symbols is known, this could also be fixed by setting each symbol as an optional property of the StockOrder interface Fixes #2269 --- src/ScriptEditor/NetscriptDefinitions.d.ts | 27 +++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/src/ScriptEditor/NetscriptDefinitions.d.ts b/src/ScriptEditor/NetscriptDefinitions.d.ts index 4fd1566b6..03e03e642 100644 --- a/src/ScriptEditor/NetscriptDefinitions.d.ts +++ b/src/ScriptEditor/NetscriptDefinitions.d.ts @@ -254,6 +254,24 @@ export interface AugmentPair { cost: number; } +/** + * @public + */ +export enum PositionTypes { + Long = "L", + Short = "S", +} + +/** + * @public + */ +export enum OrderTypes { + LimitBuy = "Limit Buy Order", + LimitSell = "Limit Sell Order", + StopBuy = "Stop Buy Order", + StopSell = "Stop Sell Order", +} + /** * Value in map of {@link StockOrder} * @public @@ -264,17 +282,18 @@ export interface StockOrderObject { /** Price per share */ price: number; /** Order type */ - type: string; + type: OrderTypes; /** Order position */ - position: string; + position: PositionTypes; } /** * Return value of {@link TIX.getOrders | getOrders} + * + * Keys are stock symbols, properties are arrays of {@link StockOrderObject} * @public */ export interface StockOrder { - /** Stock Symbol */ [key: string]: StockOrderObject[]; } @@ -1199,6 +1218,8 @@ export interface TIX { * @remarks * RAM cost: 2.5 GB * This is an object containing information for all the Limit and Stop Orders you have in the stock market. + * For each symbol you have a position in, the returned object will have a key with that symbol's name. + * The object's properties are each an array of {@link StockOrderObject} * The object has the following structure: * * ```ts