Giter Club home page Giter Club logo

chartiq_support's People

Watchers

 avatar  avatar

chartiq_support's Issues

qutoeFeed.fetchPaginationData not being called on scroll

Using the advancedsample-template-advanced.html file as a base.

issues that I have:

  • fetchInitialData is being called twice
  • fetchPaginationData is not being called at all :)

code

  • instantiating chart

let awaitLibrariesLoaded = 
    () =>
    { return new Promise
      ( (resolvePromise, rejectPromise) =>
        {
          let librariesCheck = 
              () => 
              { debugger;
              
                try
                {
                  if (CIQ === undefined || chartIQConfig === undefined)
                  {
                    throw "waitMore";
                  }
                  setImmediate(resolvePromise);
                }
                catch (error)
                {
                  setTimeout(librariesCheck, 100);
                }
              }
          librariesCheck();
        } 
      );
    }
    
await awaitLibrariesLoaded();



let quoteFeed = {};
quoteFeed.fetchInitialData = 
    function(symbol, startDate, endDate, params, loadQuotesCallback)
    {
      ls("@: chartContent_chartIQ: quoteFeed.fetchInitialData: ", {symbol, startDate, endDate, params});
      
      let loadChartData = 
          function(chartDataEvent)
          {
            let command = namespace.getMustExist(chartDataEvent, "command");
            if (command === "newData")
            {
              debugger;
              
              // ls("@: chartContent_chartIQ: : ", {chartDataEvent});
              
              // check that this is the data we are looking for, and call the callback
              // if (dataSourceID === symbol+params.interval)
              if (chartDataEvent.studyName === "baseDataSeries")
              { 
                if (Object.keys(chartDataEvent.studyDataByCandleEndTime_dict).length > 0)
                { 
                  // chartDataFromServer_function.eventEmitter.off("chartDataEvent", loadChartData);
                  
                  // for (let dataItem of chartDataEvent.studyDataByCandleEndTime_dict)
                  // {
                  //   dataItem.DT = new Date(dataItem.DT*1000);
                  // }
                  
                  if (loadChartData.initialLoadComplete === false)
                  { loadQuotesCallback
                    ( {
                        "quotes"        : Object.values(chartDataEvent.studyDataByCandleEndTime_dict),
                        "moreAvailable" : false
                      }
                    );
                    loadChartData.initialLoadComplete = true;
                  }
                  else
                  {
                    stxx.updateChartData(Object.values(chartDataEvent.studyDataByCandleEndTime_dict) );
                  }
                }
              }
            }
          };
      loadChartData.initialLoadComplete = false;
      
      
      chartDataFromServer_function.eventEmitter.on("chartDataEvent", loadChartData);
      
      let eventToSend =
      {
        "eventID": "uiMajorStateCollection",
        "uiMajorStateCollectionParameters":
            {
              "command"       : "n/a",
              "targetNodeName": "loadChartData",
              "loadChartData" :
                  {
                    "command" : "changeTradingPair",
                    "tradingPairName": "ETHUSDT",
                    "candleTimeFrame": "1m",
                    "studyName_list" : ["baseDataSeries", "NoBrainer", "NoBrainWaves"],
                  }
            },
      };
  
      nodes.sendEventToServer(eventToSend);
    }
quoteFeed.fetchUpdateData = function(){};
quoteFeed.fetchPaginationData = 
  function (symbol, startDate, endDate, params, cb) 
    { 
      ls("@: chartContent_chartIQ: quoteFeed.fetchPaginationData: ", {symbol, startDate, endDate, params});
    };


let allStudyData = {};
let allStudyData_keyList;
let chartDataFromServer_function = 
    namespace.setValue
    ( atApplication, 
      noBrainer_namespace+".loadChartData.chartDataFromServer",
      (chartDataEvent) =>
      {
        //debugger;
        
        let command = namespace.getMustExist(chartDataEvent, "command");
        
        chartDataFromServer_function.eventEmitter.emit("chartDataEvent", chartDataEvent);
      }
    );
chartDataFromServer_function.eventEmitter = new EventEmitter3();


// let stxx = new CIQ.ChartEngine(
//     {
//       "container": document.querySelector(".chartContainer"),
//       "layout": { crosshair: true, chartType: "candle" }
//     }
// );

delete chartIQConfig.quoteFeed;

let stxx = chartIQConfig.createChart();

