首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

如何创建资产列表和可选的input.string - Pine

创建资产列表和可选的input.string - Pine是指在Pine脚本语言中如何创建一个资产列表,并为其中的某个资产添加一个可选的输入字符串。

在Pine脚本语言中,可以使用study()函数来创建一个资产列表。该函数接受多个参数,包括资产代码(symbol)、资产名称(title)、资产类型(type)、资产精度(precision)等。以下是一个示例代码:

代码语言:txt
复制
//@version=4
study("Asset List and Optional input.string", overlay=true)

// 创建资产列表
assetList = input("BTC,ETH,LTC", "Asset List", type=input.string)

// 将资产列表分割成数组
assets = str.split(assetList, ",")

// 遍历资产列表
for asset in assets
    // 输出资产名称和代码
    label = asset + " - " + syminfo.tickerid
    plot(asset, title=label)

// 创建可选的输入字符串
optionalInput = input("", "Optional input.string", type=input.string)

// 输出可选的输入字符串
plot(optionalInput, title="Optional Input")

在上述代码中,我们首先使用input()函数创建了一个输入框,用于输入资产列表。默认值为"BTC,ETH,LTC",类型为字符串。然后,我们使用str.split()函数将输入的资产列表分割成一个数组。接下来,我们使用for循环遍历资产列表,并使用plot()函数输出每个资产的名称和代码。

在代码的后半部分,我们使用input()函数再次创建了一个输入框,用于输入可选的字符串。然后,我们使用plot()函数将该可选的输入字符串输出到图表上。

这样,我们就创建了一个资产列表,并为其中的某个资产添加了一个可选的输入字符串。

腾讯云相关产品和产品介绍链接地址:

  • 腾讯云云服务器(CVM):https://cloud.tencent.com/product/cvm
  • 腾讯云云数据库 MySQL 版:https://cloud.tencent.com/product/cdb_mysql
  • 腾讯云云原生容器服务(TKE):https://cloud.tencent.com/product/tke
  • 腾讯云人工智能:https://cloud.tencent.com/product/ai
  • 腾讯云物联网平台:https://cloud.tencent.com/product/iotexplorer
  • 腾讯云移动开发:https://cloud.tencent.com/product/mobdev
  • 腾讯云对象存储(COS):https://cloud.tencent.com/product/cos
  • 腾讯云区块链服务(BCS):https://cloud.tencent.com/product/bcs
  • 腾讯云虚拟专用网络(VPC):https://cloud.tencent.com/product/vpc
  • 腾讯云安全产品:https://cloud.tencent.com/product/safety
页面内容是否对你有帮助?
有帮助
没帮助

相关·内容

WHC RPC业务解析

wormholed-cli getrawtransaction "txid": 获取指定交易哈希的16进制交易数据 wormholed-cli decoderawtransaction "rawtx": 对获取到的16进制数据进行解码 wormholed-cli signrawtransaction "rawtx": 对原始交易进行签名 wormholed-cli sendrawtransaction "rawtx": 发送签名后的交易 wormholed-cli listunspent (成熟度0, 1 ...): 列出当前钱包中可以使用的所有资金 wormholed-cli whc_gettransaction "txid": 获取omni交易的解析 wormholed-cli whc_getbalance "address" propertyID: 获取指定地址指定资产的余额 wormholed-cli getproperty_MP propertyID: 列写omni系统中指定资产的基础信息 wormholed-cli listblocktransactions_MP height: 列出某个块高度含有的所有omni交易 wormholed-cli whc_listpendingtransactions: 列出当前节点的交易池中所有未确认的omni交易 wormholed-cli whc_getpayload "txid": 返回指定omni交易的载荷数据 wormholed-cli getsto_MP "txid" "*": 列出指定空投交易的所有参与者,以及金额信息 wormholed-cli getgrants_MP propertyID: 返回指定的管理资产的增发/销毁信息

01
  • 领券