codetiger927's blog

By codetiger927, history, 3 years ago, In English

2/11/2023 Update: There had been a month-long hiatus due to the CF name change magic (and my own laziness oops), but everything has been fixed now :D! However, I know a lot of people have gone inactive due to the month-long market closure, so I am hoping to relaunch StonksCF in the near future with some new mechanisms (dividends, automatic algorithm trading, etc.). Let me know if you have any ideas! In the meantime, feel free to continue exploiting the way-over-inflated economy and embrace your inner capitalism >:D

Final Update: We now have our own DISCORD SERVER. Join us for the latest information and engage with the community at https://discord.gg/AeH2GTwkF5 All the announcements will be there instead of on this page

Greetings Fellow CodeForces users!

I am proud to introduce my latest project, CF Stonks (aka StonksCF), which is a virtual stock market based on your CodeForces rating.

Have you ever been thrilled by the ups and downs of CodeForces ratings? If so, you will love this project :D. On the website, you will automatically receive $$$200$$$ stocks of your own account (with the rest of the $$$800$$$ being sold on the market) and $$$10,000$$$ in cash upon registration. The price of each stock is based on your rating, so the higher the rating, the higher the price of a stock is. Furthermore, since crossing (or sometimes dropping) into a new division is so exhilarating, we aim to capture that excitement and give a $$$20$$$% boost between the ranks. The exact formula is $$$price = 1.2^{rank} \cdot rating$$$.

While the market is open (closed during contests), you can sell/buy other people's stock. Even though this is just a game, you can use the website as a source of motivation since people depend on you to not lose money 0_0.

So what are you waiting for? Try to become the wealthiest man on the website! More details on the game mechanics can be found on the about page

Steps to get started
Screenshot of the pages

Special thanks to the Nimbus bot developed by gamesterrex and caoash , which serves as my primary inspiration behind this project.

Furthermore, all of the source code is public and available on GitHub here, so if you would like to contribute or give suggestions, please open an issue/pull request.

Good luck and have fun playing :D

Edit: The market has been closed for the Div 3 contest. Good luck to anyone taking!

Edit: Market has been reopened, marking the end of our first trading cycle and the beginning of the second! Have fun trading everyone

Edit: After 14 days of chaos due to New Years name change, the website has been fully fixed and updated! :D Happy trading

  • Vote: I like it
  • +711
  • Vote: I do not like it

| Write comment?
»
3 years ago, # |
  Vote: I like it +35 Vote: I do not like it

orz codetiger

»
3 years ago, # |
  Vote: I like it +31 Vote: I do not like it

Auto comment: topic has been updated by codetiger927 (previous revision, new revision, compare).

»
3 years ago, # |
Rev. 2   Vote: I like it +39 Vote: I do not like it

Very cool, would be cooler if I was allowed to keep 420% of my own stock.

»
3 years ago, # |
  Vote: I like it +37 Vote: I do not like it

Great idea! codetiger orz

»
3 years ago, # |
  Vote: I like it +41 Vote: I do not like it

What a fun website! I have thought about it but I was not able to do it.

»
3 years ago, # |
  Vote: I like it +43 Vote: I do not like it

Kinda cool

Could be even cooler if we actually trade futures with other players

  • »
    »
    3 years ago, # ^ |
      Vote: I like it +37 Vote: I do not like it

    Ohhhh yeah. That would be super cool. I will add that to the list of features I want to implement :p

»
3 years ago, # |
Rev. 3   Vote: I like it +60 Vote: I do not like it

now implement shorting

EDIT: I think line 218 here https://github.com/CodeTiger927/StonksCF/blob/main/backend/API.php#L218 the $stock != $username condition isn't working?

