Electronic structure, chemical bonding and magnetic interactions in high temperature superconducting YBaCuO compounds