コード例 #1
0
ファイル: OrderFacade.cs プロジェクト: dreamsql/Outter
        internal Order CreateCancelDeliveryWithShortSellOrder(Transaction tran, CancelDeliveryWithShortSellOrderParam param)
        {
            var addCommand = AddPhysicalOrderCommandFactory.Default.CreateCancelDeliveryWithShortSellOrder(tran, param);

            addCommand.Execute();
            return(addCommand.Result);
        }
コード例 #2
0
 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;
 }
コード例 #3
0
        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);
        }
コード例 #4
0
        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);
        }