コード例 #1
0
        public EntityResponse <List <HistoricalOptionTradeInformation> > GetHistoricalOptionTrades(HistoricalOptionOrdersArguments historicalOrderArguments)
        {
            List <SZKingdomArgument> arguments = new List <SZKingdomArgument>();

            if (historicalOrderArguments.CustomerCode == null && historicalOrderArguments.CustomerAccountCode == null)
            {
                EntityResponse <List <HistoricalOptionTradeInformation> > entityResponse = EntityResponse <List <HistoricalOptionTradeInformation> >
                                                                                           .Error(ErrorCode.SZKingdomLibraryError, SameCodesErrorMessage);

                return(entityResponse);
            }

            arguments.Add(SZKingdomArgument.CustomerCode(historicalOrderArguments.CustomerCode));
            arguments.Add(SZKingdomArgument.CustomerAccountCode(historicalOrderArguments.CustomerAccountCode));
            arguments.Add(SZKingdomArgument.StockBoard(historicalOrderArguments.StockBoard));
            arguments.Add(SZKingdomArgument.TradeAccount(historicalOrderArguments.TradeAccount));
            arguments.Add(SZKingdomArgument.OptionNumber(historicalOrderArguments.OptionNumber));
            arguments.Add(SZKingdomArgument.OptionUnderlyingCode(historicalOrderArguments.OptionUnderlyingCode));
            arguments.Add(SZKingdomArgument.OrderId(historicalOrderArguments.OrderId));
            arguments.Add(SZKingdomArgument.OrderBatchSerialNo(historicalOrderArguments.OrderBatchSerialNo));
            arguments.Add(SZKingdomArgument.BeginDate(historicalOrderArguments.BeginDate.ToString(SZKingdomMappingHelper.SZKingdomDateFormat)));
            arguments.Add(SZKingdomArgument.EndDate(historicalOrderArguments.EndDate.ToString(SZKingdomMappingHelper.SZKingdomDateFormat)));
            arguments.Add(SZKingdomArgument.PageNumber(historicalOrderArguments.PageNumber));
            arguments.Add(SZKingdomArgument.PageRecordCount(historicalOrderArguments.PageRecordCount));

            EntityResponse <List <HistoricalOptionTradeInformation> > result = _marketDataLibrary
                                                                               .ExecuteCommandList <HistoricalOptionTradeInformation>(SZKingdomRequest.HistoricalOptionTrades, arguments);

            return(result);
        }
コード例 #2
0
        public EntityResponse <List <IntradayOptionTradeInformation> > GetIntradayOptionTrades(IntradayOptionOrderArguments intradayOrderArguments)
        {
            List <SZKingdomArgument> arguments = new List <SZKingdomArgument>();

            if (intradayOrderArguments.CustomerCode == null && intradayOrderArguments.CustomerAccountCode == null)
            {
                EntityResponse <List <IntradayOptionTradeInformation> > entityResponse = EntityResponse <List <IntradayOptionTradeInformation> >
                                                                                         .Error(ErrorCode.SZKingdomLibraryError, SameCodesErrorMessage);

                return(entityResponse);
            }

            arguments.Add(SZKingdomArgument.CustomerCode(intradayOrderArguments.CustomerCode));
            arguments.Add(SZKingdomArgument.CustomerAccountCode(intradayOrderArguments.CustomerAccountCode));
            arguments.Add(SZKingdomArgument.StockBoard(intradayOrderArguments.StockBoard));
            arguments.Add(SZKingdomArgument.TradeAccount(intradayOrderArguments.TradeAccount));
            arguments.Add(SZKingdomArgument.OptionNumber(intradayOrderArguments.OptionNumber));
            arguments.Add(SZKingdomArgument.OptionUnderlyingCode(intradayOrderArguments.OptionUnderlyingCode));
            arguments.Add(SZKingdomArgument.OrderId(intradayOrderArguments.OrderId));
            arguments.Add(SZKingdomArgument.OrderBatchSerialNo(intradayOrderArguments.OrderBatchSerialNo));
            arguments.Add(SZKingdomArgument.QueryPosition(intradayOrderArguments.QueryPosition));

            EntityResponse <List <IntradayOptionTradeInformation> > result = _marketDataLibrary
                                                                             .ExecuteCommandList <IntradayOptionTradeInformation>(SZKingdomRequest.IntradayOptionTrades, arguments);

            return(result);
        }
