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

Real-time APIs in Fintech & RiotJS-Xignite Demo

erichoresnyi
September 24, 2015
58

Real-time APIs in Fintech & RiotJS-Xignite Demo

#fintechrevolution, apidays.io fintech, BankingAPI, #fintechrevolution
London, 24 Sept'2015

erichoresnyi

September 24, 2015
Tweet

Transcript

  1. What is real-time ? It’s relative to the user Real-time

    API in Finance @StreamdataIO #BankingAPI
  2. 10ns - 100ms 100ms - 500ms 500ms - 5sec 5sec

    - 5mins 5mins - 5days 5 days - 5+years HIGH FREQUENCY TRADING ALGO TRADING DAY TRADING ACTIVE RETAIL TRADING REGULAR RETAIL INVESTOR 75% of trading volumes in FX Winner J
  3. This talk is not about HFT A broker could lose

    $4m platform if 5 ms behind the competition. http://www.tabbgroup.com/PublicationDetail.aspx?PublicationID=346 Real-time API in Finance @StreamdataIO #BankingAPI
  4. Information Asymmetry 2001 Nobel Prize of Economics G.Akerlof,A.Spence,J.Stiglitz <div>Icons made

    by <a href="h6p://www.freepik.com" =tle="Freepik">Freepik</a> from <a href="h6p://www.fla=con.com" =tle="Fla=con">www.fla=con.com</a> is licensed by <a href="h6p://crea=vecommons.org/licenses/by/3.0/" =tle="Crea=ve Commons BY 3.0">CC BY 3.0</a></div> Real-time API in Finance @StreamdataIO #BankingAPI
  5. Transparency eg Blog $€£ 1990 T.Berners-Lee, CERN = share knowledge

    2000 R.Fielding = Uniform Interface/REST APIs 2001 Nobel/Lemons 2013 Research on Financial Blog impact on Insider/Outsider Information Asymmetry, GD Saxton, SUNY Real-time API in Finance @StreamdataIO #BankingAPI
  6. Real Time UX… i$ Rea£ Mon€¥ Amazon found every 100

    milliseconds of apps latency cost them 1% in sales. Source: http://perspectives.mvdirona.com/2009/10/31/TheCostOfLatency.aspx Google found an extra 0.5 seconds in search page generation time dropped traffic by 20% Source: http://highscalability.com/latency-everywhere-and-it-costs-you-sales-how-crush-it
  7. HOW AND WHERE ? REALTIME API IN FINANCE? Real-time API

    in Finance @StreamdataIO #BankingAPI
  8. It’s all about the Developer Experience Standard data format: JSON

    & protocol: HTTP (no FIX, FAST or ITCH) Scalable: millions not thousands Wired Desktops & Wireless 500ms-1sec for all Real-time API in Finance @StreamdataIO #BankingAPI
  9. What are my options to scale real-time UX ? Real-time

    API in Finance @StreamdataIO #BankingAPI
  10. HTTP •  Half-duplex (Client/Server) •  Verbose (ACK required + headers)

    ! TCP SYN / SYN ACK " SSL conf # GET data / Data (200 OK or 204 No content) Real-time API in Finance @StreamdataIO #BankingAPI
  11. Long polling (HTTP Hack) ! TCP SYN / SYN ACK

    " SSL conf # GET data / Data (200 OK or 204 No content) Real-time API in Finance @StreamdataIO #BankingAPI
  12. Server-Sent Events (RFC 6455) HTTP 1.1 Server-push (uni-directional) W3C defined

    event source API HTML5 Real-time API in Finance @StreamdataIO #BankingAPI
  13. Websocket SSE Request 101 => to Upgrade to WebSocket OPEN

    / MESSAGE / CLOSE Error handling to be built HTTP ! No upgrade Error handling specified (reconnec=on / event ID)
  14. Options for dynamic data Streams Browser support Web infra com-

    patibility Easiness to dev Load (network + Device) App latency Polling/ Long Polling Bi-dir Websocket Bi-dir SSE Uni-dir Real-time API in Finance @StreamdataIO #BankingAPI
  15. Streaming vs HTTP REST “POST” to one client Source :

    Arun Gupta - h1p://blog.arungupta.me/rest-vs-websocket-comparison-benchmarks/ •  10 messages of 1 byte : 7ms vs 220 ms •  100 messages of 10 bytes : 57 vs 986 ms •  1000 messages of 100 bytes : 200 vs 10210 ms •  5000 messages of 1000 bytes : 1,2 sec vs 54 sec. Real-time API in Finance @StreamdataIO #BankingAPI
  16. SSE vs Websocket Fetch 500 Tweets on a web page

    Source h1p://ma1hiasnehlsen.com/blog/2013/05/01/server-sent-events-vs-websockets/ Safari Chrome Firefox Websocket 16s 8s 8s SSE 7s 5s 6s Delta x2,2 x1,6 x1,3 Real-time API in Finance @StreamdataIO #BankingAPI
  17. Bench 1 - Polling with Cache Bench 2 - Streaming

    Real-time API in Finance @StreamdataIO #BankingAPI
  18. Client/Device CPU Polling Streaming Hence, saves 75 to 99% ba6ery

    =me h 6 p : / / w w w . r e s e a r c h g a t e . n e t / p u b l i c a = o n / 256453451_The_Comparison_of_Impacts_to_Android_Phone_Ba6ery_b etween_Polling_Data_and_Pushing_Data
  19. Environmental impact Over 1 year GHG Water Energy Scope 3

    (Build) kg CO2 eq liters kWh / year Smartphones 38 607 100 15" laptop 99 835 200 Desktop 76 362 200 24" screen 24 62 509 50 1U 16 core-server 100 475 333 Scope 2 (Use) 1 TByte of Data 135 900 300 Footprint of a 1m-user 2’/day realtime app, same as consumtion of 2000 people in Romania h6p://streamdata.io/blog/the-web-environmental-footprint-in-short/ Real-time API in Finance @StreamdataIO #BankingAPI
  20. Sources •  http://dsheiko.com/weblog/websockets-vs-sse-vs-long- polling/ (PHP) •  https://www.youtube.com/watch?v=vhJz3HftuZU (WebSocket andServer-Sent Events

    Java Arun Gupta) (JAVA) •  http://streamdata.io/blog/push-sse-vs-websockets/ •  http://matthiasnehlsen.com/blog/2013/05/01/server-sent- events-vs-websockets/ (scala) •  http://www.html5rocks.com/en/tutorials/eventsource/ basics/?redirect_from_locale=fr (JS) Real-time API in Finance @StreamdataIO #BankingAPI
  21. Reminder: Missions to citizens The Web Sharing Transparency Finance Trust

    Material Security Real-time API in Finance @StreamdataIO #BankingAPI
  22. Transfer assets Payment, Forex Protect assets Bank deposit Protect future

    wealth / venture growth: Investment Debt & Equi=es Protect against risk Insurance, futures 4 Families of Fintech APIs