Upgrade to Pro — share decks privately, control downloads, hide ads and more …

An introduction to Charts

Avatar for Sergio Santos Sergio Santos
September 28, 2016

An introduction to Charts

An introduction to the charts package at IG and a deeper look into some of the challenges tackled

Avatar for Sergio Santos

Sergio Santos

September 28, 2016

Other Decks in Technology

Transcript

  1. Overview §  What is IG? §  What are Charts? § 

    Tech stack §  Challenges §  Q&A
  2. Products Cash instruments §  Shares §  Foreign Exchange §  Bonds

    Derivatives §  Contracts for difference §  Futures §  Options
  3. How customers make money The goal is always to benefit

    from movements in price. Clients may employ different strategies… §  Focus in specific markets §  Trade with leverage in volatile markets §  News and other research tools §  Statistical analysis
  4. What are charts? Visual representation of the price of a

    market over time How are they useful? §  Easier to spot trends and identify patterns §  They help people make more informed trades
  5. Tech Stack §  LightStreamer §  D3.js §  RequireJS §  HandJS

    §  Grunt §  Testing Tools (Mocha / Karma / ChaiJS / CucumberJS) §  Git §  ESLint No external framework!
  6. Challenges Just a few examples… §  Delivering real-time data § 

    Building a usable context menu §  How to quickly add drawings
  7. Delivering real-time data Our 150K active traders need accurate, real-time

    data. §  Low Latency is key §  Affects trading decisions §  Difference between making a profit or loss
  8. Delivering real-time data Pulled Data §  Historical data Pushed Data

    §  Streaming data Back-end Systems LightStreamer Server Web Server Client
  9. Streaming data Lightstreamer is a real-time messaging server. §  Implements

    both Websockets and Comet §  Supports any client-side platform §  Integrates with any back-end infrastructure §  Bandwidth control §  Frequency control (how many updates per second) §  Supports custom authentication
  10. Using Lightstreamer The Lightstreamer client allows the application to subscribe

    to real-time data pushed by the server and to send any message to the server. Example of an item §  “Apple Share”. Some fields would be: bid price, ask price, volume and timestamp https://github.com/Lightstreamer/Lightstreamer-example-HelloWorld-client- javascript
  11. Rendering the data Data visualization translates data into a graphic

    representation Bid 90 Ask 100 Timestamp 1 Bid 75 Ask 85 Timestamp 1 Bid 70 Ask 80 Timestamp 2
  12. d3 §  A data visualization library §  Makes DOM selections

    easy to manipulate §  Based on HTML, SVG and CSS §  Provides data binding between DOM elements §  Works well with scales (linear and non-linear) §  Has several utility functions that help you to draw paths https://d3js.org/
  13. The enter-exit-update pattern var cities = ["Krakow", "Warsaw", "Gdansk"]; var

    selection = d3.select("body") .selectAll("p") .data(cities) Data Elements Enter Update Exit
  14. Building a usable context menu The context menu allows users

    to setup a chart their way. http://bootsnipp.com/snippets/featured/multi-level- dropdown-menu-bs3 §  What about positioning? §  When to activate menu items? §  How to distinguish between hovering over a menu item vs navigating into a submenu's contents.
  15. The algorithm basics §  Keeping track of mouse locations § 

    Checking if we’re actually moving the mouse §  Calculate slope between current point and upper-right corner of the menu If the slope increases over time, we’re moving towards the sub-menu
  16. Improving context menu function onMenuRowEnter() { … possiblyActivate(this); } function

    possiblyActivate(row) { const delay = activationDelay(); if (delay) { setTimeout(possiblyActivate(row), delay); } else { activate(row); } } …
  17. Re-thinking Drawings Drawing tools assists users in trading. Currently, a

    minimum of 4 clicks is needed to create a single drawing. Does it feel natural? How can we make it more intuitive?