Example #1
0
        public EntityResponse <List <IntradayOptionOrderBasicInformation> > GetCancellableOrders(IntradayOptionOrderArguments intradayOrderArguments)
        {
            List <SZKingdomArgument> arguments = new List <SZKingdomArgument>();

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

                return(entityRespose);
            }

            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.QueryPosition(intradayOrderArguments.QueryPosition));

            EntityResponse <List <IntradayOptionOrderBasicInformation> > result = _marketDataLibrary
                                                                                  .ExecuteCommandList <IntradayOptionOrderBasicInformation>(SZKingdomRequest.CancelableOptionOrders, arguments);

            return(result);
        }
Example #2
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);
        }
        public EntityResponse <List <OptionPositionInformation> > GetOptionPositions(OptionPositionsArguments optionPositionsArguments)
        {
            List <SZKingdomArgument> arguments = new List <SZKingdomArgument>();

            if (optionPositionsArguments.CustomerCode == null && optionPositionsArguments.CustomerAccountCode == null)
            {
                return(EntityResponse <List <OptionPositionInformation> > .Error(
                           ErrorCode.SZKingdomLibraryError,
                           ErrorMessages.SZKingdom_CustAndAccCodeNull));
            }

            arguments.Add(SZKingdomArgument.CustomerCode(optionPositionsArguments.CustomerCode));
            arguments.Add(SZKingdomArgument.CustomerAccountCode(optionPositionsArguments.CustomerAccountCode));
            arguments.Add(SZKingdomArgument.TradeAccount(optionPositionsArguments.TradeAccount));
            arguments.Add(SZKingdomArgument.OptionNumber(optionPositionsArguments.OptionNumber));
            arguments.Add(SZKingdomArgument.TradeUnit(optionPositionsArguments.TradeUnit));
            arguments.Add(SZKingdomArgument.OptionSide(optionPositionsArguments.OptionSide));
            arguments.Add(SZKingdomArgument.OptionCoveredFlag(optionPositionsArguments.OptionCoveredFlag));
            arguments.Add(SZKingdomArgument.QueryPosition(optionPositionsArguments.QueryPosition));

            EntityResponse <List <OptionPositionInformation> > result =
                _marketDataLibrary.ExecuteCommandList <OptionPositionInformation>(SZKingdomRequest.OptionPositions, arguments);

            return(result);
        }
        public EntityResponse SetAutomaticOptionExercisingParameters(CustomerAutomaticOptionExercisingInformation information)
        {
            if (string.IsNullOrWhiteSpace(information.CustomerAccountCode))
            {
                return(EntityResponse <List <CustomerAutomaticOptionExercisingInformation> > .Error(
                           ErrorCode.SZKingdomLibraryError,
                           ErrorMessages.SZKingdom_CustomerCodeEmpty));
            }

            List <SZKingdomArgument> arguments = new List <SZKingdomArgument>();

            arguments.Add(SZKingdomArgument.CustomerCode(information.CustomerCode));
            arguments.Add(SZKingdomArgument.CustomerAccountCode(information.CustomerAccountCode));
            arguments.Add(SZKingdomArgument.StockBoard(information.TradeSector));
            arguments.Add(SZKingdomArgument.TradeAccount(information.TradingAccount));

            arguments.Add(SZKingdomArgument.ExercisingQuantity(information.ExercisingQuantity));
            arguments.Add(SZKingdomArgument.AutomaticExerciseControl(information.AutomaticExcerciseControl));
            arguments.Add(SZKingdomArgument.ExercisingStrategyType(information.ExercisingStrategyType));
            arguments.Add(SZKingdomArgument.ExercisingStrategyValue(information.ExercisingStrategyValue));
            arguments.Add(SZKingdomArgument.OptionNumber(information.ContractNumber));
            arguments.Add(SZKingdomArgument.Remark(information.Remark));

            EntityResponse result =
                _marketDataLibrary.ExecuteCommand(SZKingdomRequest.SetAutomaticOptionExercisingParameters, arguments);

            return(result);
        }
        public EntityResponse <AccountInformation> GetAccountInformation(string customerCode, string customerAccountCode)
        {
            if (string.IsNullOrWhiteSpace(customerCode) && string.IsNullOrWhiteSpace(customerAccountCode))
            {
                return(EntityResponse <AccountInformation> .Error(
                           ErrorCode.SZKingdomLibraryError,
                           "Customer code and account code cannot be empty at the same time."));
            }

            List <SZKingdomArgument> arguments = new List <SZKingdomArgument>();

            arguments.Add(SZKingdomArgument.CustomerCode(customerCode));
            arguments.Add(SZKingdomArgument.CustomerAccountCode(customerAccountCode));

            return(_marketDataLibrary.ExecuteCommandSingleEntity <AccountInformation>(SZKingdomRequest.GetAccountInformation, arguments));
        }
