소스 검색

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('''