Python Libraries: The Hive.Engine Token Monitor

in STEMGeeks2 years ago (edited)

Cover.JPG

Don’t laugh, but it’s my intent on changing skill sets to Python Developer. Actually, do as throughout my life I have made a point of proving people wrong who underestimate me.

Coding has been a part of my life since 1982 when I taught myself BASIC on a 1k Sinclair ZX81. However, it’s never been my primary skill set, more a side trade, but one I have always enjoyed.


jobs.png
...'666 Python jobs, 8 SCCM, Appv, MSI jobs.., now can you see where I am coming from?'...

With the way the world is going and my niche in IT seriously drying up, it's time to change things. There are oodles of Python jobs out there and I need to snag an entry-level one and get my foot in the door.

I had a chat with the old leader of 'The Humble Guys' cracking group a few days ago, and of course, he's a developer now (as well as still being a skilled cracker when needed). Python is one of his many talents, and he got me using PyCharm some months ago.

Howmany errors.JPG

Downloading and being able to use it is completely different and I was not aware of the inbuilt syntax checking. This doesn't bug-proof your code, but checks for conventions. I can compare this with ICE checking for MSI validations, and as such, am taking notice of only some of these 'errors' it displays.

He mentioned that it's good practice to eradicate the errors from your code as a potential interviewer may pick your work up from your GitHub repo and put it through PyCharms’ validation as a form of integrity checking.


’ There are probably shops that would toss your code into PyCharm, and let it look for things’… - Fabulous Furlough (@fabulousfurlough)....

I find all this real-world knowledge invaluable as without it how do you crack the shell of another niche?

1space.JPG

I find one space to be more visually pleasing, but PyCharm tells me off if there’s just one. Talk about a pedantic bastard!

Multiple Imports Same Line.JPG

Multiple imports on the same line are not allowed and yet multiple variable declarations are fine!

image.png

So I am rambling, but the whole point of this post is to share some more code and add it to my own GitHub repository which I have now created.

Token Monitor is quite a simple script that monitors the BuyBook of any Hive.Engine token and displays the price every 5 seconds (user-definable value).

image.png

I have been using it to monitor GLX as it's comparatively new and descending in value. Being a monitor that runs in the background is all very well, but I wanted some sounds to alert me of changes.

This routine takes care of the sound. It's quite simple to get some basic sounds from Python, though they did get @bingbabe asking me, 'what are those weird noises?'

The is written for Wintel so I can't be sure of its behaviour on other platforms, but I am guessing it will require minimal changes.

multiplefstring.JPG

While eradicating all the 'errors' I had more issues with formatting the string than anything else, as only 71 characters are allowed on a single line. There are many solutions out there, but I found the multiple f' string method suited me the best.

depreciatedcode.JPG
Source

As newer iterations of Python are released, there are a lot of depreciated code examples on Stack Overflow. I try to use code that works with v3.6 or later if possible.

inaction.JPG

Hive.Engine Token Monitor.py can be modified to monitor other tokens, simply change the token variable to whatever you need to monitor.

It could be made to monitor many tokens at once, with many screens. My script is something that can be edited, worked on, and improved.

image.png

The full code can be found on GitHub (below). I suspect anything new from now will be added to this public repository.

https://github.com/BrynRogersTHG?tab=repositories

Learning how to use GitHub properly is something else I needed to learn such as pushing changes; talk about wading in the dark.

After speaking to @steddyman for over an hour yesterday, I have the basics of cloning, commits, push, creating branches, etc.., there's a lot you need to know before being labelled Python Developer.

Disclaimer: @slobberchops is a NOVICE Python coder, so don’t go too hard on him

RedLine.png

  • Earn currency while you play brewing virtual beer with CryptoBrewMaster
  • Earn currency while you play and become a global Rock Star with Rising Star


CurieCurator.jpg

Sort:  

Thise tips about pycharm and the errors are exactly the kind of gold that you need!

Looks awesome, for a while I dabbled in it for work but that was before they saddled me up and hitched me to a wagon and started shouting giddyup

When you start getting into the zone, it's tough to stop. I am getting there, and have a few more ideas left. Web integration is something I want to get into.

Like a derelict house-busting phoenix your detail rise from the flames!!!

WOW! this is so cool!

First, I have just found a Python tutor for my 10 years old son and I hope that I can also learn with him along this process. I had not heard about Pycharm before last week.

Second, I am also seeking to change my career path in middle age. Like you, I learned about BASIC while I was very young with enthusiasm but somehow did not continue to code ever since.

Last, I have also thought about learning to code with a clear target and Hive seems to be a perfect place to do that. 😊