Example #6
0
        public EntityResponse <OptionOrderMaxQuantityInformation> GetOptionOrderMaxQuantity(OptionOrderMaxQuantityArguments maxQuantityArguments)
        {
            List <SZKingdomArgument> arguments = new List <SZKingdomArgument>();

            arguments.Add(SZKingdomArgument.CustomerCode(maxQuantityArguments.CustomerCode));
            arguments.Add(SZKingdomArgument.CustomerAccountCode(maxQuantityArguments.CustomerAccountCode));
            arguments.Add(SZKingdomArgument.TradeAccount(maxQuantityArguments.TradeAccount));
            arguments.Add(SZKingdomArgument.StockBoard(maxQuantityArguments.StockBoard));
            arguments.Add(SZKingdomArgument.StockBusiness(maxQuantityArguments.StockBusiness));
            arguments.Add(SZKingdomArgument.StockBusinessAction(maxQuantityArguments.StockBusinessAction));

            if (maxQuantityArguments.StockBusiness.In(OptionOrderBusinesses) && string.IsNullOrWhiteSpace(maxQuantityArguments.OptionNumber))
            {
                EntityResponse <OptionOrderMaxQuantityInformation> entityResponse = EntityResponse <OptionOrderMaxQuantityInformation> .Error(
                    ErrorCode.SZKingdomLibraryError,
                    ErrorMessages.SZKingdom_OptionNumberCanNotBeEmpty);

                return(entityResponse);
            }
            if (maxQuantityArguments.StockBusiness.In(StockOrderBusinesses) && string.IsNullOrWhiteSpace(maxQuantityArguments.SecurityCode))
            {
                EntityResponse <OptionOrderMaxQuantityInformation> entityResponse = EntityResponse <OptionOrderMaxQuantityInformation> .Error(
                    ErrorCode.SZKingdomLibraryError,
                    ErrorMessages.SZKingdom_StockCanNotBeEmpty);

                return(entityResponse);
            }
            arguments.Add(SZKingdomArgument.OptionNumber(maxQuantityArguments.OptionNumber));
            arguments.Add(SZKingdomArgument.SecurityCode(maxQuantityArguments.SecurityCode));


            if (maxQuantityArguments.StockBusiness.In(PriceNecessaryBusinesses) && maxQuantityArguments.OrderPrice == null)
            {
                EntityResponse <OptionOrderMaxQuantityInformation> entityResponse = EntityResponse <OptionOrderMaxQuantityInformation>
                                                                                    .Error(ErrorCode.SZKingdomLibraryError, ErrorMessages.SZKingdom_OrderPriceCanNotBeEmpty);

                return(entityResponse);
            }
            arguments.Add(SZKingdomArgument.OrderPrice(maxQuantityArguments.OrderPrice));


            EntityResponse <OptionOrderMaxQuantityInformation> result =
                _marketDataLibrary.ExecuteCommandSingleEntity <OptionOrderMaxQuantityInformation>(SZKingdomRequest.OptionOrderMaxQuantity, arguments);

            return(result);
        }
