qstrader
qstrader copied to clipboard
How to add new source of data?
I have a source of live data I connect to through websockets. I have the python program that connects and starts streaming the data, but I am unsure on the best way to connect it to qstrader. I want the data to be passed live to qstrader as an event, but also for the data to be logged into a database for future testing.
So I would appreciate any direction or even better examples on the best way to proceed. I am unsure if it would be better to integrate the code as a qstrader module (the network part of the data source code runs on a different thread and the info pops into the main thread with a callback so it should be alright) or to run it as its own daemon and send the data to qstrader through a localhost socket or even using a message broker.
Any advice from someone that has tried it or has experience with qstrader structure would be apreciated.
Hey @subiol, sorry this hasn't been replied to yet.
I suggest having a look at the Yahoo PriceHandler for inspiration. You'll have to create your own PriceHandler module which extends from the same base class and provides the same external-facing methods.
Basically, as long as the rest of QSTrader can call the methods that you can see in the Yahoo PriceHandler, you can do literally whatever you like.
Use cases like this are, I think, a good showcase of how easy extending qstrader is. We just totally lack any documentation at the moment as it's still pretty early stages.
Let us know how you go
Hi @ryankennedyio, I assume you mean this?
YahooDailyCsvBarPriceHandler(AbstractBarPriceHandler)
I am using a securities database, so I'd like to grab it from MySQL