internal Order CreateCancelDeliveryWithShortSellOrder(Transaction tran, CancelDeliveryWithShortSellOrderParam param) { var addCommand = AddPhysicalOrderCommandFactory.Default.CreateCancelDeliveryWithShortSellOrder(tran, param); addCommand.Execute(); return(addCommand.Result); }
internal AddCancelDeliveryWithShortSellOrderCommand(Transaction tran, CancelDeliveryWithShortSellOrderParam param) : base(tran, Visitors.AddCancelDeliveryWithShortSellOrderCommandVisitor.Default, AddPhysicalOrderCommandService.Default) { this.IsOpen = param.IsOpen; this.IsBuy = param.IsBuy; this.SetPrice = param.SetPrice; this.ExecutePrice = param.ExecutePrice; this.Lot = param.Lot; this.LotBalance = param.LotBalance; this.PhysicalRequestId = param.PhysicalRequestId; this.OrderRelations = param.OrderRelations; this.TradeOption = param.TradeOption; }
private static Transaction CreateOpenTranAndOrder(this Account account, Order openOrder, DeliveryRequestOrderRelation relation, DeliveryRequest deliveryRequest) { Transaction transaction = TransactionFacade.CreateCancelDeliveryWithShortSellTran(account, deliveryRequest.InstrumentId, openOrder.Owner.ContractSize(null)); CancelDeliveryWithShortSellOrderParam param = new CancelDeliveryWithShortSellOrderParam { IsBuy = true, IsOpen = true, SetPrice = openOrder.SetPrice, ExecutePrice = openOrder.ExecutePrice, Lot = relation.DeliveryLot, LotBalance = relation.DeliveryLot, PhysicalRequestId = deliveryRequest.Id, TradeOption = openOrder.TradeOption }; Order order = OrderFacade.Default.CreateCancelDeliveryWithShortSellOrder(transaction, param); return(transaction); }
private static Transaction CreateCloseTranAndOrder(this Account account, Order openOrder, DeliveryRequestOrderRelation relation, DeliveryRequest deliveryRequest) { Transaction transaction = TransactionFacade.CreateCancelDeliveryWithShortSellTran(account, deliveryRequest.InstrumentId, openOrder.Owner.ContractSize(null)); var orderRelationRecord = new OrderRelationRecord(account.GetOrder(relation.OpenOrderId), relation.DeliveryLot); CancelDeliveryWithShortSellOrderParam param = new CancelDeliveryWithShortSellOrderParam { IsBuy = false, IsOpen = false, SetPrice = openOrder.SetPrice, ExecutePrice = openOrder.ExecutePrice, Lot = relation.DeliveryLot, LotBalance = 0m, PhysicalRequestId = deliveryRequest.Id, TradeOption = iExchange.Common.TradeOption.Invalid, OrderRelations = new List <OrderRelationRecord>() { orderRelationRecord } }; Order order = OrderFacade.Default.CreateCancelDeliveryWithShortSellOrder(transaction, param); return(transaction); }