private void Sell(String id) { decimal price = this.trade.TradeStatus.Price; FillResponse fillOrder = client.GetFillsByOrderIdSync(id); SellCoinOrder sellOrder = PrepareSellOrder(fillOrder, price); OrderResponse orderResponse = MakeOrder(sellOrder); if (orderResponse != null) { actualListBuyOrder.Remove(id); String sellId = orderResponse.Id.ToString(); actualListSellOrder.Add(sellId); history.AddBuy(sellId, fillOrder); } }
private SellCoinOrder PrepareSellOrder(FillResponse buyOrder, decimal tradePrice) { decimal add = ImportantValues.sellProfitPercentageFromBuyPrice / (decimal)100; decimal calcPrice = buyOrder.Price + (add * buyOrder.Price); //TODO: this line is possible to use only in case that we want get EURO #region rounding up on 2 digits decimal tmp = calcPrice * 100; tmp = Math.Floor(tmp); if (tmp % 10 != 0) { tmp += 1; } calcPrice = tmp / 100; #endregion decimal price = (calcPrice > tradePrice) ? calcPrice : tradePrice + ImportantValues.minPriceInEur; SellCoinOrder order = new SellCoinOrder(); order.BuyPrice = price; order.Price = price; order.Size = buyOrder.Size; return(order); }