Блог пользователя codetiger927

Автор codetiger927, история, 3 года назад, По-английски

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

  • Проголосовать: нравится
  • +711
  • Проголосовать: не нравится

»
3 года назад, # |
  Проголосовать: нравится +35 Проголосовать: не нравится

orz codetiger

»
3 года назад, # |
  Проголосовать: нравится +31 Проголосовать: не нравится

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

»
3 года назад, # |
Rev. 2   Проголосовать: нравится +39 Проголосовать: не нравится

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

»
3 года назад, # |
  Проголосовать: нравится +37 Проголосовать: не нравится

Great idea! codetiger orz

»
3 года назад, # |
  Проголосовать: нравится +41 Проголосовать: не нравится

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

»
3 года назад, # |
  Проголосовать: нравится +43 Проголосовать: не нравится

Kinda cool

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

  • »
    »
    3 года назад, # ^ |
      Проголосовать: нравится +37 Проголосовать: не нравится

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

»
3 года назад, # |
Rev. 3   Проголосовать: нравится +60 Проголосовать: не нравится

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 года назад, # ^ |
      Проголосовать: нравится +33 Проголосовать: не нравится

    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 года назад, # ^ |
      Проголосовать: нравится +15 Проголосовать: не нравится

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

  • »
    »
    3 года назад, # ^ |
      Проголосовать: нравится +10 Проголосовать: не нравится

    agreed, I'd short myself to oblivion

»
3 года назад, # |
  Проголосовать: нравится +51 Проголосовать: не нравится

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

»
3 года назад, # |
  Проголосовать: нравится +14 Проголосовать: не нравится

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 года назад, # |
  Проголосовать: нравится +35 Проголосовать: не нравится

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

»
3 года назад, # |
  Проголосовать: нравится +11 Проголосовать: не нравится

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 года назад, # ^ |
      Проголосовать: нравится +3 Проголосовать: не нравится

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

»
3 года назад, # |
Rev. 2   Проголосовать: нравится +19 Проголосовать: не нравится

Nice project. codetiger927 orz.

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

»
3 года назад, # |
  Проголосовать: нравится +47 Проголосовать: не нравится

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

  • »
    »
    3 года назад, # ^ |
      Проголосовать: нравится +21 Проголосовать: не нравится

    :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 года назад, # ^ |
        Проголосовать: нравится 0 Проголосовать: не нравится

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

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

»
3 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

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

»
3 года назад, # |
  Проголосовать: нравится +9 Проголосовать: не нравится

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

»
3 года назад, # |
  Проголосовать: нравится +194 Проголосовать: не нравится

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

»
3 года назад, # |
Rev. 2   Проголосовать: нравится +17 Проголосовать: не нравится

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

»
3 года назад, # |
  Проголосовать: нравится +5 Проголосовать: не нравится

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 года назад, # ^ |
    Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

    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 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Adding margin trading would be much more fun xD

»
3 года назад, # |
  Проголосовать: нравится +15 Проголосовать: не нравится

It seems that LGMs are being showed incorrectly (Fulislike)

»
3 года назад, # |
  Проголосовать: нравится +52 Проголосовать: не нравится

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

»
3 года назад, # |
  Проголосовать: нравится +29 Проголосовать: не нравится

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 года назад, # ^ |
      Проголосовать: нравится +18 Проголосовать: не нравится

    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 года назад, # |
  Проголосовать: нравится +8 Проголосовать: не нравится

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 года назад, # ^ |
      Проголосовать: нравится +13 Проголосовать: не нравится

    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 года назад, # |
Rev. 2   Проголосовать: нравится +44 Проголосовать: не нравится

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 года назад, # |
Rev. 3   Проголосовать: нравится +47 Проголосовать: не нравится

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 года назад, # ^ |
      Проголосовать: нравится +11 Проголосовать: не нравится

    Great chart!

    Maybe two small mistakes:

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

    • »
      »
      »
      3 года назад, # ^ |
      Rev. 2   Проголосовать: нравится +11 Проголосовать: не нравится

      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 года назад, # ^ |
      Проголосовать: нравится +11 Проголосовать: не нравится

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

    • »
      »
      »
      3 года назад, # ^ |
        Проголосовать: нравится +10 Проголосовать: не нравится

      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 года назад, # |
  Проголосовать: нравится +8 Проголосовать: не нравится

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

ORZ codetiger

»
3 года назад, # |
  Проголосовать: нравится +24 Проголосовать: не нравится

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 года назад, # ^ |
    Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

    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 года назад, # ^ |
        Проголосовать: нравится +11 Проголосовать: не нравится

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

»
3 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

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

»
3 года назад, # |
  Проголосовать: нравится +7 Проголосовать: не нравится

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 года назад, # |
  Проголосовать: нравится +12 Проголосовать: не нравится

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

»
3 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

orz

»
3 года назад, # |
  Проголосовать: нравится +12 Проголосовать: не нравится

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 года назад, # ^ |
      Проголосовать: нравится +10 Проголосовать: не нравится

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

  • »
    »
    3 года назад, # ^ |
      Проголосовать: нравится +10 Проголосовать: не нравится

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

»
3 года назад, # |
Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

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

»
3 года назад, # |
  Проголосовать: нравится +8 Проголосовать: не нравится

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 года назад, # |
Rev. 2   Проголосовать: нравится +8 Проголосовать: не нравится

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

»
21 месяц назад, # |
  Проголосовать: нравится +3 Проголосовать: не нравится

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