EDIT: also i think it isn't good to transfer password hashes via POST directly, maybe authetication cookies are better

  • »
    »
    3 years ago, # ^ |
      Vote: I like it +33 Vote: I do not like it

    Oh thanks for reminding, I will fix the first problem now. Also yeah passing hashes into POST is probably not the best idea. I will try to fix that at some point too. Thanks for feedback :blobheart:!

  • »
    »
    3 years ago, # ^ |
      Vote: I like it +15 Vote: I do not like it

    Won't it be possible to manipulate the market by shorting yourself and then dumping your rating lol

    • »
      »
      »
      3 years ago, # ^ |
        Vote: I like it +3 Vote: I do not like it

      For that other needs to buy your stock also

    • »
      »
      »
      3 years ago, # ^ |
        Vote: I like it +1 Vote: I do not like it

      I can imagine this working if some GM+ participant creates an alt, getting single digit ranks in 2-3 Div2 and then trolls the next few rounds.

    • »
      »
      »
      3 years ago, # ^ |
        Vote: I like it +22 Vote: I do not like it

      Haha, I was hoping people wouldn't dump their codeforces account just for a virtual game

  • »
    »
    3 years ago, # ^ |
      Vote: I like it +10 Vote: I do not like it

    agreed, I'd short myself to oblivion

»
3 years ago, # |
  Vote: I like it +51 Vote: I do not like it

OwO great project, especially how you handled the registration. Can't wait to pump and dump.

»
3 years ago, # |
  Vote: I like it +14 Vote: I do not like it

I loved this, theres one feature request: it would be nice if you add one button on the person's profile page which redirects to codeforces visualizer or simply their codeforces profile page(to analyze them more).

»
3 years ago, # |
  Vote: I like it +35 Vote: I do not like it

Very cool! The only possible issue I can see is that theoretically, someone could get very rich by smurfing?

»
3 years ago, # |
  Vote: I like it +11 Vote: I do not like it

Brilliant idea!

I think you could add market indexes statistic based on rank.
in my mind it would look something like this:

index | total worth | avg change (since last contest)
---------------------------------
GREY | $4,123,123.98 | +4.5%
GRN | $6,456,234.12 | -1.6%
...
YLW | $38,789,889.34 | +1.9%
RED | $59,987,902.69 | +0.7%
it wouldn't have much practical use but sounds like a fun thing to have

  • »
    »
    3 years ago, # ^ |
      Vote: I like it +3 Vote: I do not like it

    Ooooh yeah! That would be super cool statistics for global market growth and stuff. I will definitely include that in the next update.

»
3 years ago, # |
Rev. 2   Vote: I like it +19 Vote: I do not like it

Nice project. codetiger927 orz.

Is it possible to see how many users have purchased our stock (or something like that)?

»
3 years ago, # |
  Vote: I like it +47 Vote: I do not like it

Nice website, but when I open a new page, I'm logged out.

  • »
    »
    3 years ago, # ^ |
      Vote: I like it +21 Vote: I do not like it

    :sweat: so this is because I am too lazy to change the login to logout once you login :rooderp:. You don't get logged out until you click the logout button in profile. Sorry for the inconvenience, I will try to fix that soon

    • »
      »
      »
      3 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      It's fixed, but only on the Profile page.

      Also, I think the Register button should be hidden when you are logged in.

»
3 years ago, # |
  Vote: I like it 0 Vote: I do not like it

I'm almost 400 below my max rating, you can bet on me losing more

»
3 years ago, # |
  Vote: I like it +9 Vote: I do not like it

Awesome project!!!!!!! Would have been more fun if there was real money.

»
3 years ago, # |
  Vote: I like it +194 Vote: I do not like it

rainboy plz register now and you'll be the focus of the game

  • »
    »
    3 years ago, # ^ |
      Vote: I like it +18 Vote: I do not like it

    LOL YES I SECOND THIS. (maybe I should just create a futures market specifically for rainboy where people can just bet on him xD)

  • »
    »
    3 years ago, # ^ |
      Vote: I like it +8 Vote: I do not like it

    He did register lol.

»
3 years ago, # |
Rev. 2   Vote: I like it +17 Vote: I do not like it

The leaderboard (and other places) shows names only in lowercase. I need capitalization on my name, it's part of the stonks-brand! :(

»
3 years ago, # |
  Vote: I like it +5 Vote: I do not like it

