No. of Recommendations: 9
Any recommendations on the best way to [grab market data during the day]? I use finnhub.io to subscribe to realtime streaming quotes for free. You can sign up in 15 seconds at
https://finnhub.io/Gives you realtime prices every second plus open/low/high/close/volume on any ticker you want. I use it to calc
You need to have some familiarity with Python. For example, my Python programs calculate 50-day moving averages on the stocks I own, and can automatically send buy/sell and stop/loss orders to my broker.
These days, with Generative AI tools you can use Amazon Q Developer or Microsoft Copilot to generate and explain the code you need. The Finnhub API uses Websockets, which is pretty fast.
The below code, for example, gets real time prices on AAPL and AMZN for free.
#
https://pypi.org/project/websocket_client/import websocket
def on_message(ws, message):
print(message)
def on_error(ws, error):
print(error)
def on_close(ws):
print("### closed ###")
def on_open(ws):
ws.send('{"type":"subscribe","symbol":"AAPL"}')
ws.send('{"type":"subscribe","symbol":"AMZN"}')
if __name__ == "__main__":
websocket.enableTrace(True)
ws = websocket.WebSocketApp("wss://ws.finnhub.io?token=cq02qp9r01qkg1bdubkgcq02qp9r01qkg1bdubl0",
on_message = on_message,
on_error = on_error,
on_close = on_close)
ws.on_open = on_open
ws.run_forever()