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); }
internal void AddDeliveryRequestOrderRelation(DeliveryRequestOrderRelation item, OperationType operationType) { _deliveryRequestOrderRelations.AddItem(item, operationType); }
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); }
internal bool TryGet(Guid openOrderId, out DeliveryRequestOrderRelation relation) { return(this._deliveryRequestOrderRelations.TryGetValue(openOrderId, out relation)); }