Prasanth Venugopalan
Prasanth Venugopalan

Reputation: 11

How to calculate inverse in chainlink tasks?

Hey I am trying to calculate inverse of a value that I got from an API call. I have my tasks like these. Tasks

parse        [type="jsonparse" path="quotes,USDEUR" data="$(fetch)"]
inverse      [type="divide" input="1" divisor="$(parse)" precision="5"]
multiply     [type="multiply" input="$(inverse)" times=1000000000000000000]

But I am getting the response like this.

Response

parse jsonparse 1.022015

path: quotes,USDEUR

data: $(fetch)

inverse divide "1"

input: 1

divisor: $(parse)

precision: 5

multiply multiply "1000000000000000000"

input: $(inverse)

times: 1000000000000000000

What I need it to get inverse of the value getting from parse task. But when I do this I am just getting it as 1.

Upvotes: 1

Views: 27

Answers (0)

Related Questions