0

我正在尝试克隆交易视图图表 api。我检查了他们提供的 github 示例,发现以下代码:

  var _datafeed = new Datafeeds.UDFCompatibleDatafeed("http://yourhost/tradingview", 10000);
        var _widget = window.tvWidget = new TradingView.widget({
          symbol: 'AAPL',
          fullscreen:true,
          interval: '15',
          container_id: "tv_chart_container",
          datafeed: _datafeed,
          library_path: "/charting_library/",
          locale: getParameterByName('lang') || "en",
          disabled_features: ["use_localstorage_for_settings", "header_symbol_search", "symbol_search_hot_key"],
          debug: false,
          overrides: {
            "paneProperties.background": "#222222",
            "paneProperties.vertGridProperties.color": "#454545",
            "paneProperties.horzGridProperties.color": "#454545",
            "symbolWatermarkProperties.transparency": 90,
            "scalesProperties.textColor": "#AAA"
          }
        });

我知道提供的数据是从 url “ http://yourhost/tradingview ”给出的。谁能帮我找到从该 url 提供的数据格式。提前致谢

4

2 回答 2

2

尝试使用 get 方法通过邮递员访问所有这些 url。它会给你正确的数据格式的响应。1. http://yourhost/config;2. http://yourhost/时间;3. http://yourhost/symbols?symbol=AAPL;4. http://yourhost/history?symbol=AAPL&resolution=D&from=1505817294&to=1536921354;5. http://yourhost/timescale_marks?timescale_marks?symbol=AAPL&from=1505741400&to=2114361000&resolution=D ; 6. http://yourhost/marks

http://yourhost/替换为:https ://demo_feed.tradingview.com/

于 2018-09-14T10:38:11.787 回答
0

在 component.ts 中使用此代码

customFormatters: {
    dateFormatter: {
      format: function (date) {
        var days = ["شنبه", "یکشنبه", "دوشنبه", "سه شنبه", "چهارشنبه", "پنجشنبه", "جمعه"],
          year = date.getUTCFullYear(),
          month = date.getUTCMonth() + 1,
          day = date.getUTCDate(),
          result = day + "-" + month + "-" + year;
        return days[date.getUTCDay() - 1] + " " + result;
      }
    }
  }

并且还使用 plugin.js for persiandate

于 2018-06-09T09:16:47.420 回答