@fintatech/fintachart 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/LICENSE.md +63 -0
- package/README.md +151 -0
- package/THIRD_PARTY_NOTICES.md +38 -0
- package/basic-objects.html +165 -0
- package/css/FintaChart.min.css +1 -0
- package/css/external/jqNumericField.min.css +1 -0
- package/css/external/spectrum.min.css +7 -0
- package/css/external/toastr.min.css +1 -0
- package/custom-indicator.html +209 -0
- package/d.ts/FintaChart.d.ts +24313 -0
- package/d.ts/frameworks/Intl.d.ts +115 -0
- package/d.ts/frameworks/bootstrap.d.ts +128 -0
- package/d.ts/frameworks/bootstrap.v3.datetimepicker.d.ts +10 -0
- package/d.ts/frameworks/detectizr.d.ts +27 -0
- package/d.ts/frameworks/dom-to-image-more.d.ts +17 -0
- package/d.ts/frameworks/html2canvas.d.ts +101 -0
- package/d.ts/frameworks/i18nextXHRBackend.d.ts +42 -0
- package/d.ts/frameworks/jquery-i18next.d.ts +14 -0
- package/d.ts/frameworks/jquery-ui.d.ts +1914 -0
- package/d.ts/frameworks/jquery.d.ts +3779 -0
- package/d.ts/frameworks/jquery.ui.touch-punch.d.ts +12 -0
- package/d.ts/frameworks/moment-node.d.ts +485 -0
- package/d.ts/frameworks/moment.d.ts +10 -0
- package/d.ts/frameworks/tinycolor.d.ts +377 -0
- package/d.ts/frameworks-modified/bootstrap-select.d.ts +18 -0
- package/d.ts/frameworks-modified/i18next.d.ts +148 -0
- package/d.ts/frameworks-modified/jquery.autocolumnlist.d.ts +17 -0
- package/d.ts/frameworks-modified/jquery.resizable.d.ts +20 -0
- package/d.ts/frameworks-modified/spectrum.d.ts +294 -0
- package/d.ts/frameworks-modified/switchery.d.ts +69 -0
- package/d.ts/frameworks-modified/toastr.d.ts +224 -0
- package/data/offline-market-history/EUR_CAD/Day/1.csv +2001 -0
- package/data/offline-market-history/EUR_CAD/Hour/1.csv +1702 -0
- package/data/offline-market-history/EUR_CAD/Hour/4.csv +442 -0
- package/data/offline-market-history/EUR_CAD/Minute/1.csv +2001 -0
- package/data/offline-market-history/EUR_CAD/Minute/15.csv +2001 -0
- package/data/offline-market-history/EUR_CAD/Minute/5.csv +2001 -0
- package/data/offline-market-history/EUR_CAD/Monthly/1.csv +175 -0
- package/data/offline-market-history/EUR_CAD/Weekly/1.csv +752 -0
- package/data/offline-market-history/EUR_CAD/Yearly/1.csv +16 -0
- package/data/offline-market-history/EUR_GBP/Day/1.csv +2001 -0
- package/data/offline-market-history/EUR_GBP/Hour/1.csv +1702 -0
- package/data/offline-market-history/EUR_GBP/Hour/4.csv +442 -0
- package/data/offline-market-history/EUR_GBP/Minute/1.csv +2001 -0
- package/data/offline-market-history/EUR_GBP/Minute/15.csv +2001 -0
- package/data/offline-market-history/EUR_GBP/Minute/5.csv +2001 -0
- package/data/offline-market-history/EUR_GBP/Monthly/1.csv +199 -0
- package/data/offline-market-history/EUR_GBP/Weekly/1.csv +860 -0
- package/data/offline-market-history/EUR_GBP/Yearly/1.csv +18 -0
- package/data/predefined-templates/EMAAndMACDTemplate.json +100 -0
- package/data/predefined-templates/bigTreeTemplate.json +137 -0
- package/data/predefined-templates/multiIndicator.json +136 -0
- package/data/predefined-templates/renkoTemplate.json +50 -0
- package/data/predefined-templates/standartCandleTemplate.json +73 -0
- package/fonts/calibri/calibri.svg +3707 -0
- package/fonts/calibri/calibri.ttf +0 -0
- package/fonts/calibri/calibri.woff +0 -0
- package/fonts/courier-new/courier-new.svg +633 -0
- package/fonts/courier-new/courier-new.ttf +0 -0
- package/fonts/courier-new/courier-new.woff +0 -0
- package/fonts/open-sans-cyrillic/open-sans-cyrillic.svg +475 -0
- package/fonts/open-sans-cyrillic/open-sans-cyrillic.ttf +0 -0
- package/fonts/open-sans-cyrillic/open-sans-cyrillic.woff +0 -0
- package/fonts/open-sans-cyrillic-ext/open-sans-cyrillic-ext.svg +567 -0
- package/fonts/open-sans-cyrillic-ext/open-sans-cyrillic-ext.ttf +0 -0
- package/fonts/open-sans-cyrillic-ext/open-sans-cyrillic-ext.woff +0 -0
- package/fonts/open-sans-greek/open-sans-greek.svg +603 -0
- package/fonts/open-sans-greek/open-sans-greek.ttf +0 -0
- package/fonts/open-sans-greek/open-sans-greek.woff +0 -0
- package/fonts/open-sans-greek-ext/open-sans-greek-ext.svg +42 -0
- package/fonts/open-sans-greek-ext/open-sans-greek-ext.ttf +0 -0
- package/fonts/open-sans-greek-ext/open-sans-greek-ext.woff +0 -0
- package/fonts/open-sans-latin/open-sans-latin.svg +1863 -0
- package/fonts/open-sans-latin/open-sans-latin.ttf +0 -0
- package/fonts/open-sans-latin/open-sans-latin.woff +0 -0
- package/fonts/open-sans-latin-ext/open-sans-latin-ext.svg +1686 -0
- package/fonts/open-sans-latin-ext/open-sans-latin-ext.ttf +0 -0
- package/fonts/open-sans-latin-ext/open-sans-latin-ext.woff +0 -0
- package/fonts/open-sans-vietnamese/open-sans-vietnamese.svg +375 -0
- package/fonts/open-sans-vietnamese/open-sans-vietnamese.ttf +0 -0
- package/fonts/open-sans-vietnamese/open-sans-vietnamese.woff +0 -0
- package/fonts/rubik-medium/Rubik-Medium.svg +8831 -0
- package/fonts/rubik-medium/Rubik-Medium.ttf +0 -0
- package/fonts/rubik-medium/Rubik-Medium.woff +0 -0
- package/fonts/rubik-regular/Rubik-Regular.svg +8885 -0
- package/fonts/rubik-regular/Rubik-Regular.ttf +0 -0
- package/fonts/rubik-regular/Rubik-Regular.woff +0 -0
- package/fonts/source-sans-pro-latin/source-sans-pro-latin.svg +2642 -0
- package/fonts/source-sans-pro-latin/source-sans-pro-latin.ttf +0 -0
- package/fonts/source-sans-pro-latin/source-sans-pro-latin.woff +0 -0
- package/fonts/source-sans-pro-latin-ext/source-sans-pro-latin-ext.svg +1572 -0
- package/fonts/source-sans-pro-latin-ext/source-sans-pro-latin-ext.ttf +0 -0
- package/fonts/source-sans-pro-latin-ext/source-sans-pro-latin-ext.woff +0 -0
- package/fonts/source-sans-pro-vietnamese/source-sans-pro-vietnamese.svg +428 -0
- package/fonts/source-sans-pro-vietnamese/source-sans-pro-vietnamese.ttf +0 -0
- package/fonts/source-sans-pro-vietnamese/source-sans-pro-vietnamese.woff +0 -0
- package/htmldialogs/ChartContextMenu.html +3 -0
- package/htmldialogs/ChartTypeSettingsDialog.html +231 -0
- package/htmldialogs/CheckboxIndicatorParameterControl.html +9 -0
- package/htmldialogs/CompareInstrumentSettings.html +61 -0
- package/htmldialogs/ComparingContextMenu.html +8 -0
- package/htmldialogs/ConfirmDialog.html +28 -0
- package/htmldialogs/DemoModePopup.html +24 -0
- package/htmldialogs/FillPlotStyleControl.html +28 -0
- package/htmldialogs/HotkeysSettings.html +28 -0
- package/htmldialogs/IndicatorContextMenu.html +18 -0
- package/htmldialogs/IndicatorSettingsDialog.html +38 -0
- package/htmldialogs/IndicatorsDialog.html +39 -0
- package/htmldialogs/IndicatorsOverview_en.html +1694 -0
- package/htmldialogs/IndicatorsOverview_ua.html +9 -0
- package/htmldialogs/InstrumentSearchDialog.html +22 -0
- package/htmldialogs/LinePlotStyleControl.html +33 -0
- package/htmldialogs/MainSettings.html +292 -0
- package/htmldialogs/MarketEventPopup.html +27 -0
- package/htmldialogs/MarketEventsSettingsDialog.html +22 -0
- package/htmldialogs/NumericIndicatorParameter.html +8 -0
- package/htmldialogs/OpenChart.html +6 -0
- package/htmldialogs/PatternSettingsControl.html +26 -0
- package/htmldialogs/PatternsIndicatorSettingsDialog.html +30 -0
- package/htmldialogs/PatternsSettingsParameterControl.html +12 -0
- package/htmldialogs/PositionShapeContextMenu.html +9 -0
- package/htmldialogs/QuantityPopup.html +7 -0
- package/htmldialogs/Scrollbar.html +6 -0
- package/htmldialogs/SelectableIndicatorParameter.html +9 -0
- package/htmldialogs/ShapeContextMenu.html +7 -0
- package/htmldialogs/ShapeFibonacciSettingsDialog.html +261 -0
- package/htmldialogs/ShapePositionSettingsDialog.html +351 -0
- package/htmldialogs/ShapeSettingsDialog.html +521 -0
- package/htmldialogs/TimeFrameChangePopup.html +11 -0
- package/htmldialogs/TimeIndicatorParameterControl.html +89 -0
- package/htmldialogs/Toolbar.html +1710 -0
- package/htmldialogs/TooltipView.html +151 -0
- package/htmldialogs/TradingContextMenu.html +2 -0
- package/img/ContextMenuCheckbox.png +0 -0
- package/img/cross-hairs.cur +0 -0
- package/img/eu.png +0 -0
- package/img/favicon/favicon.ico +0 -0
- package/img/fist.cur +0 -0
- package/img/point.cur +0 -0
- package/img/svg-icons/Illustration-License-b.svg +1 -0
- package/img/svg-icons/Illustration-License-w.svg +1 -0
- package/img/svg-icons/abcd-label-pattern.svg +1 -0
- package/img/svg-icons/abcd-pattern.svg +1 -0
- package/img/svg-icons/add.svg +1 -0
- package/img/svg-icons/adjust-OHLC.svg +1 -0
- package/img/svg-icons/adjust-all.svg +1 -0
- package/img/svg-icons/andrews-pitchfork.svg +1 -0
- package/img/svg-icons/arrow-down.svg +1 -0
- package/img/svg-icons/arrow-left.svg +3 -0
- package/img/svg-icons/arrow-right.svg +3 -0
- package/img/svg-icons/arrow-type-type.svg +3 -0
- package/img/svg-icons/arrow-up.svg +1 -0
- package/img/svg-icons/arrow.svg +1 -0
- package/img/svg-icons/balloon.svg +1 -0
- package/img/svg-icons/brand-x.svg +1 -0
- package/img/svg-icons/calculator.svg +15 -0
- package/img/svg-icons/chartType-area.svg +1 -0
- package/img/svg-icons/chartType-bars.svg +1 -0
- package/img/svg-icons/chartType-candles-volume.svg +1 -0
- package/img/svg-icons/chartType-candles.svg +1 -0
- package/img/svg-icons/chartType-colored-bars.svg +1 -0
- package/img/svg-icons/chartType-equi-volume-shadow.svg +1 -0
- package/img/svg-icons/chartType-equi-volume.svg +1 -0
- package/img/svg-icons/chartType-heikin-ashi.svg +1 -0
- package/img/svg-icons/chartType-hollow-candles.svg +1 -0
- package/img/svg-icons/chartType-kagi.svg +1 -0
- package/img/svg-icons/chartType-line-break.svg +1 -0
- package/img/svg-icons/chartType-line.svg +1 -0
- package/img/svg-icons/chartType-point-figure.svg +1 -0
- package/img/svg-icons/chartType-range-bars.svg +1 -0
- package/img/svg-icons/chartType-renko.svg +1 -0
- package/img/svg-icons/chevron-right-double.svg +3 -0
- package/img/svg-icons/chevron.svg +3 -0
- package/img/svg-icons/circle.svg +1 -0
- package/img/svg-icons/close-floating-toolbar.svg +1 -0
- package/img/svg-icons/close-pane.svg +1 -0
- package/img/svg-icons/close-rect.svg +4 -0
- package/img/svg-icons/close-windows.svg +1 -0
- package/img/svg-icons/close.svg +4 -0
- package/img/svg-icons/compare.svg +1 -0
- package/img/svg-icons/copy.svg +1 -0
- package/img/svg-icons/cursorType-arrow-with-labels.svg +1 -0
- package/img/svg-icons/cursorType-arrow.svg +3 -0
- package/img/svg-icons/cursorType-crosshairs.svg +1 -0
- package/img/svg-icons/cursorType-point.svg +1 -0
- package/img/svg-icons/cyclic-lines.svg +1 -0
- package/img/svg-icons/default-screen.svg +11 -0
- package/img/svg-icons/demo-popup-bg.svg +1 -0
- package/img/svg-icons/diamond.svg +1 -0
- package/img/svg-icons/dot.svg +1 -0
- package/img/svg-icons/drag.svg +1 -0
- package/img/svg-icons/elliott-wave-pattern.svg +1 -0
- package/img/svg-icons/ellipse.svg +1 -0
- package/img/svg-icons/error-channel.svg +1 -0
- package/img/svg-icons/export.svg +1 -0
- package/img/svg-icons/extended-line.svg +3 -0
- package/img/svg-icons/fibonacci-arcs.svg +1 -0
- package/img/svg-icons/fibonacci-ellipses.svg +1 -0
- package/img/svg-icons/fibonacci-extensions.svg +1 -0
- package/img/svg-icons/fibonacci-fan.svg +1 -0
- package/img/svg-icons/fibonacci-retracements.svg +1 -0
- package/img/svg-icons/fibonacci-time-zones.svg +1 -0
- package/img/svg-icons/fintatech.svg +1 -0
- package/img/svg-icons/free-hand.svg +1 -0
- package/img/svg-icons/full-screen.svg +11 -0
- package/img/svg-icons/full-windows.svg +12 -0
- package/img/svg-icons/gann-fan.svg +1 -0
- package/img/svg-icons/general-delete.svg +3 -0
- package/img/svg-icons/head-shoulders-pattern.svg +1 -0
- package/img/svg-icons/horizontal-line.svg +1 -0
- package/img/svg-icons/horizontal-ray.svg +3 -0
- package/img/svg-icons/html-code.svg +1 -0
- package/img/svg-icons/image.svg +5 -0
- package/img/svg-icons/images.svg +1 -0
- package/img/svg-icons/in-shape-mode.svg +1 -0
- package/img/svg-icons/insert-indicator.svg +1 -0
- package/img/svg-icons/kings-crown-pattern.svg +1 -0
- package/img/svg-icons/latest-position.svg +1 -0
- package/img/svg-icons/line-segment.svg +1 -0
- package/img/svg-icons/link.svg +5 -0
- package/img/svg-icons/lock.svg +3 -0
- package/img/svg-icons/magnet-mode.svg +1 -0
- package/img/svg-icons/measure.svg +1 -0
- package/img/svg-icons/multiply-link.svg +5 -0
- package/img/svg-icons/note.svg +1 -0
- package/img/svg-icons/number-label-pattern.svg +1 -0
- package/img/svg-icons/open-OHLC-pane.svg +1 -0
- package/img/svg-icons/options.svg +1 -0
- package/img/svg-icons/period.svg +1 -0
- package/img/svg-icons/polygon.svg +1 -0
- package/img/svg-icons/polyline.svg +1 -0
- package/img/svg-icons/position-long.svg +90 -0
- package/img/svg-icons/position-long_og.svg +81 -0
- package/img/svg-icons/position-short.svg +90 -0
- package/img/svg-icons/position-short_og.svg +89 -0
- package/img/svg-icons/quadrant-lines.svg +1 -0
- package/img/svg-icons/raff-regression.svg +1 -0
- package/img/svg-icons/ray.svg +3 -0
- package/img/svg-icons/rectangle.svg +1 -0
- package/img/svg-icons/redo-new.svg +3 -0
- package/img/svg-icons/redo.svg +1 -0
- package/img/svg-icons/remove-all-indicators.svg +1 -0
- package/img/svg-icons/remove-all-shapes.svg +1 -0
- package/img/svg-icons/replay-jump.svg +1 -0
- package/img/svg-icons/replay-pause.svg +1 -0
- package/img/svg-icons/replay-play.svg +1 -0
- package/img/svg-icons/replay-skip-end.svg +1 -0
- package/img/svg-icons/replay-skip-one.svg +1 -0
- package/img/svg-icons/save-as-image.svg +1 -0
- package/img/svg-icons/screenshot.svg +5 -0
- package/img/svg-icons/scroll-bottom.svg +1 -0
- package/img/svg-icons/scroll-left.svg +1 -0
- package/img/svg-icons/scroll-right.svg +1 -0
- package/img/svg-icons/scroll-top.svg +1 -0
- package/img/svg-icons/search.svg +1 -0
- package/img/svg-icons/speed-lines.svg +1 -0
- package/img/svg-icons/square.svg +1 -0
- package/img/svg-icons/star.svg +4 -0
- package/img/svg-icons/stash.svg +4 -0
- package/img/svg-icons/stick-to-bar.svg +1 -0
- package/img/svg-icons/stick-to-close.svg +1 -0
- package/img/svg-icons/stick-to-high.svg +1 -0
- package/img/svg-icons/stick-to-low.svg +1 -0
- package/img/svg-icons/stick-to-open.svg +1 -0
- package/img/svg-icons/sticky-mode-off.svg +1 -0
- package/img/svg-icons/tcdPane-alert-indicator.svg +1 -0
- package/img/svg-icons/tcdPane-close.svg +1 -0
- package/img/svg-icons/tcdPane-down.svg +1 -0
- package/img/svg-icons/tcdPane-expand-closed.svg +1 -0
- package/img/svg-icons/tcdPane-expand.svg +1 -0
- package/img/svg-icons/tcdPane-maximize.svg +1 -0
- package/img/svg-icons/tcdPane-options.svg +1 -0
- package/img/svg-icons/tcdPane-remove-indicator.svg +1 -0
- package/img/svg-icons/tcdPane-restore.svg +1 -0
- package/img/svg-icons/tcdPane-toggle.svg +1 -0
- package/img/svg-icons/tcdPane-up.svg +1 -0
- package/img/svg-icons/template-delete.svg +1 -0
- package/img/svg-icons/template-edit.svg +1 -0
- package/img/svg-icons/template-ok.svg +1 -0
- package/img/svg-icons/template.svg +1 -0
- package/img/svg-icons/text-editor-b.svg +1 -0
- package/img/svg-icons/text-editor-i.svg +1 -0
- package/img/svg-icons/text-editor-u.svg +1 -0
- package/img/svg-icons/text.svg +1 -0
- package/img/svg-icons/tirone-levels.svg +1 -0
- package/img/svg-icons/toggle-shapes.svg +1 -0
- package/img/svg-icons/trade-manager.svg +1 -0
- package/img/svg-icons/trend-angle.svg +1 -0
- package/img/svg-icons/trend-channel.svg +1 -0
- package/img/svg-icons/triangle-pattern.svg +1 -0
- package/img/svg-icons/triangle.svg +1 -0
- package/img/svg-icons/undo-new.svg +3 -0
- package/img/svg-icons/undo.svg +1 -0
- package/img/svg-icons/unlock.svg +3 -0
- package/img/svg-icons/vertical-line.svg +1 -0
- package/img/svg-icons/visibleProfile.svg +1 -0
- package/img/svg-icons/web-link.svg +1 -0
- package/img/svg-icons/x.svg +3 -0
- package/img/svg-icons/xabcd-pattern.svg +1 -0
- package/img/svg-icons/zoom-by-area.svg +1 -0
- package/img/svg-icons/zoom.svg +1 -0
- package/img/usa.png +0 -0
- package/index-dark.html +132 -0
- package/index.html +229 -0
- package/localization/en.json +1646 -0
- package/localization/uk.json +1597 -0
- package/multiple-charts.html +162 -0
- package/package.json +62 -0
- package/scripts/FintaChart.min.js +70 -0
- package/scripts/frameworks/Intl.min.js +4 -0
- package/scripts/frameworks/bootstrap.v3.datetimepicker.min.js +2605 -0
- package/scripts/frameworks/detectizr.min.js +1 -0
- package/scripts/frameworks/dom-to-image-more.min.js +3 -0
- package/scripts/frameworks/i18nextXHRBackend.min.js +1 -0
- package/scripts/frameworks/jquery-i18next.min.js +1 -0
- package/scripts/frameworks/jquery-ui.min.js +8 -0
- package/scripts/frameworks/jquery.min.js +3 -0
- package/scripts/frameworks/jquery.ui.touch-punch.min.js +1 -0
- package/scripts/frameworks/moment.min.js +1216 -0
- package/scripts/frameworks-modified/bootstrap-select.js +1024 -0
- package/scripts/frameworks-modified/i18next.js +2075 -0
- package/scripts/frameworks-modified/jquery.autocolumnlist.js +48 -0
- package/scripts/frameworks-modified/jquery.resizable.js +229 -0
- package/scripts/frameworks-modified/spectrum.js +2279 -0
- package/scripts/frameworks-modified/switchery.js +1957 -0
- package/scripts/frameworks-modified/toastr.js +414 -0
- package/scripts/jsdataadapters/fileDataAdapter.js +129 -0
- package/scripts/jsdataadapters/restDataAdapter.js +149 -0
- package/scripts/jsdataadapters/webSocketDataAdapter.js +114 -0
- package/scripts/miscs/templateFileDataAdapter.js +17 -0
- package/scripts/themes/beetTheme.js +2999 -0
- package/scripts/themes/darkTheme.js +3004 -0
- package/scripts/themes/defaultTheme.js +3095 -0
- package/scripts/themes/fintatechDarkTheme.js +3005 -0
- package/scripts/themes/grayTheme.js +3004 -0
- package/scripts/themes/oliveTheme.js +3004 -0
- package/scripts/themes/orangeTheme.js +3004 -0
- package/scripts/themes/purpleTheme.js +3004 -0
- package/scripts/themes/skyTheme.js +3009 -0
- package/scripts/themes/tealTheme.js +3004 -0
|
@@ -0,0 +1,414 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var FintaChart;
|
|
4
|
+
(function (FintaChart) {
|
|
5
|
+
var External;
|
|
6
|
+
(function (External) {
|
|
7
|
+
|
|
8
|
+
(function (define) {
|
|
9
|
+
define(['jquery'], function ($) {
|
|
10
|
+
return (function () {
|
|
11
|
+
var $container;
|
|
12
|
+
var listener;
|
|
13
|
+
var toastId = 0;
|
|
14
|
+
var toastType = {
|
|
15
|
+
error: 'error',
|
|
16
|
+
info: 'info',
|
|
17
|
+
success: 'success',
|
|
18
|
+
warning: 'warning'
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
var toastr = {
|
|
22
|
+
clear: clear,
|
|
23
|
+
remove: remove,
|
|
24
|
+
error: error,
|
|
25
|
+
getContainer: getContainer,
|
|
26
|
+
info: info,
|
|
27
|
+
options: {},
|
|
28
|
+
subscribe: subscribe,
|
|
29
|
+
success: success,
|
|
30
|
+
version: '2.1.1',
|
|
31
|
+
warning: warning
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
var previousToast;
|
|
35
|
+
|
|
36
|
+
return toastr;
|
|
37
|
+
|
|
38
|
+
////////////////
|
|
39
|
+
|
|
40
|
+
function error(message, title, optionsOverride) {
|
|
41
|
+
return notify({
|
|
42
|
+
type: toastType.error,
|
|
43
|
+
iconClass: getOptions().iconClasses.error,
|
|
44
|
+
message: message,
|
|
45
|
+
optionsOverride: optionsOverride,
|
|
46
|
+
title: title
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function getContainer(options, create) {
|
|
51
|
+
if (!options) { options = getOptions(); }
|
|
52
|
+
$container = $('#' + options.containerId);
|
|
53
|
+
if ($container.length) {
|
|
54
|
+
return $container;
|
|
55
|
+
}
|
|
56
|
+
if (create) {
|
|
57
|
+
$container = createContainer(options);
|
|
58
|
+
}
|
|
59
|
+
return $container;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function info(message, title, optionsOverride) {
|
|
63
|
+
return notify({
|
|
64
|
+
type: toastType.info,
|
|
65
|
+
iconClass: getOptions().iconClasses.info,
|
|
66
|
+
message: message,
|
|
67
|
+
optionsOverride: optionsOverride,
|
|
68
|
+
title: title
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function subscribe(callback) {
|
|
73
|
+
listener = callback;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function success(message, title, optionsOverride) {
|
|
77
|
+
return notify({
|
|
78
|
+
type: toastType.success,
|
|
79
|
+
iconClass: getOptions().iconClasses.success,
|
|
80
|
+
message: message,
|
|
81
|
+
optionsOverride: optionsOverride,
|
|
82
|
+
title: title
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function warning(message, title, optionsOverride) {
|
|
87
|
+
return notify({
|
|
88
|
+
type: toastType.warning,
|
|
89
|
+
iconClass: getOptions().iconClasses.warning,
|
|
90
|
+
message: message,
|
|
91
|
+
optionsOverride: optionsOverride,
|
|
92
|
+
title: title
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function clear($toastElement, clearOptions) {
|
|
97
|
+
var options = getOptions();
|
|
98
|
+
if (!$container) { getContainer(options); }
|
|
99
|
+
if (!clearToast($toastElement, options, clearOptions)) {
|
|
100
|
+
clearContainer(options);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function remove($toastElement) {
|
|
105
|
+
var options = getOptions();
|
|
106
|
+
if (!$container) { getContainer(options); }
|
|
107
|
+
if ($toastElement && $(':focus', $toastElement).length === 0) {
|
|
108
|
+
removeToast($toastElement);
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
if ($container.children().length) {
|
|
112
|
+
$container.remove();
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// internal functions
|
|
117
|
+
|
|
118
|
+
function clearContainer (options) {
|
|
119
|
+
var toastsToClear = $container.children();
|
|
120
|
+
for (var i = toastsToClear.length - 1; i >= 0; i--) {
|
|
121
|
+
clearToast($(toastsToClear[i]), options);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
function clearToast ($toastElement, options, clearOptions) {
|
|
126
|
+
var force = clearOptions && clearOptions.force ? clearOptions.force : false;
|
|
127
|
+
if ($toastElement && (force || $(':focus', $toastElement).length === 0)) {
|
|
128
|
+
$toastElement[options.hideMethod]({
|
|
129
|
+
duration: options.hideDuration,
|
|
130
|
+
easing: options.hideEasing,
|
|
131
|
+
complete: function () { removeToast($toastElement); }
|
|
132
|
+
});
|
|
133
|
+
return true;
|
|
134
|
+
}
|
|
135
|
+
return false;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
function createContainer(options) {
|
|
139
|
+
$container = $('<div/>')
|
|
140
|
+
.attr('id', options.containerId)
|
|
141
|
+
.addClass(options.positionClass)
|
|
142
|
+
.attr('aria-live', 'polite')
|
|
143
|
+
.attr('role', 'alert');
|
|
144
|
+
|
|
145
|
+
$container.appendTo(FintaChart.HtmlContainer.container);
|
|
146
|
+
return $container;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
function getDefaults() {
|
|
150
|
+
return {
|
|
151
|
+
tapToDismiss: true,
|
|
152
|
+
toastClass: 'toast',
|
|
153
|
+
containerId: 'toast-container',
|
|
154
|
+
debug: false,
|
|
155
|
+
|
|
156
|
+
showMethod: 'fadeIn', //fadeIn, slideDown, and show are built into jQuery
|
|
157
|
+
showDuration: 300,
|
|
158
|
+
showEasing: 'swing', //swing and linear are built into jQuery
|
|
159
|
+
onShown: undefined,
|
|
160
|
+
hideMethod: 'fadeOut',
|
|
161
|
+
hideDuration: 1000,
|
|
162
|
+
hideEasing: 'swing',
|
|
163
|
+
onHidden: undefined,
|
|
164
|
+
|
|
165
|
+
extendedTimeOut: 1000,
|
|
166
|
+
iconClasses: {
|
|
167
|
+
error: 'toast-error',
|
|
168
|
+
info: 'toast-info',
|
|
169
|
+
success: 'toast-success',
|
|
170
|
+
warning: 'toast-warning'
|
|
171
|
+
},
|
|
172
|
+
iconClass: 'toast-info',
|
|
173
|
+
positionClass: 'toast-top-right',
|
|
174
|
+
timeOut: 5000, // Set timeOut and extendedTimeOut to 0 to make it sticky
|
|
175
|
+
titleClass: 'toast-title',
|
|
176
|
+
messageClass: 'toast-message',
|
|
177
|
+
target: 'body',
|
|
178
|
+
closeHtml: '<button type="button">×</button>',
|
|
179
|
+
newestOnTop: true,
|
|
180
|
+
preventDuplicates: false,
|
|
181
|
+
progressBar: false
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
function publish(args) {
|
|
186
|
+
if (!listener) { return; }
|
|
187
|
+
listener(args);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
function notify(map) {
|
|
191
|
+
var options = getOptions();
|
|
192
|
+
var iconClass = map.iconClass || options.iconClass;
|
|
193
|
+
|
|
194
|
+
if (typeof (map.optionsOverride) !== 'undefined') {
|
|
195
|
+
options = $.extend(options, map.optionsOverride);
|
|
196
|
+
iconClass = map.optionsOverride.iconClass || iconClass;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
if (shouldExit(options, map)) { return; }
|
|
200
|
+
|
|
201
|
+
toastId++;
|
|
202
|
+
|
|
203
|
+
$container = getContainer(options, true);
|
|
204
|
+
|
|
205
|
+
var intervalId = null;
|
|
206
|
+
var $toastElement = $('<div/>');
|
|
207
|
+
var $titleElement = $('<div/>');
|
|
208
|
+
var $messageElement = $('<div/>');
|
|
209
|
+
var $progressElement = $('<div/>');
|
|
210
|
+
var $closeElement = $(options.closeHtml);
|
|
211
|
+
var progressBar = {
|
|
212
|
+
intervalId: null,
|
|
213
|
+
hideEta: null,
|
|
214
|
+
maxHideTime: null
|
|
215
|
+
};
|
|
216
|
+
var response = {
|
|
217
|
+
toastId: toastId,
|
|
218
|
+
state: 'visible',
|
|
219
|
+
startTime: new Date(),
|
|
220
|
+
options: options,
|
|
221
|
+
map: map
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
personalizeToast();
|
|
225
|
+
|
|
226
|
+
displayToast();
|
|
227
|
+
|
|
228
|
+
handleEvents();
|
|
229
|
+
|
|
230
|
+
publish(response);
|
|
231
|
+
|
|
232
|
+
if (options.debug && console) {
|
|
233
|
+
console.log(response);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
return $toastElement;
|
|
237
|
+
|
|
238
|
+
function personalizeToast() {
|
|
239
|
+
setIcon();
|
|
240
|
+
setTitle();
|
|
241
|
+
setMessage();
|
|
242
|
+
setCloseButton();
|
|
243
|
+
setProgressBar();
|
|
244
|
+
setSequence();
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
function handleEvents() {
|
|
248
|
+
$toastElement.hover(stickAround, delayedHideToast);
|
|
249
|
+
if (!options.onclick && options.tapToDismiss) {
|
|
250
|
+
$toastElement.click(hideToast);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
if (options.closeButton && $closeElement) {
|
|
254
|
+
$closeElement.click(function (event) {
|
|
255
|
+
if (event.stopPropagation) {
|
|
256
|
+
event.stopPropagation();
|
|
257
|
+
} else if (event.cancelBubble !== undefined && event.cancelBubble !== true) {
|
|
258
|
+
event.cancelBubble = true;
|
|
259
|
+
}
|
|
260
|
+
hideToast(true);
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
if (options.onclick) {
|
|
265
|
+
$toastElement.click(function () {
|
|
266
|
+
options.onclick();
|
|
267
|
+
hideToast();
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
function displayToast() {
|
|
273
|
+
$toastElement.hide();
|
|
274
|
+
|
|
275
|
+
$toastElement[options.showMethod](
|
|
276
|
+
{duration: options.showDuration, easing: options.showEasing, complete: options.onShown}
|
|
277
|
+
);
|
|
278
|
+
|
|
279
|
+
if (options.timeOut > 0) {
|
|
280
|
+
intervalId = setTimeout(hideToast, options.timeOut);
|
|
281
|
+
progressBar.maxHideTime = parseFloat(options.timeOut);
|
|
282
|
+
progressBar.hideEta = new Date().getTime() + progressBar.maxHideTime;
|
|
283
|
+
if (options.progressBar) {
|
|
284
|
+
progressBar.intervalId = setInterval(updateProgress, 10);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
function setIcon() {
|
|
290
|
+
if (map.iconClass) {
|
|
291
|
+
$toastElement.addClass(options.toastClass).addClass(iconClass);
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
function setSequence() {
|
|
296
|
+
if (options.newestOnTop) {
|
|
297
|
+
$container.prepend($toastElement);
|
|
298
|
+
} else {
|
|
299
|
+
$container.append($toastElement);
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
function setTitle() {
|
|
304
|
+
if (map.title) {
|
|
305
|
+
$titleElement.append(map.title).addClass(options.titleClass);
|
|
306
|
+
$toastElement.append($titleElement);
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
function setMessage() {
|
|
311
|
+
if (map.message) {
|
|
312
|
+
$messageElement.append(map.message).addClass(options.messageClass);
|
|
313
|
+
$toastElement.append($messageElement);
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
function setCloseButton() {
|
|
318
|
+
if (options.closeButton) {
|
|
319
|
+
$closeElement.addClass('toast-close-button').attr('role', 'button');
|
|
320
|
+
$toastElement.prepend($closeElement);
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
function setProgressBar() {
|
|
325
|
+
if (options.progressBar) {
|
|
326
|
+
$progressElement.addClass('toast-progress');
|
|
327
|
+
$toastElement.prepend($progressElement);
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
function shouldExit(options, map) {
|
|
332
|
+
if (options.preventDuplicates) {
|
|
333
|
+
if (map.message === previousToast) {
|
|
334
|
+
return true;
|
|
335
|
+
} else {
|
|
336
|
+
previousToast = map.message;
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
return false;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
function hideToast(override) {
|
|
343
|
+
if ($(':focus', $toastElement).length && !override) {
|
|
344
|
+
return;
|
|
345
|
+
}
|
|
346
|
+
clearTimeout(progressBar.intervalId);
|
|
347
|
+
return $toastElement[options.hideMethod]({
|
|
348
|
+
duration: options.hideDuration,
|
|
349
|
+
easing: options.hideEasing,
|
|
350
|
+
complete: function () {
|
|
351
|
+
removeToast($toastElement);
|
|
352
|
+
if (options.onHidden && response.state !== 'hidden') {
|
|
353
|
+
options.onHidden();
|
|
354
|
+
}
|
|
355
|
+
response.state = 'hidden';
|
|
356
|
+
response.endTime = new Date();
|
|
357
|
+
publish(response);
|
|
358
|
+
}
|
|
359
|
+
});
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
function delayedHideToast() {
|
|
363
|
+
if (options.timeOut > 0 || options.extendedTimeOut > 0) {
|
|
364
|
+
intervalId = setTimeout(hideToast, options.extendedTimeOut);
|
|
365
|
+
progressBar.maxHideTime = parseFloat(options.extendedTimeOut);
|
|
366
|
+
progressBar.hideEta = new Date().getTime() + progressBar.maxHideTime;
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
function stickAround() {
|
|
371
|
+
clearTimeout(intervalId);
|
|
372
|
+
progressBar.hideEta = 0;
|
|
373
|
+
$toastElement.stop(true, true)[options.showMethod](
|
|
374
|
+
{duration: options.showDuration, easing: options.showEasing}
|
|
375
|
+
);
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
function updateProgress() {
|
|
379
|
+
var percentage = ((progressBar.hideEta - (new Date().getTime())) / progressBar.maxHideTime) * 100;
|
|
380
|
+
$progressElement.width(percentage + '%');
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
function getOptions() {
|
|
385
|
+
return $.extend({}, getDefaults(), toastr.options);
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
function removeToast($toastElement) {
|
|
389
|
+
if (!$container) { $container = getContainer(); }
|
|
390
|
+
if ($toastElement.is(':visible')) {
|
|
391
|
+
return;
|
|
392
|
+
}
|
|
393
|
+
$toastElement.remove();
|
|
394
|
+
$toastElement = null;
|
|
395
|
+
if ($container.children().length === 0) {
|
|
396
|
+
$container.remove();
|
|
397
|
+
previousToast = undefined;
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
})();
|
|
402
|
+
});
|
|
403
|
+
}(typeof define === 'function' && define.amd ? define : function (deps, factory) {
|
|
404
|
+
if (typeof module !== 'undefined' && module.exports) { //Node
|
|
405
|
+
module.exports = factory(require('jquery'));
|
|
406
|
+
} else {
|
|
407
|
+
window['toastr'] = factory(window['jQuery']);
|
|
408
|
+
}
|
|
409
|
+
}));
|
|
410
|
+
|
|
411
|
+
})(External = FintaChart.External || (FintaChart.External = {}));
|
|
412
|
+
})(FintaChart || (FintaChart = {}));
|
|
413
|
+
|
|
414
|
+
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/*
|
|
2
|
+
IMPORTANT NOTICE: This software and source code is owned and licensed by Fintatech B.V., https://fintatech.com
|
|
3
|
+
Downloading, installing or otherwise using this software or source code shall be made only under Fintatech License
|
|
4
|
+
agreement. If you do not granted Fintatech License agreement, you must promptly delete the software,
|
|
5
|
+
source code and all associated downloadable materials and you must not use the software for any purpose whatsoever.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
'use strict';
|
|
9
|
+
|
|
10
|
+
var fileDatafeed = new FintaChart.FileDatafeed({
|
|
11
|
+
instruments: {
|
|
12
|
+
|
|
13
|
+
'EUR/GBP': {
|
|
14
|
+
instrument: {
|
|
15
|
+
symbol: 'EUR/GBP',
|
|
16
|
+
exchange: 'FOREX',
|
|
17
|
+
type: "FOREX",
|
|
18
|
+
company: '',
|
|
19
|
+
tickSize: 0.00001,
|
|
20
|
+
},
|
|
21
|
+
info: [
|
|
22
|
+
|
|
23
|
+
{
|
|
24
|
+
interval: 1,
|
|
25
|
+
periodicity: '',
|
|
26
|
+
path: 'data/offline-market-history/EUR_GBP/Minute/1.csv',
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
interval: 1,
|
|
30
|
+
periodicity: 'h',
|
|
31
|
+
path: 'data/offline-market-history/EUR_GBP/Hour/1.csv',
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
interval: 1,
|
|
35
|
+
periodicity: 'd',
|
|
36
|
+
path: 'data/offline-market-history/EUR_GBP/Day/1.csv',
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
interval: 1,
|
|
40
|
+
periodicity: 'w',
|
|
41
|
+
path: 'data/offline-market-history/EUR_GBP/Weekly/1.csv',
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
interval: 1,
|
|
45
|
+
periodicity: 'm',
|
|
46
|
+
path: 'data/offline-market-history/EUR_GBP/Monthly/1.csv',
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
interval: 1,
|
|
50
|
+
periodicity: 'y',
|
|
51
|
+
path: 'data/offline-market-history/EUR_GBP/Yearly/1.csv',
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
interval: 4,
|
|
55
|
+
periodicity: 'h',
|
|
56
|
+
path: 'data/offline-market-history/EUR_GBP/Hour/4.csv',
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
interval: 5,
|
|
60
|
+
periodicity: '',
|
|
61
|
+
path: 'data/offline-market-history/EUR_GBP/Minute/5.csv',
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
interval: 15,
|
|
65
|
+
periodicity: '',
|
|
66
|
+
path: 'data/offline-market-history/EUR_GBP/Minute/15.csv',
|
|
67
|
+
},
|
|
68
|
+
],
|
|
69
|
+
},
|
|
70
|
+
'EUR/CAD': {
|
|
71
|
+
instrument: {
|
|
72
|
+
symbol: 'EUR/CAD',
|
|
73
|
+
exchange: 'FOREX',
|
|
74
|
+
type: "FOREX",
|
|
75
|
+
company: '',
|
|
76
|
+
tickSize: 0.00001,
|
|
77
|
+
},
|
|
78
|
+
info: [
|
|
79
|
+
|
|
80
|
+
{
|
|
81
|
+
interval: 1,
|
|
82
|
+
periodicity: '',
|
|
83
|
+
path: 'data/offline-market-history/EUR_CAD/Minute/1.csv',
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
interval: 1,
|
|
87
|
+
periodicity: 'h',
|
|
88
|
+
path: 'data/offline-market-history/EUR_CAD/Hour/1.csv',
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
interval: 1,
|
|
92
|
+
periodicity: 'd',
|
|
93
|
+
path: 'data/offline-market-history/EUR_CAD/Day/1.csv',
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
interval: 1,
|
|
97
|
+
periodicity: 'w',
|
|
98
|
+
path: 'data/offline-market-history/EUR_CAD/Weekly/1.csv',
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
interval: 1,
|
|
102
|
+
periodicity: 'm',
|
|
103
|
+
path: 'data/offline-market-history/EUR_CAD/Monthly/1.csv',
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
interval: 1,
|
|
107
|
+
periodicity: 'y',
|
|
108
|
+
path: 'data/offline-market-history/EUR_CAD/Yearly/1.csv',
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
interval: 4,
|
|
112
|
+
periodicity: 'h',
|
|
113
|
+
path: 'data/offline-market-history/EUR_CAD/Hour/4.csv',
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
interval: 5,
|
|
117
|
+
periodicity: '',
|
|
118
|
+
path: 'data/offline-market-history/EUR_CAD/Minute/5.csv',
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
interval: 15,
|
|
122
|
+
periodicity: '',
|
|
123
|
+
path: 'data/offline-market-history/EUR_CAD/Minute/15.csv',
|
|
124
|
+
},
|
|
125
|
+
],
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
externalDataFormatter: new FintaChart.Formatters.ExternalDataFormatterCsv(),
|
|
129
|
+
});
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/*
|
|
2
|
+
IMPORTANT NOTICE: This software and source code is owned and licensed by Fintatech B.V., https://fintatech.com
|
|
3
|
+
Downloading, installing or otherwise using this software or source code shall be made only under Fintatech License
|
|
4
|
+
agreement. If you do not granted Fintatech License agreement, you must promptly delete the software,
|
|
5
|
+
source code and all associated downloadable materials and you must not use the software for any purpose whatsoever.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
'use strict';
|
|
9
|
+
|
|
10
|
+
var restDatafeed = new FintaChart.RestDatafeed('http://developerwindows001.fintatech.com:5005/api', 6000);
|
|
11
|
+
|
|
12
|
+
restDatafeed.requestFormatter = {
|
|
13
|
+
formatGetLastTick: (name, exchange) => {
|
|
14
|
+
var customHeaders = new Headers();
|
|
15
|
+
customHeaders.append("Content-Type", "application/json");
|
|
16
|
+
var fetchInit = {
|
|
17
|
+
method: 'POST',
|
|
18
|
+
headers: customHeaders,
|
|
19
|
+
mode: 'cors',
|
|
20
|
+
cache: 'default',
|
|
21
|
+
body: JSON.stringify({
|
|
22
|
+
instrument: {
|
|
23
|
+
name: name,
|
|
24
|
+
exchange: exchange,
|
|
25
|
+
},
|
|
26
|
+
}),
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
return {
|
|
30
|
+
path: `/lasttick`,
|
|
31
|
+
config: fetchInit,
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
formatGetInstruments: () => {
|
|
35
|
+
var customHeaders = new Headers();
|
|
36
|
+
customHeaders.append("Content-Type", "application/json");
|
|
37
|
+
|
|
38
|
+
var fetchInit = {
|
|
39
|
+
method: 'POST',
|
|
40
|
+
headers: customHeaders,
|
|
41
|
+
mode: 'cors',
|
|
42
|
+
cache: 'default',
|
|
43
|
+
body: JSON.stringify({
|
|
44
|
+
maxCount: 0,
|
|
45
|
+
}),
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
return {
|
|
49
|
+
path: `/instruments`,
|
|
50
|
+
config: fetchInit,
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
formatGetHistory: (request) => {
|
|
54
|
+
var customHeaders = new Headers();
|
|
55
|
+
customHeaders.append("Content-Type", "application/json");
|
|
56
|
+
|
|
57
|
+
let requestBody = {
|
|
58
|
+
params: {
|
|
59
|
+
interval: request.chart.timeFrame.interval,
|
|
60
|
+
periodicity: periodicityConvert(request.chart.timeFrame.periodicity),
|
|
61
|
+
direction: 0,
|
|
62
|
+
barsCount: request.count,
|
|
63
|
+
},
|
|
64
|
+
instrument: {
|
|
65
|
+
name: request.instrument.symbol || request.chart.instrument.symbol,
|
|
66
|
+
exchange: request.instrument.exchange || request.chart.instrument.exchange,
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
if (request.endDate) {
|
|
71
|
+
requestBody.params.endDate = request.endDate.getTime()
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
var fetchInit = {
|
|
75
|
+
method: 'POST',
|
|
76
|
+
headers: customHeaders,
|
|
77
|
+
mode: 'cors',
|
|
78
|
+
cache: 'default',
|
|
79
|
+
body: JSON.stringify(requestBody),
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
return {
|
|
83
|
+
path: `/history`,
|
|
84
|
+
config: fetchInit,
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
restDatafeed.responseFormatter = {
|
|
90
|
+
formatInstruments: (response) => {
|
|
91
|
+
if (response.Instruments) {
|
|
92
|
+
return response.Instruments.map(item => {
|
|
93
|
+
let result = {};
|
|
94
|
+
result.symbol = item.Name;
|
|
95
|
+
result.company = '';
|
|
96
|
+
result.exchange = item.Exchange;
|
|
97
|
+
result.tickSize = item.TickSize ? item.TickSize : 0.01;
|
|
98
|
+
return result;
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
formatBars: (response) => {
|
|
103
|
+
if (response.Data) {
|
|
104
|
+
return response.Data.map(item => {
|
|
105
|
+
return {
|
|
106
|
+
date: new Date(item.TimeStamp), //parse from unix time in miliseconds, e.g. 1522403929000
|
|
107
|
+
open: item.Open, //e.g. 1.344636
|
|
108
|
+
high: item.High, //e.g. 1.344636
|
|
109
|
+
low: item.Low, //e.g. 1.344636
|
|
110
|
+
close: item.Close, //e.g. 1.344636
|
|
111
|
+
volume: item.Volume, //e.g. 56754
|
|
112
|
+
};
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
formatRealtime: (response) => {
|
|
117
|
+
if (response.Tick) {
|
|
118
|
+
return {
|
|
119
|
+
symbol: response.Tick.Instrument.Name, //e.g. 'AAPL'
|
|
120
|
+
ask: response.Tick.Ask, //e.g. 2.123125
|
|
121
|
+
bid: response.Tick.Bid, //e.g. 2.123125
|
|
122
|
+
bidSize: response.Tick.BidSize, //e.g. 12
|
|
123
|
+
askSize: response.Tick.AskSize, //e.g. 15
|
|
124
|
+
volume: response.Tick.Volume, //e.g. 10
|
|
125
|
+
price: response.Tick.Price, //e.g. 1.344636
|
|
126
|
+
timeStamp: response.Tick.TimeStamp, //unix time in miliseconds, e.g. 1522403929000
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
function periodicityConvert(input) {
|
|
133
|
+
switch (input) {
|
|
134
|
+
case 't':
|
|
135
|
+
return 0;
|
|
136
|
+
case '':
|
|
137
|
+
return 1;
|
|
138
|
+
case 'h':
|
|
139
|
+
return 2;
|
|
140
|
+
case 'd':
|
|
141
|
+
return 3;
|
|
142
|
+
case 'w':
|
|
143
|
+
return 4;
|
|
144
|
+
case 'm':
|
|
145
|
+
return 5;
|
|
146
|
+
case 'y':
|
|
147
|
+
return 6;
|
|
148
|
+
}
|
|
149
|
+
}
|