Maybe there is a bug: I tried to buy myself using my another account, which is unrated and certainly less than 6 rated contests, but I succeeded. I think this should be banned.

  • »
    »
    3 years ago, # ^ |
    Rev. 2   Vote: I like it 0 Vote: I do not like it

    moyu_028 apparently also bought their own stocks for nothing (Holdings with $0 Purchase Price). I think that such inappropriately obtained stocks should be confiscated and returned back to market :-)

    Edit: and now sold all 1000 stocks for $6.66 after buying for $0 (see moyu_028's trade history). That was free $6660 from nothing via exploiting this bug.

»
3 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Adding margin trading would be much more fun xD

»
3 years ago, # |
  Vote: I like it +15 Vote: I do not like it

It seems that LGMs are being showed incorrectly (Fulislike)

»
3 years ago, # |
  Vote: I like it +52 Vote: I do not like it

I think it would be safer if the website randomly generates a string for verifying instead of this fixed "StonksCF-verify".

»
3 years ago, # |
  Vote: I like it +29 Vote: I do not like it

Hello! I was out of cash and I wanted to buy a stock, so I sold some of my other stocks to get enough cash for it. The sell operation was successful, the stocks disappeared from my portfolio but I did not get any cash back. Any reason why this could be happening? Thanks for the help in advance!

  • »
    »
    3 years ago, # ^ |
      Vote: I like it +18 Vote: I do not like it

    Oh, this is very strange. I think it's because of a bug in my code that acts weird when there is a lot of concurrent transactions. I added some autofix code that should recalculate your cash and everything for the next trading cycle. Thanks for pointing that out

»
3 years ago, # |
  Vote: I like it +8 Vote: I do not like it

It seems that no one(including me) holds my stock but according to "Explore -> Available Stocks", my stock is purchasable only 995.
Some stocks disappeared happened to me, but maybe it also happened that I only get some cash and my stocks aren't erased.

  • »
    »
    3 years ago, # ^ |
      Vote: I like it +13 Vote: I do not like it

    That is so strange. I honestly don't really know how that happened. My only idea is that the MySQL database sometimes has conflicting records so it just misbehaves. In any case, I have fixed your available stock counts. For the future, I think I will have to just recalculate everything at the start of each trading cycle since thankfully they don't happen that often. But yeah sorry for the inconvenience

»
3 years ago, # |
Rev. 2   Vote: I like it +44 Vote: I do not like it

I think the stocks shouldn't exist until they have like 10 contests at least otherwise the best tactic is too just look for alt sounding grey names. Like "WaOnPretest2Forces", "TheOneYouLost", "SomeOneWillBeLgm" etc. You should give them the stocks when they reach 10 contests instead.

»
3 years ago, # |
Rev. 3   Vote: I like it +47 Vote: I do not like it

R...rating
P...price

Rank Boost Rmin Rmax Pmin Pmax
LGM 9 5.16 3000 inf 154.79 inf
IGM 8 4.30 2600 2999 111.8 128.95
GM 7 3.58 2400 2599 86 93.13
IM 6 2.99 2300 2399 68.68 71.63
M 5 2.49 2100 2299 52.25 57.21
CM 4 2.07 1900 2099 39.4 43.52
Blue 3 1.73 1600 1899 27.65 32.81
Cyan 2 1.44 1400 1599 20.16 23.03
Green 1 1.20 1200 1399 14.4 16.79
Light Green 0 1.00 1000 1199 10.00 11.99
Gray 0 1.00 0 999 0 9.99
White 0 0.00 -inf -1 0 0
  • »
    »
    3 years ago, # ^ |
      Vote: I like it +11 Vote: I do not like it

    Great chart!

    Maybe two small mistakes:

    The Pmin of Gray should be 0.00. And is the colour of specialist cyan?

    • »
      »
      »
      3 years ago, # ^ |
      Rev. 2   Vote: I like it +11 Vote: I do not like it

      Gray's Pmin=0.00?

      There are some accounts which have a negative rating. Maybe in this case, unknown behavior.

      Light Blue -> Cyan

      Fixed, thanks!(By the way, I think #00ffff(cyan) is more lighter than CF cyan)

      • »
        »
        »
        »
        3 years ago, # ^ |
          Vote: I like it +11 Vote: I do not like it

        I found one with negative rating and its stock price is $0.00.

        Free stocks anyway. :P

  • »
    »
    3 years ago, # ^ |
      Vote: I like it +11 Vote: I do not like it

    Some IGMs have incorrect price (maybe [2600,2700)'s Rank should be 8, but actually it works as 7)

    • »
      »
      »
      3 years ago, # ^ |
        Vote: I like it +10 Vote: I do not like it

      Oh yeah, you're right. I accidentally wrote 2700 in my rank converter code. Thanks for pointing that out! It should be fixed during the next trading cycle

»
3 years ago, # |
  Vote: I like it +8 Vote: I do not like it

What an awesome project! It'd be epic if this gets incorporated into CF officially.

ORZ codetiger

»
3 years ago, # |
  Vote: I like it +24 Vote: I do not like it

codetiger927 can you enable transacting on all CF users and not just people who joined your site? I think it'd make it a lot more fun and interesting.

  • »
    »
    3 years ago, # ^ |
    Rev. 2   Vote: I like it 0 Vote: I do not like it

    Hi. So I would like to, but the problem is, if people try to buy an unregistered users stock, and say they bought all 1000 of the stocks, then the system won't have any more stocks to give to that user once he registers. I think currently the best solution is, if you want to invest anyone who isn't registered yet, shoot them a DM and ask them to join :p

    • »
      »
      »
      3 years ago, # ^ |
        Vote: I like it +11 Vote: I do not like it

      Couldn't you instead limit the default supply to 800 shares per user, and then create 200 new shares when they register?

»
3 years ago, # |
  Vote: I like it 0 Vote: I do not like it

I think it would be fun to have a "leaderboard of millionaires" or so, to quickly find out who's the currently richest!

»
3 years ago, # |
  Vote: I like it +7 Vote: I do not like it

we dont have a shorting option for more than the quantity we have. wouldnt it be good to have a shorting option so that we can short those who seemed to have climbed rather abruptly or are in a higher probability of not going up??

»
3 years ago, # |
  Vote: I like it +12 Vote: I do not like it

shorting rainboy in div 1 and educational rounds and then buying him before div 2 rounds should be awesome

»
3 years ago, # |
  Vote: I like it 0 Vote: I do not like it

orz

»
3 years ago, # |
  Vote: I like it +12 Vote: I do not like it

I think the change of nicknames has broken the website :( All my stock in senyaa has gone to 0 because they renamed to mtw

  • »
    »
    3 years ago, # ^ |
      Vote: I like it +10 Vote: I do not like it

    yeah something very weird is happening :weary:. I am trying to fix all of these issues. Sorry for the inconvenience.

  • »
    »
    3 years ago, # ^ |
      Vote: I like it +10 Vote: I do not like it

    :D hopefully the problem has been fixed! Let me know if there are any more issues

»
3 years ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

I know I'm dumb, but what should I do if I forgot my password ?

»
3 years ago, # |
  Vote: I like it +8 Vote: I do not like it

The market is open now. But the stonks prices don't seem to have been updated after the Educational Codeforces Round 120 [Rated for Div. 2]. Which allowed to sell bad performing stonks for the old price.

»
3 years ago, # |
Rev. 2   Vote: I like it +8 Vote: I do not like it

i changed my handle to SirPh but its not updated in the website, it still shows the old handle which is error_404_2020

when i tried registering again using new name IT DID REGISTER and now i have 2 accounts with the same account

  • »
    »
    3 years ago, # ^ |
    Rev. 2   Vote: I like it +8 Vote: I do not like it

    it has now been fixed. The new year name changed messed up a lot of things. Sorry for the inconvenience

»
22 months ago, # |
  Vote: I like it +3 Vote: I do not like it

Auto comment: topic has been updated by codetiger927 (previous revision, new revision, compare).