kq_symbol = ‘KQ.m@SHFE.rb’
underlying_symbol = api.get_quote(kq_symbol).underlying_symbol
symbol = ”
positions = api.get_position()
for position in positions:
if positions[position].pos_long > 0 or positions[position].pos_short > 0:
symbol = position
break
if symbol == ”:
symbol = underlying_symbol
kq_symbol = ‘KQ.m@SHFE.rb’
underlying_symbol = api.get_quote(kq_symbol).underlying_symbol
symbol = ”
positions = api.get_position()
for position in positions:
if positions[position].pos_long > 0 or positions[position].pos_short > 0:
symbol = position
break
if symbol == ”:
symbol = underlying_symbol