Skip to content

Conversation

@abdulrabbani00
Copy link

@abdulrabbani00 abdulrabbani00 commented Jan 30, 2026

Right now if you run a sim you can get the following result:

$ curl https://35.221.121.54.sslip.io/simulate/solana/mainnet-beta/4Hmd6PdjVA9auCoScE12iaBogfwS4ZXQ6VZoBeqanwWW
[{"feed":"4Hmd6PdjVA9auCoScE12iaBogfwS4ZXQ6VZoBeqanwWW","feedHash":"1f42dfb21efb24828b99fbe70e6d139cd665aafcbb1706bccd8f2a9b12562db6","results":[],"result":"118.22250000","stdev":"0","variance":"0"}]   

With the current implementation, this entire result is thrown away because the library does not parse the decimal in result and because results is empty.

This is an opinionated approach:

  1. If result exists, use that.
  2. If result does not exist, get the median from results.

You could also do the inverse:

  1. If results exist, get the median and overwrite result.
  2. If results does not exist, use the existing result.

There is also a third option which is to do nothing when result is none and let the downstream user handle it all.

I prefer the proposed approach as it allows the caller to get both raw values and decide what they want to do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants