Created my 1st Java program - Cryptocurrency price checker

Ghost

Seasoned Veteran
Blogger
Jun 25, 2009
3,200
185
213
Earth
wubur.com
FP$
2,492
Hey! I am super excited :)
I created my first Java program. I used Atom to write the code and learned on my own how to:
  • Create window GUI (JFrame)
  • Add content to the GUI (JPanel)
  • Add labels & buttons to the panel (JButton / JLabel)
  • Fetch data from a URL (HttpURLConnection, BufferedReader, Inputstreams...)
  • Parse JSON from the URL (Gson)
  • Void / static / public / private meanings & usage
  • Create an ActionListener with actionPerformed() to trigger data refresh (replaced by the auto refresher later)
  • Refresh data from API every 30 seconds (TimerTask / Timer)
  • Update the GUI with new data (JLabel setText() )
  • Package / compile a Java program from command line (javac, jar -cvmf), which was hard due to dependency/packaging issues with Gson (Google's java parser)
  • Use Launch4j to compile the .jar file as an .exe to make it easy to share the program with everyone
Here is an image of the program with some code behind it :)
\

All in all, it took me about 10 hours total to learn everything & get Version 1 released. I will now be using my program to learn how to use NetBeans IDE. I think using an IDE will make life a lot easier, and it will be good for compiling / error catching. I'm sure my program has some possible errors, as I did not introduce anything for if the data API is unavailable or does not return the expected results. This may cause the program to crash or freeze. There's also a freeze that occurs if you do not have internet access. In Version 2 I hope to fix these things. From there I will be making a miniature panel that allows the user to input their own cryptocurrency identifiers (ex: Bitcoin's identifier is BTC) to track them. They can input the currency code or select from a list I will include by default. They will also be able to remove tracking for a specific currency by clicking a small X on the corner of the box when they hover over it (I think that's what I will do at least).

There is also a bug where if the crypto's prices get larger (more decimals), it pushes 'USDT' (Tether) on to the next line, which is hidden from view. The next version will auto adjust the elements so no element is ever hidden & the sizing remains the same.

I will also be updating the GUI to have a toolbar on the top that allows them to access these settings, etc. The next version will not have the red bar and will be a better looking toolbar.

If you are interested in using this, please note:
  • The public API I use only allows 100,000 API calls per month, for each IP Address
  • This means if you have this open on 2 computers at once on the same internet, the program will fail half way through the month
  • Unfortunately I do not have a way to resolve this currently
  • You should only open this program on one computer in your household/internet at a time to avoid the data rate limiting
  • The program auto refreshes every 30 seconds, allowing for around 89,000 requests per month
  • Version 2 will allow the user to choose how fast they can refresh, and show how many API calls they have remaining for the month
  • Version 2 will also submit data to my own server to provide historical crypto data to users of wuCrypto
  • This will allow users to view old crypto prices, even before they owned the software I created
  • This will also allow me to provide free price updates to users, even if they have used their 100,000 original requests - which allows users to receive updates faster because everyone is 'acting as one'... aka if User A requests the Bitcoin price, I can tell User B the new price even if User B has 0 requests left

You can download the file here:
https://wubur.com/cryptocurrency-development/wuCrypto.exe

The following page also has the same data as my software wuCrypto & can be refreshed manually:
https://wubur.com/cryptocurrency-development/

If you want to make sure it's safe, I encourage you to scan it on your own. Here is an online scanner results, proving it is safe:
https://www.virustotal.com/#/url/bd928d5936c1f06b3818afcc094cb959860b2eccf9d82ca9a7c58dcc0747c1a6/detection

I used Launch4j (unsigned) to generate the .exe from the Java .jar file, which may lead to some (about 1 out of 100) scans warning users because it's unsigned and an auto installer.

The only 'outgoing' request it makes is to fetch the cryptocurrency data, which is done here at an IP-address tracked public API (limiting each IP to 100,000 monthly requests):
https://min-api.cryptocompare.com/data/pricemulti?fsyms=BTC,ETH,LTC,XRP,TRX,USDT&tsyms=USD
 
  • Like
Reactions: Ash

Ghost

Seasoned Veteran
Blogger
Jun 25, 2009
3,200
185
213
Earth
wubur.com
FP$
2,492
Congrats on making a Java program.
Thanks, I’m very happy about it! After this I will probably learn some visual and animated Java and make a very basic side scroller game.

Nice work, good luck on your future coding projects!
Thanks Simon! What’re you working on?

I look very lost reading that LOL
Lol! Well if you have any questions I will happily explain !

Congrats. I'm in the middle of learning Java myself as part of my university course.

How hard would you say it was for you to learn Java yourself @Ghost ?
That’s awesome! Good luck :)
It wasn’t too difficult , but I do have experience with JavaScript, PHP, Node.js and general coding logic, so that’s helped a lot.

I also am pretty relentless. I’ll spend hours getting 4 lines of code working if I need to, and that embeds it in my brain. In school I feel like they get way too precise, where you memorize some things but don’t actually build anything cool for years. I prefer learning on my own because I pick a project I want to build, make mistakes, and learn from them. It’s a lot easier for me