Example #1
0
        public EntityResponse <OrderMarginInformation> GetOptionOrderMargin(OrderMarginArguments orderArguments)
        {
            List <SZKingdomArgument> arguments = new List <SZKingdomArgument>();

            arguments.Add(SZKingdomArgument.CustomerAccountCode(orderArguments.CustomerAccountCode));
            arguments.Add(SZKingdomArgument.StockBoard(orderArguments.StockBoard));
            arguments.Add(SZKingdomArgument.Currency(orderArguments.Currency));
            arguments.Add(SZKingdomArgument.TradeAccount(orderArguments.TradeAccount));
            arguments.Add(SZKingdomArgument.OptionNumber(orderArguments.OptionNumber));
            arguments.Add(SZKingdomArgument.OrderQuantity(orderArguments.OrderQuantity));

            EntityResponse <OrderMarginInformation> result =
                _marketDataLibrary.ExecuteCommandSingleEntity <OrderMarginInformation>(SZKingdomRequest.OptionOrderMargin, arguments);

            return(result);
        }
Example #2
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);
        }
Example #3
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);
        }