我正在尝试使用 jq 从该端点获取某些信息
curl -s https://bittrex.com/api/v1.1/public/getmarketsummaries/ | jq '[.]'
和下面的输出
[
{
"success": true,
"message": "",
"result": [
{
"MarketName": "BTC-1ST",
"High": 0.00010322,
"Low": 9.32e-05,
"Volume": 1475820.53114847,
"Last": 9.414e-05,
"BaseVolume": 145.89904728,
"TimeStamp": "2017-10-05T00:32:45.283",
"Bid": 9.415e-05,
"Ask": 9.521e-05,
"OpenBuyOrders": 614,
"OpenSellOrders": 5887,
"PrevDay": 0.00010169,
"Created": "2017-06-06T01:22:35.727"
},
{
"MarketName": "BTC-2GIVE",
"High": 1.31e-06,
"Low": 1.24e-06,
"Volume": 4356547.69360079,
"Last": 1.29e-06,
"BaseVolume": 5.59000303,
"TimeStamp": "2017-10-05T00:21:46.333",
"Bid": 1.29e-06,
"Ask": 1.31e-06,
"OpenBuyOrders": 298,
"OpenSellOrders": 2290,
"PrevDay": 1.29e-06,
"Created": "2016-05-16T06:44:15.287"
},
{
"MarketName": "BTC-ABY",
"High": 1.89e-06,
"Low": 1.62e-06,
"Volume": 31422008.3611497,
"Last": 1.68e-06,
"BaseVolume": 53.99330434,
"TimeStamp": "2017-10-05T00:25:21.307",
"Bid": 1.68e-06,
"Ask": 1.7e-06,
"OpenBuyOrders": 437,
"OpenSellOrders": 4761,
"PrevDay": 1.63e-06,
"Created": "2014-10-31T01:43:25.743"
}
当我试图只得到MarketName
curl -s https://bittrex.com/api/v1.1/public/getmarketsummaries/ | jq '.[] | select(.MarketName=="BTC-1ST")'
我收到以下错误
jq: error (at <stdin>:0): Cannot index boolean with string "MarketName"
其他错误
curl -s https://bittrex.com/api/v1.1/public/getmarketsummaries/ | jq '.[1]'
我明白了
jq: error (at <stdin>:0): Cannot index object with number
任何人都知道获得这些的正确命令吗?
如果您想要
{}
与该市场名称匹配的所有内容,您可以执行如果你想列出你可以做的所有 MarketNames
还必须编程语言列表从 0 开始。所以如果我想在 jq 中获取列表中的第一项,我可以这样做
只有 1 个列表项,这就是为什么如果您使用会出现错误的原因
[1]
知道这是不久前的事了,但我能够做到