Approximately a year ago I heard an inverview on the radio about sex determining factors within animals.
Mammals do have a simple systen (males XY, females XX) birds also have quite a understandeble systen (males X_, females XX) however, females can be turned into functioning males (or vice versa)
Within fish, either no sex determining genes excist, or a very complicatess system excists. As Larry explained, within Killies and Apistogramma the situation is well known - some pH and/or temperature effect does play some role. Within lifebearers (closely related to killies) a temperature effect is known in some species.
However, not all fishes depend on pH / temperature. Barlow reported (I borrowed the book

I can't give any reference) about midas ci chlids, where appartently social stress influenced the gender.
Smaller fish developed into females, bigger into males.
So quitre a lot sill remains to be discovered