I am unable to pull JSON file data from the Uniswap_Surface_Rates.json file. enter image description hereIt keeps giving me Reference error : getFile is not defined.
I think I'm not entering the relative path correctly but neither google nor youtube searches have helped.
These are the absolute paths for the files
F:\Downloads\Triangular Arbitrage\RESOURCES\Uniswap2JS\main.js
F:\Downloads\Triangular Arbitrage\RESOURCES\UniSwap2\Uniswap_Surface_Rates.json
// GET DEPTH //////////////////
async function getDepth(amountIn, limit) {
// Get JSON Surface Rates
console.log("Reading Surface Rate Information...")
let fileInfo = getFile("..\UniSwap2\Uniswap_Surface_Rates.json");
fileJsonArray = JSON.parse(fileInfo);
fileJsonArrayLimit = fileJsonArray.slice(0, limit);
console.log(fileJsonArrayLimit);
return
}
getDepth(amountIn=1 , limit=2)
Your error says:
ReferenceError getFile is not Defined
This means the getFile itself is not defined. So the problem is not with the path.
Where is the getFile function declaration? Or where are you importing it from?
Maybe you meant to use fs.readFile? Or fsPromises.readFile?
But if you do have a getFile() declared or imported somewhere, please add it to the question, along with the rest of the code where you import the function into the file you declared getDepth().