/** * React component for the Stock Market UI. This component displays * general information about the stock market, buttons for the various purchases, * and a link to the documentation (Investopedia) */ import * as React from "react"; import { getStockMarket4SDataCost, getStockMarket4STixApiCost } from "../StockMarketCosts"; import { CONSTANTS } from "../../Constants"; import { IPlayer } from "../../PersonObjects/IPlayer"; import { numeralWrapper } from "../../ui/numeralFormat"; import { StdButton } from "../../ui/React/StdButton"; import { StdButtonPurchased } from "../../ui/React/StdButtonPurchased"; import { dialogBoxCreate } from "../../../utils/DialogBox"; type IProps = { initStockMarket: () => void; p: IPlayer; rerender: () => void; } const blockStyleMarkup = { display: "block", } export class InfoAndPurchases extends React.Component { constructor(props: IProps) { super(props); this.handleClick4SMarketDataHelpTip = this.handleClick4SMarketDataHelpTip.bind(this); this.purchaseWseAccount = this.purchaseWseAccount.bind(this); this.purchaseTixApiAccess = this.purchaseTixApiAccess.bind(this); this.purchase4SMarketData = this.purchase4SMarketData.bind(this); this.purchase4SMarketDataTixApiAccess = this.purchase4SMarketDataTixApiAccess.bind(this); } handleClick4SMarketDataHelpTip() { dialogBoxCreate( "Access to the 4S Market Data feed will display two additional pieces " + "of information about each stock: Price Forecast & Volatility

" + "Price Forecast indicates the probability the stock has of increasing or " + "decreasing. A '+' forecast means the stock has a higher chance of increasing " + "than decreasing, and a '-' means the opposite. The number of '+/-' symbols " + "is used to illustrate the magnitude of these probabilities. For example, " + "'+++' means that the stock has a significantly higher chance of increasing " + "than decreasing, while '+' means that the stock only has a slightly higher chance " + "of increasing than decreasing.

" + "Volatility represents the maximum percentage by which a stock's price " + "can change every tick (a tick occurs every few seconds while the game " + "is running).

" + "A stock's price forecast can change over time. This is also affected by volatility. " + "The more volatile a stock is, the more its price forecast will change." ); } purchaseWseAccount() { if (this.props.p.hasWseAccount) { return; } if (!this.props.p.canAfford(CONSTANTS.WSEAccountCost)) { return; } this.props.p.hasWseAccount = true; this.props.initStockMarket(); this.props.p.loseMoney(CONSTANTS.WSEAccountCost); this.props.rerender(); } purchaseTixApiAccess() { if (this.props.p.hasTixApiAccess) { return; } if (!this.props.p.canAfford(CONSTANTS.TIXAPICost)) { return; } this.props.p.hasTixApiAccess = true; this.props.p.loseMoney(CONSTANTS.TIXAPICost); this.props.rerender(); } purchase4SMarketData() { if (this.props.p.has4SData) { return; } if (!this.props.p.canAfford(getStockMarket4SDataCost())) { return; } this.props.p.has4SData = true; this.props.p.loseMoney(getStockMarket4SDataCost()); this.props.rerender(); } purchase4SMarketDataTixApiAccess() { if (this.props.p.has4SDataTixApi) { return; } if (!this.props.p.canAfford(getStockMarket4STixApiCost())) { return; } this.props.p.has4SDataTixApi = true; this.props.p.loseMoney(getStockMarket4STixApiCost()); this.props.rerender(); } renderPurchaseWseAccountButton(): React.ReactElement { if (this.props.p.hasWseAccount) { return ( ) } else { const cost = CONSTANTS.WSEAccountCost; return ( ) } } renderPurchaseTixApiAccessButton(): React.ReactElement { if (this.props.p.hasTixApiAccess) { return ( ) } else { const cost = CONSTANTS.TIXAPICost; return ( ) } } renderPurchase4SMarketDataButton(): React.ReactElement { if (this.props.p.has4SData) { return ( ) } else { const cost = getStockMarket4SDataCost(); return ( ) } } renderPurchase4SMarketDataTixApiAccessButton(): React.ReactElement { if (!this.props.p.hasTixApiAccess) { return ( ) } else if (this.props.p.has4SDataTixApi) { return ( ) } else { const cost = getStockMarket4STixApiCost(); return ( ) } } render() { const documentationLink = "https://bitburner.readthedocs.io/en/latest/basicgameplay/stockmarket.html"; return (

Welcome to the World Stock Exchange (WSE)!


To begin trading, you must first purchase an account:

{this.renderPurchaseWseAccountButton()}

Trade Information eXchange (TIX) API

TIX, short for Trade Information eXchange, is the communications protocol used by the WSE. Purchasing access to the TIX API lets you write code to create your own algorithmic/automated trading strategies.

{this.renderPurchaseTixApiAccessButton()}

Four Sigma (4S) Market Data Feed

Four Sigma's (4S) Market Data Feed provides information about stocks that will help your trading strategies.

{this.renderPurchase4SMarketDataButton()} {this.renderPurchase4SMarketDataTixApiAccessButton()}

Commission Fees: Every transaction you make has a {numeralWrapper.formatMoney(CONSTANTS.StockMarketCommission)} commission fee.


WARNING: When you reset after installing Augmentations, the Stock Market is reset. You will retain your WSE Account, access to the TIX API, and 4S Market Data access. However, all of your stock positions are lost, so make sure to sell your stocks before installing Augmentations!

) } }