INNER CODE UNIT · Python
var
keanekwa/Optiver-Ready-Trader-Go · ASModel.py:112
var = np.var(self.mid_prices[-1:-lookback - 1:-1])
q = self.position
# Reservation pricing
r = s - (q * gamma * var * self.T)
# Bid ask spread
delta = (gamma * var * self.T + (2 / gamma * math.log(1 + (gamma / k))))
# Prices to be sent in
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)