Skip to content

Latest commit

 

History

History
59 lines (45 loc) · 1.6 KB

README.md

File metadata and controls

59 lines (45 loc) · 1.6 KB

TradingView Charting Library UDF Data Source

Sample implementation of server-side UDF-compatible data source for Peatio exchange for TradingView Charting Library.

First change api on backend peatio

app/api/api_v2/tools.rb

# encoding: UTF-8
# frozen_string_literal: true

module APIv2
  class Tools < Grape::API
    desc 'Get server current time, in seconds since Unix epoch.'
    get "/timestamp" do
      ({"serverTime": (Time.now.to_f * 1000).to_i})
    end
  end
end

app/api/api_v2/entities/market.rb

# encoding: UTF-8
# frozen_string_literal: true

module APIv2
  module Entities
    class Market < Base
      expose :id, documentation: "Unique market id. It's always in the form of xxxyyy, where xxx is the base currency code, yyy is the quote currency code, e.g. 'btcusd'. All available markets can be found at /api/v2/markets."
      expose :name
      expose :ask_precision
      expose :bid_precision
      expose :bid_unit
      expose :ask_unit
    end
  end
end

Run

$ npm install
$ npm start

Image Demo:

alt text

Links