コード例 #3
0
        public EntityResponse <OptionOrderInformation> SubmitOptionOrder(OptionOrderArguments orderArguments)
        {
            List <SZKingdomArgument> arguments = new List <SZKingdomArgument>();

            arguments.Add(SZKingdomArgument.CustomerAccountCode(orderArguments.CustomerAccountCode));
            arguments.Add(SZKingdomArgument.StockBoard(orderArguments.StockBoard));
            arguments.Add(SZKingdomArgument.TradeAccount(orderArguments.TradeAccount));
            arguments.Add(SZKingdomArgument.OptionNumber(orderArguments.OptionNumber));
            arguments.Add(SZKingdomArgument.SecurityCode(orderArguments.SecurityCode));
            arguments.Add(SZKingdomArgument.OrderQuantity(orderArguments.OrderQuantity));
            arguments.Add(SZKingdomArgument.StockBusiness(orderArguments.StockBusiness));
            arguments.Add(SZKingdomArgument.StockBusinessAction(orderArguments.StockBusinessAction));
            arguments.Add(SZKingdomArgument.SecurityLevel(orderArguments.SecurityLevel));
            arguments.Add(SZKingdomArgument.OrderPrice(orderArguments.OrderPrice));
            arguments.Add(SZKingdomArgument.CustomerCode(orderArguments.CustomerCode));
            arguments.Add(SZKingdomArgument.TradeUnit(orderArguments.TradeUnit));
            arguments.Add(SZKingdomArgument.OrderBatchSerialNo(orderArguments.OrderBatchSerialNo));
            arguments.Add(SZKingdomArgument.ClientInfo(orderArguments.ClientInfo));
            arguments.Add(SZKingdomArgument.InternalOrganization(orderArguments.InternalOrganization));

            if (orderArguments.SecurityLevel != SecurityLevel.NoSecurity)
            {
                if (!string.IsNullOrWhiteSpace(orderArguments.SecurityInfo))
                {
                    arguments.Add(SZKingdomArgument.SecurityInfo(orderArguments.SecurityInfo));
                }
                else if (!string.IsNullOrWhiteSpace(orderArguments.Password))
                {
                    orderArguments.SecurityInfo = _marketDataLibrary.EncryptPassword(orderArguments.CustomerAccountCode, orderArguments.Password);
                }
                else
                {
                    EntityResponse <OptionOrderInformation> entityResponse = EntityResponse <OptionOrderInformation>
                                                                             .Error(ErrorCode.SZKingdomLibraryError, "No security info");

                    return(entityResponse);
                }
            }

            EntityResponse <OptionOrderInformation> result =
                _marketDataLibrary.ExecuteCommandSingleEntity <OptionOrderInformation>(SZKingdomRequest.OptionOrder, arguments);

            return(result);
        }
コード例 #4
0
        public EntityResponse <UnderlyingSecurityLockUnlockInformation> LockUnlockUnderlyingSecurity(
            UnderlyingSecurityLockUnlockArguments lockUnlockArguments)
        {
            List <SZKingdomArgument> arguments = new List <SZKingdomArgument>();

            arguments.Add(SZKingdomArgument.CustomerAccountCode(lockUnlockArguments.CustomerAccountCode));
            arguments.Add(SZKingdomArgument.TradeAccount(lockUnlockArguments.TradeAccount));
            arguments.Add(SZKingdomArgument.StockBoard(lockUnlockArguments.StockBoard));
            arguments.Add(SZKingdomArgument.SecurityCode(lockUnlockArguments.SecurityCode));
            arguments.Add(SZKingdomArgument.OrderQuantity(lockUnlockArguments.OrderQuantity));
            arguments.Add(SZKingdomArgument.StockBusiness(lockUnlockArguments.StockBusiness));
            arguments.Add(SZKingdomArgument.StockBusinessAction(StockBusinessAction.OrderDeclaration));
            arguments.Add(SZKingdomArgument.SecurityLevel(lockUnlockArguments.SecurityLevel));
            arguments.Add(SZKingdomArgument.InternalOrganization(lockUnlockArguments.InternalOrganization));

            if (lockUnlockArguments.SecurityLevel != SecurityLevel.NoSecurity)
            {
                lockUnlockArguments.SecurityInfo = _marketDataLibrary.EncryptPassword(lockUnlockArguments.CustomerAccountCode, lockUnlockArguments.Password);

                if (!string.IsNullOrWhiteSpace(lockUnlockArguments.SecurityInfo))
                {
                    arguments.Add(SZKingdomArgument.SecurityInfo(lockUnlockArguments.SecurityInfo));
                }
                else
                {
                    EntityResponse <UnderlyingSecurityLockUnlockInformation> entityResponse = EntityResponse <UnderlyingSecurityLockUnlockInformation>
                                                                                              .Error(ErrorCode.SZKingdomLibraryError, "No security info");

                    return(entityResponse);
                }
            }

            arguments.Add(SZKingdomArgument.CustomerCode(lockUnlockArguments.CustomerCode));
            arguments.Add(SZKingdomArgument.TradeUnit(lockUnlockArguments.TradeUnit));
            arguments.Add(SZKingdomArgument.OrderBatchSerialNo(lockUnlockArguments.OrderBatchSerialNo));
            arguments.Add(SZKingdomArgument.ClientInfo(lockUnlockArguments.ClientInfo));

            EntityResponse <UnderlyingSecurityLockUnlockInformation> result = _marketDataLibrary
                                                                              .ExecuteCommandSingleEntity <UnderlyingSecurityLockUnlockInformation>(SZKingdomRequest.UnderlyingSecurityLockUnlock, arguments);

            return(result);
        }
コード例 #5
0
        public BaseResponse CancelOptionOrder(OptionOrderCancellationArguments cancellationArguments)
        {
            List <SZKingdomArgument> arguments = new List <SZKingdomArgument>();

            arguments.Add(SZKingdomArgument.CustomerAccountCode(cancellationArguments.CustomerAccountCode));
            arguments.Add(SZKingdomArgument.StockBoard(cancellationArguments.StockBoard.ToString()));
            arguments.Add(SZKingdomArgument.InternalOrganization(cancellationArguments.InternalOrganization));
            arguments.Add(SZKingdomArgument.OrderId(cancellationArguments.OrderId));
            arguments.Add(SZKingdomArgument.OrderBatchSerialNo(cancellationArguments.OrderBatchSerialNo));

            if (string.IsNullOrWhiteSpace(cancellationArguments.OrderId) && cancellationArguments.OrderBatchSerialNo == null)
            {
                EntityResponse <OptionOrderCancellationInformation> entityResponse = EntityResponse <OptionOrderCancellationInformation>
                                                                                     .Error(ErrorCode.SZKingdomLibraryError, "Order Id and Order BSN cannot be empty at the same time");

                return(entityResponse);
            }

            BaseResponse result = _marketDataLibrary.ExecuteCommand(SZKingdomRequest.CancelOptionOrder, arguments);

            return(result);
        }