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 <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 <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); }
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 <List <CustomerAutomaticOptionExercisingInformation> > GetAutomaticOptionExercisingParameters(string customerCode, string customerAccountCode, string tradeSector, string tradeAccount, List <string> optionNumbers) { if (string.IsNullOrWhiteSpace(customerAccountCode)) { return(EntityResponse <List <CustomerAutomaticOptionExercisingInformation> > .Error( ErrorCode.SZKingdomLibraryError, ErrorMessages.SZKingdom_CustomerCodeEmpty)); } List <CustomerAutomaticOptionExercisingInformation> result = new List <CustomerAutomaticOptionExercisingInformation>(); foreach (string optionNumber in optionNumbers) { var arguments = new List <SZKingdomArgument>(); arguments.Add(SZKingdomArgument.CustomerAccountCode(customerAccountCode)); arguments.Add(SZKingdomArgument.OptionNumber(optionNumber)); EntityResponse <CustomerAutomaticOptionExercisingInformation> item = _marketDataLibrary.ExecuteCommandSingleEntity <CustomerAutomaticOptionExercisingInformation>(SZKingdomRequest.AutomaticOptionExercisingParameters, arguments); if (item.Entity == null) { item = EntityResponse <CustomerAutomaticOptionExercisingInformation> .Success( new CustomerAutomaticOptionExercisingInformation() { ContractNumber = optionNumber, ExercisingQuantity = 0 }); } result.Add(item); } return(result); }
public EntityResponse <List <OptionBasicInformation> > GetOptionBasicInformation(string underlyingCode = null, string optionNumber = null) { List <SZKingdomArgument> arguments = new List <SZKingdomArgument> { SZKingdomArgument.StockBoard(StockBoard.SHStockOptions), SZKingdomArgument.OptionNumber(optionNumber), SZKingdomArgument.OptionUnderlyingCode(underlyingCode) }; EntityResponse <List <OptionBasicInformation> > result = CheckForEmptyResult(_marketDataLibrary.ExecuteCommandList <OptionBasicInformation>(SZKingdomRequest.OptionBasicInformation, arguments)); return(result); }
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); }
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); }
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); }
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); }