[SOLVED] Convert price from trades

Hi,

I have response like this from nft/{address}/trades

{
      "transaction_hash": "0x4118da71fc04339bea0cca2852f9e5fe4e14901e78fddbc4d5a59a670c996044",
      "transaction_index": "276",
      "token_ids": [
        "16"
      ],
      "seller_address": "0x73f0462017595e291bebaf258d28e9d6e664c1e1",
      "buyer_address": "0x4b9619f0e0a8ecb2cafb38a4cd70681ba98abbc0",
      "token_address": "0x389d61bd7a0e58fe663f59f03c2eda76ba592d8e",
      "marketplace_address": "0x7be8076f4ea4a4ad08075c2508e481d6c946d12b",
      "price": "200000000000000000",
      "price_token_address": null,
      "block_timestamp": "2022-04-11T14:24:03.000Z",
      "block_number": "14564919",
      "block_hash": "0x0f2b709f8036dd9b023456a77cdde74b519946cb3630e0b9f6314a4c6b5a6749"
    },

As you can see price is β€œ200000000000000000”.
That’s actually 0.2 Ether
How for example in PHP to convert it?

dividing the wei price by 1e18 will get you the price in eth.
image

@johnversus

Thanks :slight_smile: