Yes, the price is also set up at a wrong place - you must first call asset before you can get its price. Anything asset-dependent must be inside the loop and not outside.