tradingview / charting-library-examples

Examples of Charting Library integrations with other libraries, frameworks and data transports
MIT License
1.4k stars 763 forks source link

How to integrate angular trading view implemention with ICE API INFO ? #191

Closed R1ITAdmin closed 3 years ago

R1ITAdmin commented 3 years ago

Trading view chart implementation is done using https://github.com/tradingview/charting-library-examples/tree/master/angular5. Pricing data is being provided by ICE Data. ICE Data developer site, and documentation is available here:

https://developer.theice.com/

Now, Issue is how to call and handle ICE API xml response in UDF adaptor implentation, it does'nt allow to include any external node package for handling conversion from XML to json and throws numerous error with rollup config to create bundle.js.

Let me know, if there are any examples related to integration of ICE DAT API with trading view library. thanks.

timocov commented 3 years ago

Now, Issue is how to call and handle ICE API xml response in UDF adaptor implentation, it does'nt allow to include any external node package for handling conversion from XML to json and throws numerous error with rollup config to create bundle.js.

You don't have to use UDF in this case, you can implement your own datafeed with any library you'd like to use there. Also, UDF datafeed sample allows you use any npm package you'd like, it doesn't have any restriction regardless that.

R1ITAdmin commented 3 years ago

Do we have to use JS API implentation in this case, if so how would socket implentation done for subscribe and unsubcribe methods this that case for connecting with ICE API endpoints:

https://xml.marketcenter.com/quote?symbols=ODFL&username=&pwd=

Let me know, your suggestions for that. Also Can you share example related to that??

For now, I have customised udf adaptor implemetation to call our ICE endpoint and convert xml to json and handle response for resolveSymbol and getBars methods.

Also updated package .json "devDependencies": { "@babel/core": "^7.4.3", "@babel/preset-env": "^7.4.3", "rollup": "^1.10.0", "rollup-plugin-babel": "^4.3.2", "rollup-plugin-buble": "0.15.0", "rollup-plugin-commonjs": "^9.3.4", "rollup-plugin-node-resolve": "^4.2.3", "rollup-plugin-uglify": "2.0.1", "typescript": "3.7.2", "xml-js": "^1.6.11" },

and updated rollup.config with: `/ globals process /

import commonjs from "rollup-plugin-commonjs"; import resolve from 'rollup-plugin-node-resolve'; var buble = require('rollup-plugin-buble'); var uglify = require('rollup-plugin-uglify'); var nodeResolve = require('rollup-plugin-node-resolve'); var environment = process.env.ENV || 'development'; var isDevelopmentEnv = (environment === 'development');

module.exports = [ { input: 'lib/udf-compatible-datafeed.js', output: { format: 'umd', file: 'dist/bundle.js', name: 'Datafeeds', sourceMap: false, globals: { 'xml-js': 'xml2json', } }, plugins: [ nodeResolve({ jsnext: true, main: true , preferBuiltins: true}), buble(), !isDevelopmentEnv && uglify({ output: { inline_script: true } }), resolve({ browser: true, modulesOnly: true }), commonjs() ], external: [ 'xml2json' ] // <-- suppresses the warning }, { input: 'src/polyfills.es6', context: 'window', output: { format: 'iife', file: 'dist/polyfills.js', sourceMap: false, }, plugins: [ nodeResolve({ jsnext: true, main: true }), buble(), uglify({ output: { inline_script: true } }), ], }, ]; `

Let me know, if any suggestion related to code done. thanks

timocov commented 3 years ago

I'm afraid I can't suggest anything related to this.

timocov commented 3 years ago

Also, it seems that the issue isn't related to examples, so I'm going to close the issue.

timocov commented 3 years ago

If you'd like you can ask help on stackoverflow or in discord server https://discord.gg/UC7cGkvn4U