PINE LIBRARY

LibraryCOT

업데이트됨
Library "LibraryCOT"
This library provides tools to help Pine programmers fetch Commitment of Traders (​COT) data for futures.

rootToCFTCCode(root)
  Accepts a futures root and returns the relevant CFTC code.
  Parameters:
    root: Root prefix of the future's symbol, e.g. "ZC" for "ZC1!"" or "ZCU2021".
  Returns: The <CFTCCode> part of a COT ticker corresponding to `root`, or "" if no CFTC code exists for the `root`.

currencyToCFTCCode(curr)
  Converts a currency string to its corresponding CFTC code.
  Parameters:
    curr: Currency code, e.g., "USD" for US Dollar.
  Returns: The <CFTCCode> corresponding to the currency, if one exists.

optionsToTicker(includeOptions)
  Returns the <includeOptions> part of a COT ticker using the `includeOptions` value supplied, which determines whether options data is to be included.
  Parameters:
    includeOptions: A "bool" value: 'true' if the symbol should include options and 'false' otherwise.
  Returns: The <includeOptions> part of a COT ticker: "FO" for data that includes options and "F" for data that doesn't.

metricNameAndDirectionToTicker(metricName, metricDirection)
  Returns a string corresponding to a metric name and direction, which is one component required to build a valid COT ticker ID.
  Parameters:
    metricName: One of the metric names listed in this library's chart. Invalid values will cause a runtime error.
    metricDirection: Metric direction. Possible values are: "Long", "Short", "Spreading", and "No direction". Valid values vary with metrics. Invalid values will cause a runtime error.
  Returns: The <metricCode><metricDirection> part of a COT ticker ID string, e.g., "OI_OLD" for "Open Interest" and "No direction", or "TC_L" for "Traders Commercial" and "Long".

typeToTicker(metricType)
  Converts a metric type into one component required to build a valid COT ticker ID. See the "Old and Other Futures" section of the CFTC's Explanatory Notes for details on types.
  Parameters:
    metricType: Metric type. Accepted values are: "All", "Old", "Other".
  Returns: The <metricType> part of a COT ticker.

convertRootToCOTCode(mode, convertToCOT)
  Depending on the `mode`, returns a CFTC code using the chart's symbol or its currency information when `convertToCOT = true`. Otherwise, returns the symbol's root or currency information. If no COT data exists, a runtime error is generated.
  Parameters:
    mode: A string determining how the function will work. Valid values are:
"Root": the function extracts the futures symbol root (e.g. "ES" in "ESH2020") and looks for its CFTC code.
"Base currency": the function extracts the first currency in a pair (e.g. "EUR" in "EURUSD") and looks for its CFTC code.
"Currency": the function extracts the quote currency ("JPY" for "TSE:9984" or "USDJPY") and looks for its CFTC code.
"Auto": the function tries the first three modes (Root -> Base Currency -> Currency) until a match is found.
    convertToCOT: "bool" value that, when `true`, causes the function to return a CFTC code. Otherwise, the root or currency information is returned. Optional. The default is `true`.
  Returns: If `convertToCOT` is `true`, the <CFTCCode> part of a COT ticker ID string. If `convertToCOT` is `false`, the root or currency extracted from the current symbol.

COTTickerid(COTType, CTFCCode, includeOptions, metricName, metricDirection, metricType)
  Returns a valid TradingView ticker for the COT symbol with specified parameters.
  Parameters:
    COTType: A string with the type of the report requested with the ticker, one of the following: "Legacy", "Disaggregated", "Financial".
    CTFCCode: The <CFTCCode> for the asset, e.g., wheat futures (root "ZW") have the code "001602".
    includeOptions: A boolean value. 'true' if the symbol should include options and 'false' otherwise.
    metricName: One of the metric names listed in this library's chart.
    metricDirection: Direction of the metric, one of the following: "Long", "Short", "Spreading", "No direction".
    metricType: Type of the metric. Possible values: "All", "Old", and "Other".
  Returns: A ticker ID string usable with `request.security()` to fetch the specified Commitment of Traders data.
릴리즈 노트
v2

Update SPX CFTC Code#13874+
릴리즈 노트
Added Copper - HG
COTstatistics

파인 라이브러리

진정한 TradingView 정신에 따라, 저자는 이 파인 코드를 다른 파인 프로그래머들이 재사용할 수 있도록 오픈 소스 라이브러리로 공개했습니다. 저자에게 박수를 보냅니다! 이 라이브러리는 개인적으로 사용하거나 다른 오픈 소스 출판물에서 사용할 수 있지만, 이 코드를 출판물에서 재사용하는 것은 하우스 룰에 의해 관리됩니다.


또한 다음에서도:

면책사항