Storing Streaming Data tick by tick in CPanel

pivottrading.net
Guys, I need tick by tick data to run my algos. I have written my algos in PHP.
Now, PHP lowest cron job limit is 1 min.

So, if i use Http Api to get the quotes, i loose the tick-by-tick data of 1 min.

From reading all these post, i understand that PHP Client Library is not available for Streaming WebSocket.

I tested WebSocket API from simple HTML code on my local machine and it seems to get tick by tick update properly.

But, I want to do this on my Linux Server which is operated using CPanel.

My query is, what can i do to get tick by tick data on my Linux Server.
If i configure cron job best refresh rate is 1 min.

How, can I replicate the same Javascript behaviour of my local machine's web-browser on my Linux Server.

I understand there is no PHP Client Library, but i will create the library if required, but i just need to understand what can we do to replicate the same local machine's browser behaviour on my Linux Server.

I am not very familiar with WebSocket Programming. (But i can do it, if someone can help me understand or show me the way to approach this on Linux Server)

Any help is appreciated.

Thanks,
Sourabh.
(Pivottrading.Net)
  • Kailash
    You should take a look at our official Python / Javascript (Node) libraries. You should be able to run those libraries as stand alone servers (on any platform) and have them push the quotes to a file or a database.

    If you really need it in PHP, it should be fairly straight forward to port the above mentioned libraries.
  • pivottrading.net
    How Kailash ???
    what do u mean by porting the libraries?
    sorry, but i m not so good in socket programming.
    my server is in US. my requirement is i should get tick by tick data on that server. (as simple as that)
    Now, my problem is technically i m not able to figure out way of making my US server as a client for KiteConnect WebSocket.

    I was even searching a way to use google app engine to make it a client for Kite Conntect WebSocket API. but no luck there as well

    I am kind of stuck with this. and i have to rely on http JSON API for ltp and other data which is high latency and not efficient.

    i can do this is my html page but, my idea/requirement is to do this streaming on my unix box or on cloud. but how.......... :(
  • ramatius
    @pivottrading.net
    You can run an infinite loop in php (say, with a while(1) loop and let it send data request every X seconds. You can access this URL just once in the morning and let it run through the day. The script can check for timelimits and exit at 3:30pm. It can also prevent multiple runs (i.e. if you accidentally invoke the URL more than once) by setting/checking for existence of a flag file.

    Another way to do it - instead of just 1 php script, run the same script twice with a time difference, say 30 seconds. This will double the data rate.

    Another way of doing it - you can run websocket in your laptop/desktop and then invoke the US URL every X seconds to push the data there.

    So, there is no reason for you to get stuck. :)

    Happy trading!
  • pivottrading.net
    @ramatius I am already doing 30 sec approach.
    But, with http request you cannot sent more than 3 request per second. So, there is no efficiency.
    I am looking for Streaming data,

    Anyways, now i have started on Java API for Streaming Quotes. So, i will deploy Java API on server. I am Looking for server which allows socket connection on VPS or cloud.
Sign In or Register to comment.