How-To-Connect-My-Data

The Charting Library does NOT include market data. You must provide your own data in the required format. A sample data engine integrates Yahoo Finance API historical data. The charts can receive data in two ways:

  1. Update in real-time with a PUSH type connection, for example through WebSocket. This way your charts will autoupdate with new prices when they arrive. To achieve this, you have to use the [[JavaScript API|JS-Api]] and have your own transport method ready.

  2. Update on a PULL/pulse/refresh basis (like most web-based charts today), where the chart data is updating every X number of seconds (the chart client will ask the server emulating PUSH updates), or only get reloaded manually by the user. For this, use the [[UDF protocol|UDF]] and write your own datafeed wrapper.

JavaScript API or UDF?

udf_or_jsapi.png

UDF scheme

udf.png

JSAPI scheme

jsapi.png

The pictures above illustrate the difference between UDF and JSAPI. Mandatory Charting Library parts are colored blue. Red parts (default data transport) are included in default package (having non-minimized source code) and may be replaced. You may see the default data transport implements JS API to interact with the chart. Also, default transport implements UDF protocol to communicate with a server.

  1. If you already have a data transport ready (websocket streaming, polling, or any other transport), or if you don’t but need streaming data - use our [[JavaScript API|JS-Api]], which is extremely compact and simple to implement. You will have to create a small client-side data adapter between your data transport and our charts using JavaScript.

  2. If you don’t have any transports and do not need streaming data (e.g., data pulsing is all you need), then you will have to create (or use) at least a thin server-side datafeed wrapper. You may use any language and technology for this purpose: it’s just necessary for your wrapper to support our data exchange protocol (we call it [[UDF|UDF]]) to be able to feed your Charting Library with data. You will have to create a small server-side data adapter between your back-end and our charts using you favorite language.

Want Examples ?

A sample implementation of UDF-compatible (case #2 described below) server-side wrapper is available on github. It uses Yahoo! and Quandl data.

A sample of JS API implementation (and UDF client-side at the same time) is a part of Charting Library package (see datafeed.js file).

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • PLEASE READ THE FOLLOWING APPLE DEVELOPER PROGRAM LICENSE...
    念念不忘的阅读 13,526评论 5 6
  • 周末的美好与幸福往往彰显了周一的忧郁,不知有多少人与我有同感?妞最近追剧《剃刀边缘》,说是妞爸推荐,我算服了这父女...
    微尘ht阅读 144评论 0 1
  • 时间:中午11:45—12:45 练习内容: 跟着张梅练习了一节流瑜伽,强度略大 反思和收获: 1偷偷记下了这一节...
    付振阅读 199评论 0 0
  • 2abe6b0369a7阅读 168评论 0 1
  • 原来玩LOL, 不咸不淡地混着,主玩一个英雄自然实力上超过同时期的人多一些,最近去一区,新建了小号,重新开始。 忽...
    化浊阅读 233评论 0 0