Jump to content
McKay Development

opskins (highest price for item)


pekinese

Recommended Posts

I tried to get the highest price of today for an array of items.

My code until now:

      opskins.getPriceList(730, function(err, prices) {
        if (err)
          console.log("error!");
        if(prices){
          highest_price = Infinity;
          for (var item in prices) {
              if(keys.includes(item)){
                //how to continue now?
              }
          }
        }
      });

Any suggestions how to get only the "latest" price for each item, so I can compare and get the highest price of ALL items for only today? In the end I only need to get one value, for example for this JSON object:

 

"item1": {
"2017-07-17": {"price": 800},
"2016-07-16": {"price": 453},
"2016-07-15": {"price": 435}
},
"item2": {
"2017-07-17": {"price": 622},
"2016-07-16": {"price": 643},
"2016-07-15": {"price": 593}

}

 

It would return 800.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...