On this film, we stream inventory present market particulars from polygon.io making use of websockets and our Alpaca API important. We join making use of the 2 wscat and a Python websocket consumer.
https://github.com/hackingthemarkets/alpaca-websockets
Purchase Me a Espresso: https://buymeacoffee.com/parttimelarry
Twitter: https://twitter.com/PartTimeLarry
Internet-site: https://hackingthemarkets.com
Supply Code: https://github.com/hackingthemarkets
supply
Buy Me a Coffee: https://buymeacoffee.com/parttimelarry
Twitter: https://twitter.com/PartTimeLarry
Website: https://hackingthemarkets.com
Source Code: https://github.com/hackingthemarkets
What a good video. Thanks man
I was wondering whether we can use this real-time tick-by-tick data to create a strategy and if yes then please make a video on this as to writing real-time data into a CSV or a DB then creating strategies with it.
Larry, great explanation! A simple question, if you do not mind answering – would it be possible to live plot websocket stream within the same python code (same file that opens websocket), so it just pops up a simple dynamic plot while streaming (ie without saving to CSV, reading back etc)?
Can you do a buffer to acumulate for example 15 candles and crete indicators with this buffer like RSI, MACD etc?
do you guys know if this is any slower than just doing it all with node.js?
Great tutorial, thanks 👍
hi larry, could you code me an app with streaming price distributed to multiple users at the same time, I will hire your services
Thank god finally I found a tutorial about WebSocket streaming of data. I am trying to stream data through IBKR. After modifying the script I am getting the following error "ModuleNotFoundError: No module named 'websocket'' " Thanks a lot.
Hi Larry, thanks for the great video. Just one question, in the python example, you called ws.send() first for authentication then called ws.send() again for subscribing to quotes. I'm wondering if the ws.send() function async? Should we wait for the first ws.send() success then send the second one?
Great video. You're a good explainer/communicator. I recommend putting a light source in front of your face so that we can see you.
Hey Larry, how can i access the keys within the dictionary if the dictionary is inside of a list? I've been trying to access the bid and ask prices to use them in my strategy but I just can't find a way to pull them from the dictionary..
LOVE this tutorial. I am having an issue though, any suggestions? When I go to authenticate my API key I get a response: zsh: command not found: action:subscribe,params:MYAPIKEY
but how do you put this live data into a dataframe so that you can place orders on the close or open of a candle? can you make a video on putting live websocket data into a pandas dataframe?
Hi , I am getting authentication failed message. i have tried generating keys from Alpaca but it is giving same message, what may be the issue ?
C:UsersAdministratorDesktopWebsocket>python app.py
opened
reaceived a message
[{"ev":"status","status":"connected","message":"Connected Successfully"}]
reaceived a message
[{"ev":"status","status":"auth_failed","message":"authentication failed"}]
But how can I actually use this data (not print it), but use in if/else statements?
What is I want to add TLS
by the way, the right package is websocket_client dont confuse with websocket package.
pip install websocket_client
Hey Larry, thanks for the amazing video. While running the script, I get a message, [{"ev":"status","status":"max_connections","message":"Maximum number of connections exceeded."}]. Is this because I'm using my Paper Trading API key? I have a funded alpaca account but am using the paper trading API key to test some algos first. Any suggestions? thanks
Hi Larry, following step by step and trying multiple different examples of connecting to the alpaca-polygon websocket api I do not get a response within PyCharm or when I run my code within the terminal. However I know I can connect to the websocket through the terminal directly using wscat, trouble shooting to make sure my credentials do indeed work i get exactly the response I should get and a working subscribed stream,; when I run this cloned script with the modified tickers and API key to my own it simply inputs and jumps to the next python command as if nothing runs, it appears I am not making the initial connection? Any ideas? I simply cannot get an answer anywhere I search the internet. Any direction helps! Love your tutorials they are very helpful and the best I have seen educational wise in the algo-trading world.
Thanks!
Alec
Great video! Simple and to the point in less than 15 minutes.
Awesome Video! I am amazed that at this point you only have 6K Views
Hi , can u make a video which can send and receive simultaneously without closing the socket ?
Hi Larry, awesome video. Could you please make a video for the same through TD Ameritrade. As in I how to code in python to grab live streaming data through TDA API. Most people use TDA and that would be greatly helpful.
Thanks for all your videos.
Is there a way to make this object-oriented? And how would you do it?
Thanks Boss
Hello sir,will you please add more functionalities to create Stock Price Alert system with this data….Thanks in advance…
Awesome video Larry – You have a real talent of explaining these concepts and getting people up and running quickly using your examples and tutorials. Keep it up.
Nice video. If one needs data for multiple stocks, do you need to create multiple websockets?
Can you demonstrate how to put the live quote on a text box where the content is refreshed each time new message is received ?
Hi, thanks for the video, really helpful! is there a way to stream all tickers that are associated with alpaca instead of subscribing to specific stocks?
Amazing!
Where can one download source code?
Hi Larry, perhaps you have an answer, I cannot authenticate via the terminal. Thanks for your help.
> (base) MacBook-Pro-GJ:~ gj$ wscat -c wss://alpaca.socket.polygon.io/stocks
Connected (press CTRL+C to quit)
< [{"ev":"status","status":"connected","message":"Connected Successfully"}]
> {"action":"auth","params":"I use my key here"}
< [{"ev":"status","status":"auth_failed","message":"authentication failed"}]
Will this end up costing $200/month? should i consider quandl or just use my ibkr api to get price data instead?
I don't think Polygon.oi websocket is supported if you only have a paper account: https://docs.alpaca.markets/api-documentation/api-v2/market-data/#polygon-integration