Shylock was both the victim and the villain.
he was a victim because he was disgracefully treated by the Christians: they mocked his religion, refused to trade with him, spit on him in the street, and - even in the trial scene - mocked him and taunted him to his face.Moreover,He was devastated when his daughter left him.
He was also a villain. he had a grudge against Antonio, and, when the chance came to get his revenge, he behaved in an extremely undignified and certainly unmerciful way. He gloated in front of Antonio, even attending the gaoler who arrested him, and openly proclaimed his right to the flesh, against any sense of common humanity, in a public court. He also valued his ducats more than his daugther.so,he was undoubtedly a villain.