public void CreateMarketOrder_SendCreateOrderCommand_ReturnNewOrderRepresentationAndPublishOrderToDisruptor() { NewOrderRepresentation representation = _orderseService.CreateOrder(new CreateOrderCommand(0, "market", "buy", "XBTUSD", 10, "1234")); _manualResetEvent.WaitOne(3000); Assert.AreEqual(representation.OrderId, _receivedOrder.OrderId.Id.ToString()); }
public ActionResult <string> Post(List <OrderDto> orders) { _applicationService.CreateOrder(orders); return(""); }
public IHttpActionResult CreateOrder([FromBody] CreateOrderParam order) { if (log.IsDebugEnabled) { log.Debug("Create Order Call: " + order); } try { if (order != null) { //get api key from header var headers = Request.Headers; string apikey = ""; IEnumerable <string> headerParams; if (headers.TryGetValues("Auth", out headerParams)) { string[] auth = headerParams.ToList()[0].Split(','); apikey = auth[0]; } if (log.IsDebugEnabled) { log.Debug("Createl Order Call: ApiKey=" + apikey); } TraderId traderId = new TraderId(_apiKeyInfoAccess.GetUserIdFromApiKey(apikey).ToString()); return (Ok( _orderApplicationService.CreateOrder(new CreateOrderCommand(order.Price, order.Type, // ToDo: Need to perform check on the API key and then provide the corresponding TraderId order.Side, order.Pair, order.Volume, traderId.Id)))); } return(BadRequest()); } catch (InvalidOperationException exception) { if (log.IsErrorEnabled) { log.Error("Create Order Call Error", exception); } return(BadRequest(exception.Message)); } catch (NullReferenceException exception) { if (log.IsErrorEnabled) { log.Error("Create Order Call Exception ", exception); } return(BadRequest(exception.Message)); } catch (InstanceNotFoundException exception) { if (log.IsErrorEnabled) { log.Error("Create Order Call Exception ", exception); } return(BadRequest(exception.Message)); } catch (Exception exception) { if (log.IsErrorEnabled) { log.Error("Create Order Call Error", exception); } return(InternalServerError(exception)); } }