Cost calculation

Hello,
I am pretty new to moralis and how to find the names of some of the Api on here. I need some help with finding an API to get “purchase cost” for wallets I am tracking with Jsnode for just the purchase cost of closed transactions on ethereum. Anyone have a good link to this API to implement?

Chat gpt request for this action" To proceed with the code modification, you would need to incorporate a method or API call that retrieves the historical transaction data for each wallet. Once you have access to the transaction data, you can calculate the purchase cost by summing up the cost of each individual trade for each asset in the wallet.

Here’s a modified version of your code that includes a placeholder method getPurchaseCost to retrieve the purchase cost for each wallet. Please replace the getPurchaseCost method with the appropriate implementation or API call that retrieves the historical transaction data and calculates the purchase cost accurately."

what do you mean by purchase cost?

Hello,
purchase cost being the cost to attain the asset itself (cost to buy each asset) which would be summed up.

Hi, it depends what assets are you trying to search for
For native transactions you can use
https://docs.moralis.io/web3-data-api/evm/reference/get-transactions-by-wallet
and read the value from each transaction

For tokens, you can use
https://docs.moralis.io/web3-data-api/evm/reference/get-token-transfers-by-wallet

1 Like

Hello Lulian, thanks that solves my question. Cheers!