stxx.attachQuoteFeed(quoteFeed, {"refreshInterval": 0} ); // Attach your QuoteFeed
stxx.setPeriodicity(1, "minute");
stxx.loadChart
    ( "ETHUSDT", 
      null,
      () =>
      {
        // begin streaming data from the dataSource (register listener on data? probably)
      }
    );



// // stops zooming animation
// stxx.animations.zoom = CIQ.EaseMachine(Math["easeOutCubic"], 1);
// stops scrolling animation
stxx.swipeRelease = function() {};
  • javascript module loading

let chartIQBaseURL = "@@chartIQBaseURL@@";

import "${chartIQBaseURL}/js/advanced.js";
import "${chartIQBaseURL}/js/addOns.js";
import { CIQ } from "${chartIQBaseURL}/js/components.js";

/* Uncomment the following to access deprecated functions and namespaces. */
//import "${chartIQBaseURL}/js/deprecated.js";

/* Uncomment the following lines if you are using these plug-ins. */
import "${chartIQBaseURL}/plugins/activetrader/cryptoiq.js";
// import "${chartIQBaseURL}/plugins/analystviews/components.js";
// import "${chartIQBaseURL}/plugins/scriptiq/scriptiq.js";
import "${chartIQBaseURL}/plugins/signaliq/signaliqDialog.js";
import "${chartIQBaseURL}/plugins/signaliq/signaliq-marker.js";
// import "${chartIQBaseURL}/plugins/technicalinsights/components.js";
//import "${chartIQBaseURL}/plugins/tfc/tfc-loader.js";
//import "${chartIQBaseURL}/plugins/timespanevent/timespanevent.js";
//import "${chartIQBaseURL}/plugins/visualearnings/visualearnings.js";

/* Uncomment the following for the L2 simulator (required for the activetrader sample). */
//import "${chartIQBaseURL}/examples/feeds/L2_simulator.js";

/* Template-specific imports */
import getDefaultConfig from "${chartIQBaseURL}/js/defaultConfiguration.js";

//import "${chartIQBaseURL}/examples/help/helpContent.js";

import PerfectScrollbar from "${chartIQBaseURL}/js/thirdparty/perfect-scrollbar.esm.js";

import quotefeed from "${chartIQBaseURL}/examples/feeds/quoteFeedSimulator.js";
import "${chartIQBaseURL}/examples/feeds/symbolLookupChartIQ.js";

import "${chartIQBaseURL}/examples/markets/marketDefinitionsSample.js";
import "${chartIQBaseURL}/examples/markets/marketSymbologySample.js";

import marker from "${chartIQBaseURL}/examples/markers/markersSample.js";
import "${chartIQBaseURL}/examples/markers/tradeAnalyticsSample.js";
import "${chartIQBaseURL}/examples/markers/videoSample.js";

import "${chartIQBaseURL}/examples/translations/translationSample.js";

/* Remove if not using the forecasting simulator (required for the forecasting sample). */
import forecastfeed from "${chartIQBaseURL}/examples/feeds/quoteFeedForecastSimulator.js";

/* Uncomment the following import statement to enable the Option Sentiment by Strike study. */
//import "${chartIQBaseURL}/js/extras/options/sentimentByStrike.js";

/*
 * Uncomment the following import statement to access the option chain simulator for option-based
 * functionality, such as the Option Sentiment By Strike study.
 *
 * Make the option chain simulator the chart data source by setting the quoteFeed property (in
 * the object parameter of the getDefaultConfig function call below) to the optionfeed variable,
 * for example:
 *
 *     const config = getDefaultConfig({
 *         markerSample: marker.MarkersSample,
 *         scrollStyle: PerfectScrollbar,
 *         quoteFeed: optionfeed,  // Provides simulated quote data and option data.
 *         forecastQuoteFeed: forecastfeed,
 *         nameValueStore: CIQ.NameValueStore
 *     });
 */
//import optionfeed from "${chartIQBaseURL}/examples/feeds/optionChainSimulator.js";

// Create and customize default configuration

const config = getDefaultConfig({
	markerSample: marker.MarkersSample,
	scrollStyle: PerfectScrollbar,
	quoteFeed: quotefeed,
	forecastQuoteFeed: forecastfeed,
	nameValueStore: CIQ.NameValueStore
});

window.chartIQConfig = config;


// import { CIQ } from "@@chartIQBaseURL@@/js/advanced.js";

window.CIQ = CIQ;
// window.sample5min = sample5min;

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.