Jump to content
UBot Underground

Recommended Posts

Lets say I have those price values

  • 0.38
  • 0.33
  • 0.30
  • 0.25
  • 0.20
  • 0.17
  • 0.12


I scrape my crypto price that gives me a value of 0.22


Now what I want is to find the closest value under and over this price of 0.22, In this case it will be 

0.25 and 0.20 


How can I do that with ubot after adding all values to a list.

Any other suggestion will be appreciated 


thank you 

Link to post
Share on other sites

add your value (0.22) to the list, sort the list, find index position value from list.

clear list(%source)
add list to list(%source,$list from text("0.38
add item to list(%source,#target,"Delete","Global")
clear list(%sorted)
add list to list(%sorted,$list from text($sort list(%source,"Ascending"),"
loop while($comparison(#target,"!= Does not equal",$list item(%sorted,#position))) {
alert("value under target price : {$list item(%sorted,$subtract(#position,1))} 
value over target price: {$list item(%sorted,$add(#position,1))}")


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...