private void SaveBuyLimitOrderInDb(BitstampOrder order) { try { LastBuyTimestamp = DateTime.Now; var bitstampOrdersDb = new SqlRepository <Order>(new BitstampTraderEntities()); bitstampOrdersDb.Add(new Order { BuyAmount = order.Amount, BuyPrice = order.Price, BuyId = order.Id, Currency = "btc" }); bitstampOrdersDb.Save(); } catch (Exception e) { throw new Exception("BitstampExchange.SaveBuyLimitOrderInDb() : " + e.Message); } }
private void UpdateSellLimitOrderDb(long buyId, BitstampOrder sellOrder, decimal buyPrice) { try { var bitstampOrdersDb = new SqlRepository <Order>(new BitstampTraderEntities()); // take the db order by buyId var orderDb = bitstampOrdersDb.Where(o => o.BuyId == buyId).First(); orderDb.BuyPrice = buyPrice; orderDb.BuyTimestamp = DateTime.Now; orderDb.SellAmount = sellOrder.Amount; orderDb.SellPrice = sellOrder.Price; orderDb.SellId = sellOrder.Id; bitstampOrdersDb.Save(); } catch (Exception e) { throw new Exception("BitstampExchange.UpdateSellLimitOrderDb() : " + e.Message); } }