This project will be part of our new Quality Assurance and Information Security section. It was designed by @JosephLivengood.
The goal is for campers to be able to build these projects step by step following user stories. This will make the projects less intimidating and more fun. Oh, and donāt worry - weāll still have plenty of optional projects where we donāt provide you with any tests. And if youāve previously built these projects, you donāt need to build them again.
If youāre interested in attempting this, please reply to the thread and let us know youāve started it. The more people who want to build this, the better, as we can start gathering feedback.
Thanks, and happy coding!
User Stories:
Set the content security policies to only allow loading of scripts and css from your server.
I can GET /api/stock-prices with form data containing a Nasdaq stock ticker and recieve back an object stockData.
In stockData, I can see the stock(string, the ticker), price(decimal in string format), and likes(int).
I can also pass along field like as true(boolean) to have my like added to the stock(s). Only 1 like per ip should be accepted.
If I pass along 2 stocks, the return object will be an array with both stockās info. Instead of likes, it will display rel_likes(the difference between the likes on both stocks) on both.
This is a smaller project but is very good experience as it involves 2-4 async processes per call making the camper use promises/callbacks before responding!
I used Alphavantage.co, but itās limited to 5 calls per minute.
I also tried using a node package - google-finance-data - which works, but is painfully slow.
Hereās my working version - https://moor-skink.glitch.me - but this project does currently have several issues in its instructions and suggestions. The example doesnāt work at all.
Sending back the like in a GET is a bad practice. GET should be idempotent. It would probably be a better idea to do it in a PATCH.
Also if you actually restrict your content security policies to only allow the loading of scripts and css from your server, then jQuery wonāt work because the script comes from the domain jquery.com.
edit: Will probably create a Github issue for this.
can someone explain the purpose behind ārel-likesā?
I donāt understand the point of showing the difference of like between the two stocks; it is not explained well.
Is it just a matter of subtracting the smaller likes from the bigger likes and showing that on both stocks?
Its purpose is to show the difference between the two stocks. It makes more sense when you think of bigger numbers, for example 36587 likes and 36731 likes. It quickly shows the difference between the two. Or an even worse example: 1111111111111 likes and 11111111111111. Which one is bigger? And by how much?
But its not just bigger minus smaller, its meant to be shown from the perspective of each stock. For the first stock you do ālikes of first stockā minus ālikes of second stockā. And for the second stock it flips around: ālikes of second stockā minus ālikes of first stockā.
An example:
likes of first stock: 5; relative likes: 5 - 3 = 2
likes of second stock: 3; relative likes: 3 - 5 = -2
Now you can immidiately see how much each stock is bigger or smaller then the other one.