Skip to content

Commit

Permalink
Use uuid.uuid4 for VirtualOrder id
Browse files Browse the repository at this point in the history
This is more clean than using a price as id.
  • Loading branch information
bitphage committed Aug 1, 2019
1 parent a94d1b9 commit 4cf38b0
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions dexbot/strategies/staggered_orders.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import time
import math
import uuid
import bitsharesapi.exceptions
from datetime import datetime, timedelta
from functools import reduce
Expand Down Expand Up @@ -1973,8 +1974,7 @@ def place_virtual_buy_order(self, amount, price):

order = VirtualOrder()
order['price'] = price
# Assign price as id because we just need some unique id
order['id'] = order['price']
order['id'] = str(uuid.uuid4())

quote_asset = Amount(amount, self.market['quote']['symbol'], bitshares_instance=self.bitshares)
order['quote'] = quote_asset
Expand Down Expand Up @@ -2005,8 +2005,7 @@ def place_virtual_sell_order(self, amount, price):
precision = self.market['quote']['precision']

order = VirtualOrder()
# Use not inverted price as unique id (inverted will cause intersections with buy orders)
order['id'] = price
order['id'] = str(uuid.uuid4())
order['price'] = price ** -1

quote_asset = Amount(amount * price, self.market['base']['symbol'], bitshares_instance=self.bitshares)
Expand Down

0 comments on commit 4cf38b0

Please sign in to comment.