Crypto Feed Handler
Question: There are data sources today that disseminate data real-time through the use of WebSockets. WebSockets are a modern day advancement which allow for real-time bidirectional communication between a server and a client via TCP/IP. WebSockets are fully asynchronous and allow for event driven responses, which is perfect for creating a feed handler. Coinbase Pro disseminates real-time cryptocurrency data via their WebSockets API.
Given the below trade table, subscribe to real-time ticker data for the following product ids: "BTC-USD,ETH-USD,XRP-USD,LTC-USD,BCH-USD,OXT-USD,XLM-USD,ATOM-USD,ETC-USD,LINK-USD,ALGO-USD,DAI-USD".
If you are receiving a 'con error, then you have SSL verification turned on. You need to either have the SSL_CA_CERT_FILE environment variable set to your CA cert file, or turn off SSL verification. Do either of the following below:
Download CA cert file and export environment variable
$ curl https://curl.haxx.se/ca/cacert.pem > $HOME/certs/cabundle.pem && export SSL_CA_CERT_FILE=$HOME/certs/cabundle.pem
Turn off SSL verification of the target server SSL certificate:
$ export SSL_VERIFY_SERVER=NO
More Information:
https://docs.pro.coinbase.com/#subscribeExample
q)trade:([]time:();product_id:();sequence:();price:();open_24h:();volume_24h:();low_24h:();high_24h:();volume_30d:();best_bid:();best_ask:();side:();trade_id:();last_size:())
// After running your code
q)trade
time product_id sequence price open_24h volume_24h low_24h high_24h volume_30d best_bid best_ask side trade_id last_size
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
2020.05.17D16:22:55.144618000 BTC-USD 1.414503e+10 9791.45 9389.91 12892.92 9261.23 9896 645411.3 9790.16 9791.45 buy 9.223133e+07 0.00387904
2020.05.17D16:22:56.816019000 XRP-USD 9.193879e+08 0.2029 0.1993 2.665403e+07 0.1975 0.205 1.643819e+09 0.2029 0.203 sell 9147536 6898
2020.05.17D16:22:55.683882000 ETH-USD 9.140631e+09 208.31 201.01 109032.8 197.77 210 5854496 208.31 208.35 sell 5.834095e+07 0.07329224
2020.05.17D16:22:57.044887000 XLM-USD 1.072446e+09 0.070938 0.067764 2.978889e+07 0.06707 0.071784 2.099961e+09 0.070922 0.070938 buy 4288973 11161
2020.05.17D16:22:20.463744000 ETC-USD 9.94501e+08 6.721 6.711 248230.7 6.501 6.786 1.390851e+07 6.721 6.728 sell 4136261 11.61295
..