So, thank you for sharing and I definitely will benefit a lot from your future sharing.

I had not heard about Pycharm before last week.

It's free, just download the community version. For the likes of us it has everything we need.

Second, I am also seeking to change my career path in middle age.

Yes, need must.. I have to do something about it. @steddyman has been badgering me to do it for a while.

So, thank you for sharing and I definitely will benefit a lot from your future sharing.

Get the BEEM library installed, there's a lot of HIVE stuff you can do with that.

Cool. Lots of information to process.... 😁

Talk about a pedantic bastard!

Aren't we all supposed to be that?

I took a couple of python OU courses during the pandemic and have made relearning and using it as my only goal for next year.
Hive is a great testing ground, so have been avidly reading and seeing who the python bods are here!

I took a couple of python OU courses during the pandemic and have made relearning and using it as my only goal for next year.

That's cool. I am doing a Udemy course.. a lesson a day. Some of it, I know, but I tend to take notes for the parts I don't. They are decent value though how much of it transcends into the professional arena I am unsure of.

Ah yes, I keep seeing Udemy advertised all over the place.

I keep reminding myself that I should save some time from my daily routine to start learning python as there are a lot of jobs in this field in Romania too and I'm sure I'd love having a career on this field.

You need to have the right mindset to do it. I have tried to teach fellow colleagues VB Script in the past and have got nowhere, because their heads are not wired up correctly.

I love playing around with all the fantastic machine-learning libraries in python.

I'm experienced in other languages, but am getting to grips with Python. It was steep at first, but I'm in the zone now.

I use Visual Studio Code (Not Visual Studio) and it doesn't even mention these indentations and spaces and that.

I can execute my code just fine using Python3 for Linux.

I never touched a tutorial for JS, and can code that alright, too.

I see little sense in picking up these weird Python nuances.

I think Python and JS (using some frameworks) is the most powerful combination today and I can build all sorts of webservices; back end as well as all frontend needs covered. (Well... with some html and css)

I use Visual Studio Code (Not Visual Studio) and it doesn't even mention these indentations and spaces and that.

@steddyman has been advocating this one, he's a professional dev but thinks Python stinks (his words). @fabulousfurlough, the ex-cracker uses Python daily and tells me in his workplace, it's around 50-50, PyCharm vs VS Studio. I have to start with one of them.

I think Python and JS (using some frameworks) is the most powerful combination today and I can build all sorts of webservices; back end as well as all frontend needs covered. (Well... with some html and css)

This is the stuff I intend to learn. The demand appears to be around AWS and Django as well as Docker. I come from a app-virtualising background (App-V), so should be able to pick up these skills once the Python has truly sunk in.

I see little sense in picking up these weird Python nuances.

I'm getting conflicting advice from multiple devs, but am happy to listen to all parties. Feel free to let me know about any bad practices you see, this is what I need to hear.

I'm getting conflicting advice from multiple devs

I have 0 professional experience, I just came to the conclusion that if I want a service, I'll have to build it myself.
I don't know what the industry needs, though.
I can only talk from my personal experience, trying to be some sort of web entrepreneur.

Since PyCharm only supports ...well... Python and since I switch around between JS and PY all the time, VSC was the obvious choice and it doesn't annoy me with being too pedantic.

For me - again: being all on my own - The most important and hardest to learn things were general software and database design, data- / workflow principals and such. The actual language is just the tool to get to where I want and when the design is solid, everything will just fall into place, almost naturally.

I can confidently say that I can pick up any language now within some weeks as the core principals are the same everywhere.

I think these language absolutists are hiding behind their niche skills, trying to cover up that code is much more than learning a language.
For example: For all services that I am building or could come up with, processing time is trivial.
The code needs to be robust and perhaps easy to read/edit. I can't buy anything from coding very 'pythonic'.

I'll be having a look at your code to get ideas. I'll see if it runs on Linux.

I tend to play around with scripts using Jupyter Notebook as I can easily tweak them. I can dump to a normal py file if it's stable. I'm using Visual Studio Code at work, but have tried Pycharm before.

Python has libraries for everything and the ones for Hive make it easy to do lots of things.

Have fun.

Holgor's libraries make use of hive.engine. I had to guess at what to use for my needs in this app. In the end it was quite simple. Writing a trading bot could be next, though I may keep that one closed-source.

Let me know if my code works for you.. interested!

I just needed to install the hiveengine library and comment out winsound for it to work. It's cross-platform!

image.png

Python does seem a bit more user friendly than the old C++ that I used to code in college. Who is doubting your ability to change course? Shame on them! I think you have a pretty decent foundation under you, this should be a relatively easy shift for you. Best of luck to you! I might have to check this out to monitor some tokens of my own!

