| 
					
				 | 
			
			
				@@ -21,6 +21,7 @@ func NewOrder( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 ) (opts sentio.OrderCreateOptions, err error) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	var ( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		side sentio.Side 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		base string 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		bid  float64 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		ok   bool 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	) 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -30,8 +31,19 @@ func NewOrder( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	if base, ok = s.PositionSymbols()[sentio.BASE]; !ok { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		err = errors.New("`CreateOrder`: unknown `sentio.BASE`") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	if opts.Symbol, ok = s.PositionSymbols()[side]; !ok { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		err = errors.New("`CreateOrder`: unknown Side for the current strategy") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	canLeverage := (side == sentio.LONG && m.EnableLongLeverage()) || (side == sentio.SHORT && m.EnableShortLeverage()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	if !canLeverage { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		opts.Symbol = base 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	bid = sentio.ToFixed(quotes[opts.Symbol].BidPrice, 2) 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -53,7 +65,7 @@ func NewOrder( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	// Invert OrderOptions if we will do SHORT for BASE symbol 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	if sentio.SHORT == side && s.PositionSymbols()[sentio.BASE] == opts.Symbol { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	if sentio.SHORT == side && !canLeverage { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		tmp := opts.StopLoss 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		opts.StopLoss = opts.TakeProfit 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		opts.TakeProfit = tmp 
			 |