Heat a pot over medium-high heat and add the cooking oil. Add the onions and saute for around 3 minutes. Add the ginger, garlic, cinnamon, star anise, and dried whole chilies. Cook for another 2 to 3 minutes while stirring often. Pour in the stock (or water), soy sauce, wine, oyster sauce, brown sugar, and annatto if using. Bring to a simmer and cook for 1 minute and turn off the heat.