Example #7
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 #8
0
        public EntityResponse <List <AssignableExerciseDetail> > AssignableExerciseDetail(AssignableExerciseDetailArguments assignableExerciseDetailArguments)
        {
            List <SZKingdomArgument> arguments = new List <SZKingdomArgument>();

            arguments.Add(SZKingdomArgument.CustomerCode(assignableExerciseDetailArguments.CustomerCode));
            arguments.Add(SZKingdomArgument.CustomerAccountCode(assignableExerciseDetailArguments.CustomerAccountCode));
            arguments.Add(SZKingdomArgument.Currency(assignableExerciseDetailArguments.Currency));
            arguments.Add(SZKingdomArgument.StockBoard(assignableExerciseDetailArguments.StockBoard));

            arguments.Add(SZKingdomArgument.TradeAccount(assignableExerciseDetailArguments.TradeAccount));
            arguments.Add(SZKingdomArgument.OptionNumber(assignableExerciseDetailArguments.OptionNumber));
            arguments.Add(SZKingdomArgument.OptionUnderlyingCode(assignableExerciseDetailArguments.OptionUnderlyingCode));
            arguments.Add(SZKingdomArgument.OptionType(assignableExerciseDetailArguments.OptionType));
            arguments.Add(SZKingdomArgument.OptionCoveredFlag(assignableExerciseDetailArguments.OptionCoveredFlag));
            arguments.Add(SZKingdomArgument.ExerciseSide(assignableExerciseDetailArguments.ExerciseSide));
            arguments.Add(SZKingdomArgument.QueryPosition(assignableExerciseDetailArguments.QueryPosition));
            arguments.Add(SZKingdomArgument.QueryNumer(assignableExerciseDetailArguments.QueryNumer));



            //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 <List <AssignableExerciseDetail> > result =
                _marketDataLibrary.ExecuteCommandList <AssignableExerciseDetail>(SZKingdomRequest.AssignableExerciseDetail, arguments);

            return(result);
        }
Example #9
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);
        }
        public EntityResponse <List <FundInformation> > GetFundInformation(string customertCode = null, string customerAccountCode = null, Currency currency = null)
        {
            List <SZKingdomArgument> arguments = new List <SZKingdomArgument>();

            if (string.IsNullOrWhiteSpace(customertCode) && string.IsNullOrWhiteSpace(customerAccountCode))
            {
                return(EntityResponse <List <FundInformation> > .Error(ErrorCode.SZKingdomLibraryError,
                                                                       string.Format(ErrorMessages.SZKingdom_EmptyAccountIds)));
            }

            arguments.Add(SZKingdomArgument.CustomerCode(customertCode));
            arguments.Add(SZKingdomArgument.CustomerAccountCode(customerAccountCode));
            arguments.Add(SZKingdomArgument.Currency(currency));
            arguments.Add(SZKingdomArgument.ValueFlag("15"));

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

            return(result);
        }
        public EntityResponse <List <OptionableStockPositionInformation> > GetOptionalStockPositions(string customerCode, string customerAccountCode,
                                                                                                     string tradeAccount, string tradeUnit = null,
                                                                                                     string queryPosition = null)
        {
            List <SZKingdomArgument> arguments = new List <SZKingdomArgument>();

            if (string.IsNullOrWhiteSpace(customerCode) && string.IsNullOrWhiteSpace(customerAccountCode))
            {
                return(EntityResponse <List <OptionableStockPositionInformation> > .Error(ErrorCode.SZKingdomLibraryError, "Customer code and Account code cannot be empty at the same time."));
            }

            arguments.Add(SZKingdomArgument.CustomerCode(customerCode));
            arguments.Add(SZKingdomArgument.CustomerAccountCode(customerAccountCode));
            arguments.Add(SZKingdomArgument.TradeAccount(tradeAccount));
            arguments.Add(SZKingdomArgument.TradeUnit(tradeUnit));
            arguments.Add(SZKingdomArgument.QueryPosition(queryPosition));

            EntityResponse <List <OptionableStockPositionInformation> > result =
                _marketDataLibrary.ExecuteCommandList <OptionableStockPositionInformation>(SZKingdomRequest.OptionableStockPositions, arguments);

            return(result);
        }
Example #12
0
        public EntityResponse <List <LockableUnderlyingInformation> > GetLockableUnderlyings(StockBoard stockBoard, string tradeAccount,
                                                                                             string customerCode = null, string accountCode = null)
        {
            List <SZKingdomArgument> arguments = new List <SZKingdomArgument>();

            if (customerCode == null && accountCode == null)
            {
                EntityResponse <List <LockableUnderlyingInformation> > entityReponse = EntityResponse <List <LockableUnderlyingInformation> >
                                                                                       .Error(ErrorCode.SZKingdomLibraryError, SameCodesErrorMessage);

                return(entityReponse);
            }

            arguments.Add(SZKingdomArgument.CustomerCode(customerCode));
            arguments.Add(SZKingdomArgument.CustomerAccountCode(accountCode));
            arguments.Add(SZKingdomArgument.StockBoard(stockBoard));
            arguments.Add(SZKingdomArgument.TradeAccount(tradeAccount));

            EntityResponse <List <LockableUnderlyingInformation> > result = _marketDataLibrary
                                                                            .ExecuteCommandList <LockableUnderlyingInformation>(SZKingdomRequest.LockableUnderlyings, arguments);

            return(result);
        }