I tend to think myself that I can't do things.., until I can. Might sounds strange.., but confidence in myself has never been huge without a push.

I can understand that. I thought you were saying that other people were doubting you. I think @iikrypticsii is taking a Python class in college right now. I honestly can't remember if it is Javascript or Python.

Posted Using LeoFinance Beta

Interesting read dude. You've got me thinking, I should have another crack at it. It would come in very useful in my work 😉. Thanks for sharing dude.

I didn't know you had a crack at Python.., just the website stuff. Django or Flask are the open-source API's you need to learn. I will get around to both, still injecting the core.

much wow, much cool!

Beginner's All-Purpose Symbolic Instruction Code was my first language too but I spend my time a lot on Python now.

Now we're talking!

It's something I would love to get into. I did a few Python courses on Treehouse but never tried my own scripts which is the next step. That Pycharm looks awesome.

Great information. I have had my doubts about pycharm but now that I know companies use it to check code validity...

Thank you for sharing this post on HIVE!

Your content got selected by our fellow curator priyanarc & you just received a little thank you upvote from us for your great work! Your post will be featured in one of our recurring compilations which are aiming to offer you a stage to widen your audience within the DIY scene of Hive. Next time make sure to post / cross-post your creation within the DIYHub community on HIVE and you will receive a higher upvote ;) Stay creative & HIVE ON!


Please vote for our hive witness <3

Hi dear you are right. Coding is very important era now a days if you like to survive this digital market to learn coding and achieve your life goals.

Thats pretty neat! thanks
!1UP

Nice! Python is my go-to when I need to script something as well. It's simple enough to be understandable, but powerful enough to run a blockchain. Good on ya!

Mind blowing never knew you were into coding now this a huge surprise to me, a man of so many skills, A phyton educator you are so skill on that also i never regret meeting you on this platform.


The rewards earned on this comment will go directly to the people sharing the post on Twitter as long as they are registered with @poshtoken. Sign up at https://hiveposh.com.

1UP-PIZZA.png

You have received a 1UP from @gwajnberg!

The @oneup-cartel will soon upvote you with:
@leo-curator, @ctp-curator, @ccc-curator, @stem-curator, @vyb-curator, @pob-curator, @neoxag-curator, @pal-curator
And they will bring !PIZZA 🍕.

Learn more about our delegation service to earn daily rewards. Join the Cartel on Discord.

🍕 PIZZA !

I gifted $PIZZA slices here:
@curation-cartel(4/20) tipped @slobberchops (x1)

Learn more at https://hive.pizza!

Congratulations @slobberchops! You have completed the following achievement on the Hive blockchain And have been rewarded with New badge(s)

You got more than 29500 replies.
Your next target is to reach 30000 replies.

You can view your badges on your board and compare yourself to others in the Ranking
If you no longer want to receive notifications, reply to this comment with the word STOP

Check out the last post from @hivebuzz:

Be ready for the last Hive Power Up Month of the year!
HiveBuzz World Cup Contest - Recap of Day 10
Hive Power Up Day - December 1st 2022

Congratulations @slobberchops! Your post has been a top performer on the Hive blockchain And you have been rewarded with the following badge

Post with the highest payout of the day.

You can view your badges on your board and compare yourself to others in the Ranking
If you no longer want to receive notifications, reply to this comment with the word STOP

Check out the last post from @hivebuzz:

HiveBuzz World Cup Contest - Recap of Day 11
Be ready for the last Hive Power Up Month of the year!
Hive Power Up Day - December 1st 2022

Congratulations @slobberchops! You received a personal badge!

You powered-up at least 10 HIVE on Hive Power Up Day!
Wait until the end of Power Up Day to find out the size of your Power-Bee.
May the Hive Power be with you!

You can view your badges on your board and compare yourself to others in the Ranking

Check out the last post from @hivebuzz:

HiveBuzz World Cup Contest - Recap of Day 11
Be ready for the last Hive Power Up Month of the year!
Hive Power Up Day - December 1st 2022

Congratulations @slobberchops! You received a personal badge!

You powered-up at least 100 HP on Hive Power Up Day! This entitles you to a level 3 badge
Participate in the next Power Up Day and try to power-up more HIVE to get a bigger Power-Bee.
May the Hive Power be with you!

You can view your badges on your board and compare yourself to others in the Ranking

Check out the last post from @hivebuzz:

HiveBuzz World Cup Contest - Recap of Day 12
Hive Power Up Month Challenge 2022-11 - Winners List
Be ready for the last Hive Power Up Month of the year!