Ver Fonte

util.CreateOrder

- refactoring order size
Alexey Kim há 3 meses atrás
pai
commit
e56a5815d1
1 ficheiros alterados com 6 adições e 1 exclusões
  1. 6 1
      util/order.go

+ 6 - 1
util/order.go

@@ -60,8 +60,13 @@ func CreateOrder(
 		return sentio.ErrTooSmallOrder
 	}
 
+	ratio := .9
+	if action == sentio.Action_BUY || action == sentio.Action_SELL {
+		ratio = .4
+	}
+
 	// create a new order
-	if size = uint(math.Floor(account.GetCash() * .9 / bid)); size < 1 {
+	if size = uint(math.Floor(account.GetCash() * ratio / bid)); size < 1 {
 		return sentio.ErrTooSmallOrder
 	}