Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'share_type': order.future.pk}
transaction.buyer = order.creator
transaction.seller = open_order.creator
elif order.order_type == Order.ORDER_TYPE_SELL:
# Transfer points from open_order.creator to order.creator
transfer = {'buyer': open_order.creator.pk,
'buyer_order': open_order.pk,
'seller': order.creator.pk,
'seller_order': order.pk,
'price': open_order.unit_price,
'points': quantity * open_order.unit_price,
'share_quantity': quantity,
'share_type': order.future.pk}
transaction.buyer = open_order.creator
transaction.seller = order.creator
history_entry = FutureHistory(future=order.future,
price=open_order.unit_price)
if filled_q > 0:
# We want to buy or sell more than this open order's quantity.
# The open order should be completely filled and we should continue
# searching for more orders.
open_order.filled = True
open_order.filled_by = order.creator
remaining_items -= quantity
order.quantity = remaining_items
elif filled_q == 0:
# We are buying or selling the exact quantity we need. Yay!
# Close both orders and get out of here.
open_order.filled = True
open_order.filled_by = order.creator
order.filled = True