瀏覽代碼

fix trades

Eren Yilmaz 6 年之前
父節點
當前提交
269c006844
共有 1 個文件被更改,包括 2 次插入4 次删除
  1. 2 4
      model.py

+ 2 - 4
model.py

@@ -596,15 +596,13 @@ def execute_orders(ownable_id):
         if not matching_orders:
             break
 
-        # TODO continue and delete order if buyer has not enough money
-
         buy_ownership_id, _, buy_limit, _, buy_order_amount, buy_executed_amount, buy_expiry_dt, \
             sell_ownership_id, _, sell_limit, _, sell_order_amount, sell_executed_amount, sell_expiry_dt, \
             buyer_id, seller_id, buy_order_id, sell_order_id \
             = matching_orders
 
         if buy_limit is None and sell_limit is None:
-            raise AssertionError()  # TODO find a solution
+            raise AssertionError()  # TODO use last transaction price
         elif buy_limit is None:
             price = sell_limit
         elif sell_limit is None:
@@ -658,7 +656,7 @@ def execute_orders(ownable_id):
                 SET amount = amount + ?
                 WHERE user_id = ?
                 AND ownable_id = ?
-                ''', (amount, seller_id, currency_id()))
+                ''', (price * amount, seller_id, currency_id()))
 
         # update order execution state
         cursor.execute('''