This document describes how to get streaming quotes in Microsoft Excel.
-
Install Script Lab in Excel, as described here.
-
Open Script Lab in Excel and in the code tab select "Import".
-
Paste the YAML snippet in this repository. This will create the sample of using the Binck API for realtime quotes. Make sure line ends in the "Libraries" tab are correct.
The Script Lab snippet requires an access token and an account number. The access token is used for authorization, and gives access to the instruments available for your account.
-
Create an access token using this website.
-
Open Excel, select the Add-in Script Lab.
-
Add the token to the HTML of the snippet (or insert it later, after running the snippet).
-
Do the same for the account number and (optional) refresh token.
-
Run the snippet from the ribbon menu. Script Lab will compile the code and show token and account number edits, with three buttons, "Get Indices", "Get streaming quote updates" and "Stop streaming updates".
-
Click the button "Get Indices". Excel will use the Bearer token to connect with the Binck API and if connection can be established, it will request the instruments list with the indices.
-
Click "Get streaming quote updates". This will connect to the Binck streamer to setup a websocket connection with realtime updates.
-
When done, click "Stop streaming quotes".
The instruments in this example are lists, but it can be the positions as well, or any other instrument. The quotes shown in Excel are not formatted. Color is not there as well. This is just a quick start.
Tokens are valid for one hour. If you add a refresh token, the session can be extended up to 24 hours.
Only one streaming session can be created per token. So closing the connection is important, before starting a second one.
See documentation of the streaming functionality in the Javascript showcase.
Testing without Excel can be done online, using the Script Lab Runner.