Algorithm to compare two prices

Hi , I am creating algorithm to compare two prices of Future and its options .

For example assume there is two price banknifty index and atm option of 27300 CE …

How do I compare the ratio of two prices

for example at 2pm banknifty price is 27300 and option price is 100 and at 2.05pm again banknifty price is 27300 but option price is 102 , so i assume option price is over brought ?

How can I create this logic in coding ?