mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-09 17:23:53 +01:00
Tempered the affect that stock market txs have on stock forecasts
This commit is contained in:
parent
99688b78c7
commit
d7f3ab9177
2
dist/engine.bundle.js
vendored
2
dist/engine.bundle.js
vendored
File diff suppressed because one or more lines are too long
@ -202,7 +202,7 @@ export function stockMarketCycle() {
|
||||
if (stock.b) { thresh = 0.4; }
|
||||
if (Math.random() < thresh) {
|
||||
stock.b = !stock.b;
|
||||
if (stock.otlkMag < 8) { stock.otlkMag += 0.1; }
|
||||
if (stock.otlkMag < 5) { stock.otlkMag += 0.1; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ import { PositionTypes } from "./data/PositionTypes";
|
||||
import { CONSTANTS } from "../Constants";
|
||||
|
||||
// Amount by which a stock's forecast changes during each price movement
|
||||
export const forecastChangePerPriceMovement = 0.01;
|
||||
export const forecastChangePerPriceMovement = 0.005;
|
||||
|
||||
/**
|
||||
* Given a stock, calculates the amount by which the stock price is multiplied
|
||||
@ -171,9 +171,8 @@ export function processBuyTransactionPriceMovement(stock: Stock, shares: number,
|
||||
|
||||
// Forecast always decreases in magnitude
|
||||
const forecastChange = Math.min(5, forecastChangePerPriceMovement * (numIterations - 1));
|
||||
stock.otlkMag -= forecastChange;
|
||||
if (stock.otlkMag < 0.1) {
|
||||
stock.otlkMag = 0.1;
|
||||
if (stock.otlkMag > 10) {
|
||||
stock.otlkMag -= forecastChange;
|
||||
}
|
||||
}
|
||||
|
||||
@ -323,9 +322,8 @@ export function processSellTransactionPriceMovement(stock: Stock, shares: number
|
||||
|
||||
// Forecast always decreases in magnitude
|
||||
const forecastChange = Math.min(5, forecastChangePerPriceMovement * (numIterations - 1));
|
||||
stock.otlkMag -= forecastChange;
|
||||
if (stock.otlkMag < 0.1) {
|
||||
stock.otlkMag = 0.1;
|
||||
if (stock.otlkMag > 10) {
|
||||
stock.otlkMag -= forecastChange;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -33,8 +33,8 @@ export const InitStockMetadata: IConstructorParams[] = [
|
||||
min: 1,
|
||||
},
|
||||
shareTxForMovement: {
|
||||
max: 45e3,
|
||||
min: 15e3,
|
||||
max: 90e3,
|
||||
min: 30e3,
|
||||
},
|
||||
symbol: StockSymbols[LocationName.AevumECorp],
|
||||
},
|
||||
@ -59,8 +59,8 @@ export const InitStockMetadata: IConstructorParams[] = [
|
||||
min: 1,
|
||||
},
|
||||
shareTxForMovement: {
|
||||
max: 45e3,
|
||||
min: 15e3,
|
||||
max: 90e3,
|
||||
min: 30e3,
|
||||
},
|
||||
symbol: StockSymbols[LocationName.Sector12MegaCorp],
|
||||
},
|
||||
@ -85,8 +85,8 @@ export const InitStockMetadata: IConstructorParams[] = [
|
||||
min: 1,
|
||||
},
|
||||
shareTxForMovement: {
|
||||
max: 45e3,
|
||||
min: 15e3,
|
||||
max: 90e3,
|
||||
min: 30e3,
|
||||
},
|
||||
symbol: StockSymbols[LocationName.Sector12BladeIndustries],
|
||||
},
|
||||
@ -111,8 +111,8 @@ export const InitStockMetadata: IConstructorParams[] = [
|
||||
min: 1,
|
||||
},
|
||||
shareTxForMovement: {
|
||||
max: 45e3,
|
||||
min: 15e3,
|
||||
max: 90e3,
|
||||
min: 30e3,
|
||||
},
|
||||
symbol: StockSymbols[LocationName.AevumClarkeIncorporated],
|
||||
},
|
||||
@ -137,8 +137,8 @@ export const InitStockMetadata: IConstructorParams[] = [
|
||||
min: 1,
|
||||
},
|
||||
shareTxForMovement: {
|
||||
max: 45e3,
|
||||
min: 15e3,
|
||||
max: 90e3,
|
||||
min: 30e3,
|
||||
},
|
||||
symbol: StockSymbols[LocationName.VolhavenOmniTekIncorporated],
|
||||
},
|
||||
@ -163,8 +163,8 @@ export const InitStockMetadata: IConstructorParams[] = [
|
||||
min: 1,
|
||||
},
|
||||
shareTxForMovement: {
|
||||
max: 45e3,
|
||||
min: 15e3,
|
||||
max: 90e3,
|
||||
min: 30e3,
|
||||
},
|
||||
symbol: StockSymbols[LocationName.Sector12FourSigma],
|
||||
},
|
||||
@ -189,8 +189,8 @@ export const InitStockMetadata: IConstructorParams[] = [
|
||||
min: 1,
|
||||
},
|
||||
shareTxForMovement: {
|
||||
max: 45e3,
|
||||
min: 15e3,
|
||||
max: 90e3,
|
||||
min: 30e3,
|
||||
},
|
||||
symbol: StockSymbols[LocationName.ChongqingKuaiGongInternational],
|
||||
},
|
||||
@ -215,8 +215,8 @@ export const InitStockMetadata: IConstructorParams[] = [
|
||||
min: 1,
|
||||
},
|
||||
shareTxForMovement: {
|
||||
max: 45e3,
|
||||
min: 15e3,
|
||||
max: 90e3,
|
||||
min: 30e3,
|
||||
},
|
||||
symbol: StockSymbols[LocationName.AevumFulcrumTechnologies],
|
||||
},
|
||||
@ -241,8 +241,8 @@ export const InitStockMetadata: IConstructorParams[] = [
|
||||
min: 2,
|
||||
},
|
||||
shareTxForMovement: {
|
||||
max: 54e3,
|
||||
min: 18e3,
|
||||
max: 108e3,
|
||||
min: 36e3,
|
||||
},
|
||||
symbol: StockSymbols[LocationName.IshimaStormTechnologies],
|
||||
},
|
||||
@ -267,8 +267,8 @@ export const InitStockMetadata: IConstructorParams[] = [
|
||||
min: 2,
|
||||
},
|
||||
shareTxForMovement: {
|
||||
max: 54e3,
|
||||
min: 18e3,
|
||||
max: 108e3,
|
||||
min: 36e3,
|
||||
},
|
||||
symbol: StockSymbols[LocationName.NewTokyoDefComm],
|
||||
},
|
||||
@ -293,8 +293,8 @@ export const InitStockMetadata: IConstructorParams[] = [
|
||||
min: 2,
|
||||
},
|
||||
shareTxForMovement: {
|
||||
max: 54e3,
|
||||
min: 18e3,
|
||||
max: 108e3,
|
||||
min: 36e3,
|
||||
},
|
||||
symbol: StockSymbols[LocationName.VolhavenHeliosLabs],
|
||||
},
|
||||
@ -319,8 +319,8 @@ export const InitStockMetadata: IConstructorParams[] = [
|
||||
min: 2,
|
||||
},
|
||||
shareTxForMovement: {
|
||||
max: 54e3,
|
||||
min: 18e3,
|
||||
max: 108e3,
|
||||
min: 36e3,
|
||||
},
|
||||
symbol: StockSymbols[LocationName.NewTokyoVitaLife],
|
||||
},
|
||||
@ -345,8 +345,8 @@ export const InitStockMetadata: IConstructorParams[] = [
|
||||
min: 3,
|
||||
},
|
||||
shareTxForMovement: {
|
||||
max: 54e3,
|
||||
min: 18e3,
|
||||
max: 108e3,
|
||||
min: 36e3,
|
||||
},
|
||||
symbol: StockSymbols[LocationName.Sector12IcarusMicrosystems],
|
||||
},
|
||||
@ -371,8 +371,8 @@ export const InitStockMetadata: IConstructorParams[] = [
|
||||
min: 2,
|
||||
},
|
||||
shareTxForMovement: {
|
||||
max: 54e3,
|
||||
min: 18e3,
|
||||
max: 108e3,
|
||||
min: 36e3,
|
||||
},
|
||||
symbol: StockSymbols[LocationName.Sector12UniversalEnergy],
|
||||
},
|
||||
@ -397,8 +397,8 @@ export const InitStockMetadata: IConstructorParams[] = [
|
||||
min: 3,
|
||||
},
|
||||
shareTxForMovement: {
|
||||
max: 63e3,
|
||||
min: 21e3,
|
||||
max: 126e3,
|
||||
min: 42e3,
|
||||
},
|
||||
symbol: StockSymbols[LocationName.AevumAeroCorp],
|
||||
},
|
||||
@ -423,8 +423,8 @@ export const InitStockMetadata: IConstructorParams[] = [
|
||||
min: 4,
|
||||
},
|
||||
shareTxForMovement: {
|
||||
max: 63e3,
|
||||
min: 21e3,
|
||||
max: 126e3,
|
||||
min: 42e3,
|
||||
},
|
||||
symbol: StockSymbols[LocationName.VolhavenOmniaCybersystems],
|
||||
},
|
||||
@ -449,8 +449,8 @@ export const InitStockMetadata: IConstructorParams[] = [
|
||||
min: 4,
|
||||
},
|
||||
shareTxForMovement: {
|
||||
max: 63e3,
|
||||
min: 21e3,
|
||||
max: 126e3,
|
||||
min: 42e3,
|
||||
},
|
||||
symbol: StockSymbols[LocationName.ChongqingSolarisSpaceSystems],
|
||||
},
|
||||
@ -475,8 +475,8 @@ export const InitStockMetadata: IConstructorParams[] = [
|
||||
min: 4,
|
||||
},
|
||||
shareTxForMovement: {
|
||||
max: 63e3,
|
||||
min: 21e3,
|
||||
max: 126e3,
|
||||
min: 42e3,
|
||||
},
|
||||
symbol: StockSymbols[LocationName.NewTokyoGlobalPharmaceuticals],
|
||||
},
|
||||
@ -501,8 +501,8 @@ export const InitStockMetadata: IConstructorParams[] = [
|
||||
min: 4,
|
||||
},
|
||||
shareTxForMovement: {
|
||||
max: 63e3,
|
||||
min: 21e3,
|
||||
max: 126e3,
|
||||
min: 42e3,
|
||||
},
|
||||
symbol: StockSymbols[LocationName.IshimaNovaMedical],
|
||||
},
|
||||
@ -527,8 +527,8 @@ export const InitStockMetadata: IConstructorParams[] = [
|
||||
min: 5,
|
||||
},
|
||||
shareTxForMovement: {
|
||||
max: 27e3,
|
||||
min: 6e3,
|
||||
max: 54e3,
|
||||
min: 12e3,
|
||||
},
|
||||
symbol: StockSymbols[LocationName.AevumWatchdogSecurity],
|
||||
},
|
||||
@ -553,8 +553,8 @@ export const InitStockMetadata: IConstructorParams[] = [
|
||||
min: 5,
|
||||
},
|
||||
shareTxForMovement: {
|
||||
max: 54e3,
|
||||
min: 18e3,
|
||||
max: 108e3,
|
||||
min: 36e3,
|
||||
},
|
||||
symbol: StockSymbols[LocationName.VolhavenLexoCorp],
|
||||
},
|
||||
@ -579,8 +579,8 @@ export const InitStockMetadata: IConstructorParams[] = [
|
||||
min: 3,
|
||||
},
|
||||
shareTxForMovement: {
|
||||
max: 63e3,
|
||||
min: 30e3,
|
||||
max: 126e3,
|
||||
min: 60e3,
|
||||
},
|
||||
symbol: StockSymbols[LocationName.AevumRhoConstruction],
|
||||
},
|
||||
@ -605,8 +605,8 @@ export const InitStockMetadata: IConstructorParams[] = [
|
||||
min: 5,
|
||||
},
|
||||
shareTxForMovement: {
|
||||
max: 45e3,
|
||||
min: 15e3,
|
||||
max: 90e3,
|
||||
min: 30e3,
|
||||
},
|
||||
symbol: StockSymbols[LocationName.Sector12AlphaEnterprises],
|
||||
},
|
||||
@ -631,7 +631,7 @@ export const InitStockMetadata: IConstructorParams[] = [
|
||||
min: 5,
|
||||
},
|
||||
shareTxForMovement: {
|
||||
max: 45e3,
|
||||
max: 90e3,
|
||||
min: 15e3,
|
||||
},
|
||||
symbol: StockSymbols[LocationName.VolhavenSysCoreSecurities],
|
||||
@ -657,8 +657,8 @@ export const InitStockMetadata: IConstructorParams[] = [
|
||||
min: 4,
|
||||
},
|
||||
shareTxForMovement: {
|
||||
max: 63e3,
|
||||
min: 30e3,
|
||||
max: 126e3,
|
||||
min: 60e3,
|
||||
},
|
||||
symbol: StockSymbols[LocationName.VolhavenCompuTek],
|
||||
},
|
||||
@ -683,8 +683,8 @@ export const InitStockMetadata: IConstructorParams[] = [
|
||||
min: 5,
|
||||
},
|
||||
shareTxForMovement: {
|
||||
max: 27e3,
|
||||
min: 9e3,
|
||||
max: 54e3,
|
||||
min: 18e3,
|
||||
},
|
||||
symbol: StockSymbols[LocationName.AevumNetLinkTechnologies],
|
||||
},
|
||||
@ -709,8 +709,8 @@ export const InitStockMetadata: IConstructorParams[] = [
|
||||
min: 4,
|
||||
},
|
||||
shareTxForMovement: {
|
||||
max: 45e3,
|
||||
min: 15e3,
|
||||
max: 90e3,
|
||||
min: 30e3,
|
||||
},
|
||||
symbol: StockSymbols[LocationName.IshimaOmegaSoftware],
|
||||
},
|
||||
@ -735,8 +735,8 @@ export const InitStockMetadata: IConstructorParams[] = [
|
||||
min: 6,
|
||||
},
|
||||
shareTxForMovement: {
|
||||
max: 90e3,
|
||||
min: 30e3,
|
||||
max: 180e3,
|
||||
min: 60e3,
|
||||
},
|
||||
symbol: StockSymbols[LocationName.Sector12FoodNStuff],
|
||||
},
|
||||
@ -761,8 +761,8 @@ export const InitStockMetadata: IConstructorParams[] = [
|
||||
min: 6,
|
||||
},
|
||||
shareTxForMovement: {
|
||||
max: 42e3,
|
||||
min: 12e3,
|
||||
max: 84e3,
|
||||
min: 24e3,
|
||||
},
|
||||
symbol: StockSymbols["Sigma Cosmetics"],
|
||||
},
|
||||
@ -787,8 +787,8 @@ export const InitStockMetadata: IConstructorParams[] = [
|
||||
min: 6,
|
||||
},
|
||||
shareTxForMovement: {
|
||||
max: 32e3,
|
||||
min: 9e3,
|
||||
max: 64e3,
|
||||
min: 18e3,
|
||||
},
|
||||
symbol: StockSymbols["Joes Guns"],
|
||||
},
|
||||
@ -813,8 +813,8 @@ export const InitStockMetadata: IConstructorParams[] = [
|
||||
min: 5,
|
||||
},
|
||||
shareTxForMovement: {
|
||||
max: 36e3,
|
||||
min: 12e3,
|
||||
max: 72e3,
|
||||
min: 24e3,
|
||||
},
|
||||
symbol: StockSymbols["Catalyst Ventures"],
|
||||
},
|
||||
@ -839,8 +839,8 @@ export const InitStockMetadata: IConstructorParams[] = [
|
||||
min: 3,
|
||||
},
|
||||
shareTxForMovement: {
|
||||
max: 108e3,
|
||||
min: 45e3,
|
||||
max: 216e3,
|
||||
min: 90e3,
|
||||
},
|
||||
symbol: StockSymbols["Microdyne Technologies"],
|
||||
},
|
||||
@ -865,8 +865,8 @@ export const InitStockMetadata: IConstructorParams[] = [
|
||||
min: 2,
|
||||
},
|
||||
shareTxForMovement: {
|
||||
max: 108e3,
|
||||
min: 45e3,
|
||||
max: 216e3,
|
||||
min: 90e3,
|
||||
},
|
||||
symbol: StockSymbols["Titan Laboratories"],
|
||||
},
|
||||
|
@ -45,7 +45,7 @@ describe("Stock Market Tests", function() {
|
||||
marketCap: 5e9,
|
||||
mv: 1,
|
||||
name: "MockStock",
|
||||
otlkMag: 10,
|
||||
otlkMag: 20,
|
||||
spreadPerc: 1,
|
||||
shareTxForMovement: 5e3,
|
||||
symbol: "mock",
|
||||
|
Loading…
Reference in New Issue
Block a user