Description ​
Returns the monetary value of given shares
Arguments ​
number
- The amount of shares (Can only be between [0; 1000]. Is clamped internally). Fallbacks as '-1' if something goes wrong (e.g the business is invalid).
Returns ​
number
- The monetary value of the given amount of shares for this business
Example ​
msc
using Console;
using Util;
using Business;
// Figure out how much each share quantity is worth in a customized interval
Business egg = Business.GetBusiness("Egg");
function ShareInterval(number interval)
{
number iterations = egg.GetShareCount() / interval;
number i = 1;
while (i < iterations + 1)
{
// Calculate our shares
number sharesCount = i * interval;
number value = egg.GetSharesValue(sharesCount);
Console.WriteLine("[" .. sharesCount .. " shares]: " .. Util.FormatMoney(value));
i = i + 1;
}
}
Console.WriteLine("Series 1 (interval = 100):");
ShareInterval(100);
Console.WriteLine("Series 2 (interval = 250):");
ShareInterval(250);
// OUTPUT:
// Series 1 (interval = 100):
// [100 shares]: $8,000,000
// [200 shares]: $16,000,000
// [300 shares]: $24,000,000
// [400 shares]: $32,000,000
// [500 shares]: $40,000,000
// [600 shares]: $48,000,000
// [700 shares]: $56,000,000
// [800 shares]: $64,000,000
// [900 shares]: $72,000,000
// [1000 shares]: $80,000,000
// Series 2 (interval = 250):
// [250 shares]: $20,000,000
// [500 shares]: $40,000,000
// [750 shares]: $60,000,000
// [1000 shares]: $80,000,000