StockStalker.stalker - RockoonTechnologies/StockStalker GitHub Wiki
Stalker
THIS IS CURRENTLY NOT AVAILABLE IN THE PUBLIC VERSION OF STOCKSTALKER the Stalker module is the most advanced aspect of the StockStalker, but in return, provides pretty great functionality.
The Stalker
class is a asynchronous Stock Tracker, that can log Stocks in a highly configurable manner, in Parallel to your program.
The Stalker
class looks like so:
Stalker
Stalker(self, target=, duration=, verbose=, name=, long_poll_delay=30, save=True, save_location="saves", dailyCallback=, doneCallback=):
target
is the ticker you want to track (crypto sooon)duration
is the number of days you want to track thetarget
verbose
- setTrue
if you want loggingname
- optional but highly recommended, the identification used in saves and logginglong_poll_delay
- how long you want it to check if the market is open for that day (just leave it at 30)save
choose to save or not (highly recommended)save_location
path to directory at which you want to save (ignore if your not saving)dailyCallback
set to aStalkerCallback
object, a function you want the program to call everydaydoneCallback
same asdailyCallback
but runs after the program is finished
Once you created a Stalker
object,
you can run it with run()
, this is asynchronus, so it doesnt wait for anything
If you want to wait until the thread is done, use wait()
If you want to forcefully stop the Object, use kill()
, it tries to kill the program whenever it can, there may be a delay
StalkerCallback
The StalkerCallback
class currently only really exists for orginization sake, but it will fufill more in the future.
This is used to populate the dailyCallback
and doneCallback
of a Stalker
It looks like so:
StalkerCallback(self, function=None):
Just set function
to whatever function you want to eventually call.
Ex:
def Foo():
print("Hi")
StalkerCallback(self, function=Foo):
👌