You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
70 lines
2.1 KiB
70 lines
2.1 KiB
5 years ago
|
"use strict";
|
||
|
|
||
|
function Datafeed(vue) {
|
||
|
this.vue = vue;
|
||
|
}
|
||
|
|
||
|
Datafeed.prototype.onReady = function (callback) {
|
||
|
setTimeout(function () {
|
||
|
callback({
|
||
|
supports_search: false,
|
||
|
supports_group_request: true,
|
||
|
supported_resolutions: [1, 5, 15, 30, 60, 240, 720, 'D', '2D', 'W', 'M'],
|
||
|
supports_marks: true,
|
||
|
supports_timescale_marks: true,
|
||
|
supports_time: true
|
||
|
});
|
||
|
}, 500);
|
||
|
};
|
||
|
|
||
|
Datafeed.prototype.searchSymbols = function (userInput, exchange, symbolType, onResultReadyCallback) {};
|
||
|
|
||
|
Datafeed.prototype.resolveSymbol = function (symbolName, onSymbolResolvedCallback, onResolveErrorCallback) {
|
||
|
var _this = this;
|
||
|
|
||
|
new Promise(function () {
|
||
|
setTimeout(function () {
|
||
|
onSymbolResolvedCallback(_this.vue.billinfo());
|
||
|
}, 500);
|
||
|
});
|
||
|
};
|
||
|
|
||
|
Datafeed.prototype.getBars = function (symbolInfo, resolution, from, to, onHistoryCallback, onErrorCallback, firstDataRequest) {
|
||
|
this.vue.interval = resolution;
|
||
|
|
||
|
var onDataCallback = function onDataCallback(data) {
|
||
|
if (data && data.length) {
|
||
|
onHistoryCallback(data, {
|
||
|
noData: false
|
||
|
});
|
||
|
} else {
|
||
|
onHistoryCallback([], {
|
||
|
noData: true
|
||
|
});
|
||
|
}
|
||
|
};
|
||
|
|
||
|
this.vue.getBars(symbolInfo, resolution, from, to, onHistoryCallback, onDataCallback);
|
||
|
};
|
||
|
|
||
|
Datafeed.prototype.subscribeBars = function (symbolInfo, resolution, onRealtimeCallback, subscriberUID, onResetCacheNeededCallback) {
|
||
|
this.vue.subscribeBars(onRealtimeCallback);
|
||
|
};
|
||
|
|
||
|
Datafeed.prototype.unsubscribeBars = function () {// clearInterval(this.vue.subInterval);
|
||
|
// this.vue.subObjMarket.unsubscribe();
|
||
|
};
|
||
|
|
||
|
Datafeed.prototype.calculateHistoryDepth = function (resolution, resolutionBack, intervalBack) {
|
||
|
localStorage.setItem('resolution', resolution);
|
||
|
return {
|
||
|
resolutionBack: 'M',
|
||
|
intervalBack: 24
|
||
|
};
|
||
|
};
|
||
|
|
||
|
Datafeed.prototype.getMarks = function (symbolInfo, startDate, endDate, onDataCallback, resolution) {};
|
||
|
|
||
|
Datafeed.prototype.getTimescaleMarks = function (symbolInfo, startDate, endDate, onDataCallback, resolution) {};
|
||
|
|
||
|
Datafeed.prototype.getServerTime = function (callback) {}; // export default Datafeed;
|