Help with solar price template

Hi, I need help with a template that finds the difference between house consumption and production and divides the electricity price according to the set values. My point is that I need to log the electricity consumption for the car including the price, but the standalone device can’t do that and when I add EV charging to the gas it doesn’t follow the sun. So I want to create a new sensor that will adjust the price.
It keeps writing me some errors so I would like to ask for help.

{% set consuption = states('sensor.goodwe_house_consumption') %}
{% set solar = states('sensor.goodwe_ppv') %}
{% set spot_raw = (states('sensor.current_spot_electricity_price') | float(0)) %}
{% set dif = (states.sensor.goodwe_ppv.state | float(0)) - (states.sensor.goodwe_house_consumption | float(0)) | round(0) %}
{{ dif }}
{% if dif <= 0  %}
0
{% elif dif > 0 < 265 %}
  {{ spot_raw * 0.1 }}
{% elif dif > 266 < 530 %}
  {{ spot_raw * 0.2 }}
{% elif dif > 531 < 795 %}
  {{ spot_raw / 0.3 }}
{% elif dif > 796 < 1060 %}
  {{ spot_raw / 0.3 }}
{% elif dif > 1061 < 1325 %}
  {{ spot_raw / 0.5 }}
{% elif dif > 1326 < 1590 %}
  {{ spot_raw / 0.6 }}
{% elif dif > 1591 < 1855 %}
  {{ spot_raw / 0.7 }}
{% elif dif > 1856 < 2120 %}
  {{ spot_raw / 0.8 }}
{% elif dif > 2121 < 2385 %}
  {{ spot_raw / 0.9 }}
{% elif dif > 2386 %}
  {{ spot_raw }}
{% endif %}