• Resolved plku631

    (@plku631)


    i get the api json like this:

    {"bids":[{"price":"31.689","amount":"12703.08175978","count":4,"total":"12703.08175978"},{"price":"31.688","amount":"1934.84089941","count":2,"total":"14637.92265919"},{"price":"31.668","amount":"3858.38887","count":1,"total":"18496.31152919"},{"price":"31.667","amount":"2.09589978","count":1,"total":"18498.40742897"},{"price":"31.663","amount":"2001.10539115","count":1,"total":"20499.51282012"}],"asks":[{"price":"31.716","amount":"20466.09294371","count":2,"total":"20466.09294371"},{"price":"31.718","amount":"25890.2377","count":1,"total":"46356.33064371"},{"price":"31.72","amount":"6.31809486","count":1,"total":"46362.64873857"},{"price":"31.725","amount":"510","count":2,"total":"46872.64873857"},{"price":"31.726","amount":"876.7104","count":1,"total":"47749.35913857"}]}

    how can i get only the first asks price “31.716”?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author berkux

    (@berkux)

    Hi,
    you can do this:

    [jsoncontentimporter url=”https://test.json-content-importer.com/extra/json/bids.json”%5D{subloop-array:asks:1}price = {asks.price}{/subloop-array:asks}[/jsoncontentimporter]

    This gives you the first price.
    Bernhard

    Thread Starter plku631

    (@plku631)

    Thanks for the reply, I ask this problum because after updated the plugin i get the errors:

    “We have a Problem with JSON here:
    Either we got no JSON from the API. Or the basenode-parameter is not ok.
    Switch on the Debugmode of the Plugin!”

    i find that in Version 1.4.1 need to add basenode=””will not get errors。

    i have another question,
    How can i get only the “USDT”(“symbol_id”:4) price “31.666””?
    if i buy Pro version can do that?

    {"data":[
    {"trade_type":1,"symbol_id":2,"symbol":"BTC","symbol_url":"https://json-content-importer.com//images/BTC.png","symbol_full_name":"Bitcoin","price":"540.5","24hr_change_percentage":-1.55,"7day_trend":[{"interval":5,"timestamp":xxx,"price":"461.7"},
    {"interval":5,"timestamp":xxx,"price":"628.9"},
    {"interval":5,"timestamp":xxx,"price":"493.8"}]},
    
    {"trade_type":1,"symbol_id":3,"symbol":"ETH","symbol_url":"https://json-content-importer.com/images/ETH.png","symbol_full_name":"Ethereum","price":"58.3","24hr_change_percentage":-1.41,"7day_trend":[
    {"interval":5,"timestamp":xxx,"price":"58.9"},
    {"interval":5,"timestamp":xxx,"price":"58.4"},
    {"interval":5,"timestamp":xxx,"price":"58.6"}]},
    
    {"trade_type":1,"symbol_id":4,"symbol":"USDT","symbol_url":"https://json-content-importer.com/images/USDT.png","symbol_full_name":"Tether","price":"31.666","24hr_change_percentage":0.36,"7day_trend":[
    {"interval":5,"timestamp":xxx,"price":"30.781"},
    {"interval":5,"timestamp":xxx,"price":"30.779"},
    {"interval":5,"timestamp":xxx,"price":"30.779"}]},
    
    {"trade_type":1,"symbol_id":6,"symbol":"DOGE","symbol_url":"https://json-content-importer.com/images/DOGE.png","symbol_full_name":"Dogecoin","price":"2.35","24hr_change_percentage":-4.73,"7day_trend":[
    {"interval":5,"timestamp":xxx,"price":"2.37"},
    {"interval":5,"timestamp":xxx,"price":"2.37"},
    {"interval":5,"timestamp":xxx,"price":"2.36"}]},
    
    {"trade_type":1,"symbol_id":7,"symbol":"MATIC","symbol_url":"https://json-content-importer.com/images/MATIC.png","symbol_full_name":"Polygon","price":"21.59","24hr_change_percentage":-2.77,"7day_trend":[
    {"interval":5,"timestamp":xxx,"price":"21.73"},
    {"interval":5,"timestamp":xxx,"price":"21.76"},
    {"interval":5,"timestamp":xxx,"price":"21.65"}]}
    ]}
    
    Plugin Author berkux

    (@berkux)

    Hi,
    Verson 1.5.0 fixed the basenode-Error.
    Try this:

    [jsoncontentimporter url="https://test.json-content-importer.com/extra/json/plku631.json" debugmode="10" oneofthesewordsmustbein="USDT" oneofthesewordsmustbeindepth="3"]data:

    {subloop-array:data:-1}

    trade_type = {data.trade_type}

    symbol_id = {data.symbol_id}

    symbol = {data.symbol}

    symbol_url = {data.symbol_url}

    symbol_full_name = {data.symbol_full_name}

    price = {data.price}

    24hr_change_percentage = {data.24hr_change_percentage}

    7day_trend:

    {subloop-array:data.7day_trend:-1}

    interval = {data.7day_trend.interval}

    timestamp = {data.7day_trend.timestamp}

    price = {data.7day_trend.price}

    {/subloop-array:data.7day_trend}

    {/subloop-array:data}
    [/jsoncontentimporter]
    Thread Starter plku631

    (@plku631)

    Thank you very much!
    Sorry about my english is not good.
    Although can do thik this but i still want the result only print “31.666”.

    [jsoncontentimporter url="https://test.json-content-importer.com/" oneofthesewordsmustbein="USDT" oneofthesewordsmustbeindepth="3"]
    
    {subloop-array:data:-1}
    	<div style="display:none">{data.symbol} </div>
    	{data.price}
    {/subloop-array:data}
    
    [/jsoncontentimporter]
    

    I want to see result “only” print “31.666”.
    And i can use this number in javascript to compare with other numbers.

    if i get the resul of :
    "<div style="display:none">USDT </div>   31.83949836" 
    I can't do compare number with javascript.

    Still very thanks of your help!
    This plugin still very nice and super amazing!

    Plugin Author berkux

    (@berkux)

    Hi,
    the plugin checks with oneofthesewordsmustbein=”USDT” if USDT is in the outputted data. By

    style="display:none"

    you can hide this.
    You can add js-code like this:

    {subloop-array:data:-1}
    <div style="display:none">{data.symbol} </div>
    <script>
    let price = {data.price};
    alert('price :' + price);
    </script>
    {/subloop-array:data} 

    Bernhard

    Thread Starter plku631

    (@plku631)

    I truly appreciate your?help

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘problem with list’ is closed to new replies.