INNER CODE UNIT · Python
new_bid_price
keanekwa/Optiver-Ready-Trader-Go · ASModel.py:122
new_bid_price = math.ceil((r - delta / 2)) * TICK_SIZE_IN_CENTS
new_ask_price = math.ceil((r + delta / 2)) * TICK_SIZE_IN_CENTS
if self.bid_id != 0 and new_bid_price not in (self.bid_price, 0):
self.send_cancel_order(self.bid_id)
self.bid_id = 0
if self.ask_id != 0 and new_ask_price not in (self.ask_price, 0):
self.send_cancel_order(self.ask_id)
self.ask_id = 0
if self.bid_id == 0 and new_bid_price != 0 and self.position <= POSITION_LIMIT - (LOT_SIZE * len(self.bids) + LOT_SIZE):
self.bid_id = next(self.order_ids)
self.bid_price = new_bid_price
self.send_insert_order(self.bid_id, Side.BUY, new_bid_price, self.BID_LOT_SIZE, Lifespan.GOOD_FOR_DAY)
self.bids.add(self.bid_id)
if self.ask_id == 0 and new_ask_price != 0 and self.position >= -POSITION_LIMIT + (LOT_SIZE * len(self.asks) + LOT_SIZE):
self.ask_id = next(self.order_ids)