The secondary market isn’t where morally dubious choices get made.
There is a huge difference between funding oil extraction that is happening anyway, and funding a company to start extracting oil.
However, this is the intersection of consequentialism, deontology, and virtue theory.
Both are asking for money to extract oil (and hopefully sell it for more money). I don't see why the oil well being already drilled or not should make a difference if I don't want to invest in CO2-producing endeavours.