I realize that this is a tongue-in-cheek "game", and its good at that.
But I would argue that the proper mechanism for the random-pattern is a random-walk of the %increase or %loss at each step, and not the uniformly-varying price that's rather easy to game.
----
Perhaps this "game" is more fun with a uniformly-varying price however.
thank you! agree completely. i have some ideas how to develop it further and add more randomness to it, but i really wanted to get something out as soon as possible, and if there's gonna be enough interest, i'm going to keep making it more complex, and, ultimately, more fun!
This is not possible to implement such idea. Every one buy it in minimum and then wait until a random high value accepted. The other users know this algorithm and the price is not based on computer price and a new market price will generate by the users.
If you add CALL and PUT options (American style ie., exercisable anytime before expiry), perhaps one can try buying both (ie., hedging) and profit from both the random upside as well as random downside without really HODLing the underlying RandomCoin.
Something that I didn't expect is that is not that easy as "buy low" and "sell high". I had to cap the buying price for the bot to make money at all, else the "bought at" will get so high, that you won't have a chance to buy much.
let bougthAt = 0;
let fn = { click: () => {} };
let buy = document.querySelector("#buy");
let sell = document.querySelector("#sell");
(function work() {
let founds = +document.querySelector("#funds-fiat").innerText;
let coins = +document.querySelector("#funds-coin").innerText;
let price = +document.querySelector("#price").innerText;
if (founds > price && price < 5000) {
fn = buy;
bougthAt = price;
console.log("bougthAt", bougthAt);
} else if (price > bougthAt && coins > 0) {
fn = sell;
console.log("sellingAt", price);
}
fn.click();
requestAnimationFrame(work);
})();
OOC question regarding console scripts: unless it's specified by the code that the function will stop at a certain point, most functions like yours will loop forever. Is there a way to stop them, once pasted in the console, apart from refreshing the page? Is there no way to "stop" the loop of that specific function that was started? I googled around a bit but I think I'm out of my depth here.
Yes, but you have to code for it. I guess you mean you want to "kill the process" in some way, and that's not possible as far as I know.
One easy way is to add a flag
let working = true;
(function work() {
console.log("running");
if (working) requestAnimationFrame(work);
else console.log("stopped");
})();
Programmatically, you have the function cancelAnimationFrame that you give as parameter what requestAnimationFrame returns. The same as setTimeout and clearTimeout
Related story: I was almost kicked out of a fintech interview in the late 1980's, when I mentioned that there was room to question Black-Sholes. I was thinking of an article I had read about "variance noise" in a scientific publication.
VIX is now a how many billion dollar industry? (Not that that defeats Black-Sholes.)
Black-Scholes still is a dumb pricing model, I feel like an options pricing model should factor in the liquidity of the underlying asset and Black-Scholes and other pricing methods I have seen do not. Even though implied volatility is hand waiving away every variable not known, even that is not factoring in underlying liquidity.
The stock market in the X3 game works similarly I think, by moving the prices of the available assets within a given price range, making it very easy to abuse and grow your ingame wealth.
allow users to save their holdings to a "wallet". then ability to sell/transfer coins and we have ourselves a working crypto
note. how about a total supply so limit number of coins in circulation and a coin burn mechanism to reduce supply slowly, maybe with each transaction, transfer
this is interesting because "mining" these random coins by buying low and selling high is same as "calculating prime numbers" that go into bitcoin so we are doing something similar to that here. this looks like a fun experiment
You could make a real RandomCoin, but since you can't change the price, you could add random transactions to the chain. Jokes like this seems to make people billionaire these days.
But I would argue that the proper mechanism for the random-pattern is a random-walk of the %increase or %loss at each step, and not the uniformly-varying price that's rather easy to game.
----
Perhaps this "game" is more fun with a uniformly-varying price however.