orderstate fixes
This commit is contained in:
@@ -84,8 +84,9 @@ class Order:
|
||||
if order.is_open:
|
||||
Order.open_orders.add(key)
|
||||
Order.vault_open_orders.listappend(key.vault, key.order_index)
|
||||
tranche_filled = [Filled(*f) for f in zip(status.trancheFilledIn, status.trancheFilledOut)]
|
||||
Order.order_filled[key] = OrderFilled(Filled(status.filledIn, status.filledOut), tranche_filled)
|
||||
# Start with a filled value of 0 even if the chain says otherwise, because we will process the fill events later and add them in
|
||||
tranche_filled = [Filled(0,0) for _ in range(len(status.trancheFilledIn))]
|
||||
Order.order_filled[key] = OrderFilled(Filled(0,0), tranche_filled)
|
||||
return order
|
||||
|
||||
@overload
|
||||
|
||||
@@ -151,15 +151,16 @@ class TrancheTrigger:
|
||||
if self.closed:
|
||||
log.debug(f'price trigger ignored because trigger status is {self.status}')
|
||||
return
|
||||
if self.pool_price_multiplier is None:
|
||||
pool = await Pools.get(pool_address(self.order.order))
|
||||
pool_dec = await pool_decimals(pool)
|
||||
self.pool_price_multiplier = dec(10) ** dec(-pool_dec)
|
||||
cur *= self.pool_price_multiplier
|
||||
if not self.has_line_constraint or all(await asyncio.gather(
|
||||
if cur is not None:
|
||||
if self.pool_price_multiplier is None:
|
||||
pool = await Pools.get(pool_address(self.order.order))
|
||||
pool_dec = await pool_decimals(pool)
|
||||
self.pool_price_multiplier = dec(10) ** dec(-pool_dec)
|
||||
cur *= self.pool_price_multiplier
|
||||
if cur is None or not self.has_line_constraint or all(await asyncio.gather(
|
||||
line_passes(self.min_line_constraint, True, cur),
|
||||
line_passes(self.max_line_constraint, False, cur))):
|
||||
active_tranches[self.tk] = None # or PriceProof(...)
|
||||
active_tranches[self.tk] = PriceProof(0) # todo PriceProof
|
||||
|
||||
def fill(self, _amount_in, _amount_out ):
|
||||
remaining = self.order.tranche_remaining(self.tk.tranche_index)
|
||||
|
||||
Reference in New Issue
Block a user