i was using get_order_book() to get my volume. lets say i had bought a warrant or certificate or stock, and i want to program to sell my specific volume the get_order_book() was what I used, since its stopped I have a workaround.
you need the first if statment since a account with no positions will return an error in .get("instrumentPositions")[0] since there are #no positions to get. so just use the if statment to stop the errors.
i was using get_order_book() to get my volume. lets say i had bought a warrant or certificate or stock, and i want to program to sell my specific volume the get_order_book() was what I used, since its stopped I have a workaround.
if current_positions_value>100:
Position_volume=avanza.get_positions().get("instrumentPositions")[0].get("positions")[0].get("volume")
you need the first if statment since a account with no positions will return an error in .get("instrumentPositions")[0] since there are #no positions to get. so just use the if statment to stop the errors.
hope this is useful some