本文整理汇总了C#中List.AddParameter方法的典型用法代码示例。如果您正苦于以下问题:C# List.AddParameter方法的具体用法?C# List.AddParameter怎么用?C# List.AddParameter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类List
的用法示例。
在下文中一共展示了List.AddParameter方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: updateDisplayGroup
public void updateDisplayGroup(int requestId, string contractInfo)
{
if (!CheckConnection())
return;
if (!CheckServerVersion(MinServerVer.LINKING, " It does not support updateDisplayGroup request."))
return;
const int VERSION = 1;
List<byte> paramsList = new List<byte>();
paramsList.AddParameter(OutgoingMessages.UpdateDisplayGroup);
paramsList.AddParameter(VERSION);
paramsList.AddParameter(requestId);
paramsList.AddParameter(contractInfo);
Send(paramsList, EClientErrors.FAIL_SEND_UPDATEDISPLAYGROUP);
}
示例2: placeOrder
/**
* @brief Places an order
* @param id the order's unique identifier. Use a sequential id starting with the id received at the nextValidId method.
* @param contract the order's contract
* @param order the order
* @sa nextValidId, reqAllOpenOrders, reqAutoOpenOrders, reqOpenOrders, cancelOrder, reqGlobalCancel, EWrapper::openOrder, EWrapper::orderStatus, Order, Contract
*/
public void placeOrder(int id, Contract contract, Order order)
{
if (!CheckConnection())
return;
if (!VerifyOrder(order, id, StringsAreEqual(Constants.BagSecType, contract.SecType)))
return;
if (!VerifyOrderContract(contract, id))
return;
int MsgVersion = (serverVersion < MinServerVer.NOT_HELD ) ? 27 : 41;
List<byte> paramsList = new List<byte>();
paramsList.AddParameter(OutgoingMessages.PlaceOrder);
paramsList.AddParameter(MsgVersion);
paramsList.AddParameter(id);
if (serverVersion >= MinServerVer.PLACE_ORDER_CONID)
{
paramsList.AddParameter(contract.ConId);
}
paramsList.AddParameter(contract.Symbol);
paramsList.AddParameter(contract.SecType);
paramsList.AddParameter(contract.Expiry);
paramsList.AddParameter(contract.Strike);
paramsList.AddParameter(contract.Right);
if (serverVersion >= 15)
{
paramsList.AddParameter(contract.Multiplier);
}
paramsList.AddParameter(contract.Exchange);
if (serverVersion >= 14)
{
paramsList.AddParameter(contract.PrimaryExch);
}
paramsList.AddParameter(contract.Currency);
if (serverVersion >= 2)
{
paramsList.AddParameter(contract.LocalSymbol);
}
if (serverVersion >= MinServerVer.TRADING_CLASS)
{
paramsList.AddParameter(contract.TradingClass);
}
if (serverVersion >= MinServerVer.SEC_ID_TYPE)
{
paramsList.AddParameter(contract.SecIdType);
paramsList.AddParameter(contract.SecId);
}
// paramsList.AddParameter main order fields
paramsList.AddParameter(order.Action);
paramsList.AddParameter(order.TotalQuantity);
paramsList.AddParameter(order.OrderType);
if (serverVersion < MinServerVer.ORDER_COMBO_LEGS_PRICE)
{
paramsList.AddParameter(order.LmtPrice == Double.MaxValue ? 0 : order.LmtPrice);
}
else
{
paramsList.AddParameterMax(order.LmtPrice);
}
if (serverVersion < MinServerVer.TRAILING_PERCENT)
{
paramsList.AddParameter(order.AuxPrice == Double.MaxValue ? 0 : order.AuxPrice);
}
else
{
paramsList.AddParameterMax(order.AuxPrice);
}
// paramsList.AddParameter extended order fields
paramsList.AddParameter(order.Tif);
paramsList.AddParameter(order.OcaGroup);
paramsList.AddParameter(order.Account);
paramsList.AddParameter(order.OpenClose);
paramsList.AddParameter(order.Origin);
paramsList.AddParameter(order.OrderRef);
paramsList.AddParameter(order.Transmit);
if (serverVersion >= 4)
{
paramsList.AddParameter(order.ParentId);
}
if (serverVersion >= 5)
{
paramsList.AddParameter(order.BlockOrder);
paramsList.AddParameter(order.SweepToFill);
paramsList.AddParameter(order.DisplaySize);
paramsList.AddParameter(order.TriggerMethod);
if (serverVersion < 38)
{
// will never happen
//.........这里部分代码省略.........
示例3: requestFA
/**
* @brief Requests the FA configuration
* A Financial Advisor can define three different configurations:
* 1. Groups: offer traders a way to create a group of accounts and apply a single allocation method to all accounts in the group.
* 2. Profiles: let you allocate shares on an account-by-account basis using a predefined calculation value.
* 3. Account Aliases: let you easily identify the accounts by meaningful names rather than account numbers.
* More information at https://www.interactivebrokers.com/en/?f=%2Fen%2Fsoftware%2Fpdfhighlights%2FPDF-AdvisorAllocations.php%3Fib_entity%3Dllc
* @param faDataType the configuration to change. Set to 1, 2 or 3 as defined above.
* @sa replaceFA
*/
public void requestFA(int faDataType)
{
if (!CheckConnection())
return;
const int VERSION = 1;
List<byte> paramsList = new List<byte>();
paramsList.AddParameter(OutgoingMessages.RequestFA);
paramsList.AddParameter(VERSION);
paramsList.AddParameter(faDataType);
Send(paramsList, EClientErrors.FAIL_SEND_FA_REQUEST);
}
示例4: SendCancelRequest
protected void SendCancelRequest(int msgType, int version, CodeMsgPair errorMessage)
{
List<byte> paramsList = new List<byte>();
paramsList.AddParameter(msgType);
paramsList.AddParameter(version);
try
{
lock (this)
{
Send(paramsList);
}
}
catch (Exception)
{
wrapper.error(IncomingMessage.NotValid, errorMessage.Code, errorMessage.Message);
Close();
}
}
示例5: calculateOptionPrice
/**
* @brief Calculates an option's price.
* Calculates an option's price based on the provided volatility and its underlying's price. The calculation will be return in EWrapper's tickOptionComputation callback.
* @param reqId request's unique identifier.
* @param contract the option's contract for which the price wants to be calculated.
* @param volatility hypothetical volatility.
* @param underPrice hypothetical underlying's price.
* @sa EWrapper::tickOptionComputation, cancelCalculateOptionPrice, Contract
*/
public void calculateOptionPrice(int reqId, Contract contract, double volatility, double underPrice)
{
if (!CheckConnection())
return;
if(!CheckServerVersion(MinServerVer.REQ_CALC_OPTION_PRICE,
" It does not support calculation price requests."))
return;
if (!Util.StringIsEmpty(contract.TradingClass) &&
!CheckServerVersion(MinServerVer.REQ_CALC_OPTION_PRICE, " It does not support tradingClass parameter in calculateOptionPrice."))
return;
const int version = 2;
List<byte> paramsList = new List<byte>();
paramsList.AddParameter(OutgoingMessages.ReqCalcOptionPrice);
paramsList.AddParameter(version);
paramsList.AddParameter(reqId);
paramsList.AddParameter(contract.ConId);
paramsList.AddParameter(contract.Symbol);
paramsList.AddParameter(contract.SecType);
paramsList.AddParameter(contract.Expiry);
paramsList.AddParameter(contract.Strike);
paramsList.AddParameter(contract.Right);
paramsList.AddParameter(contract.Multiplier);
paramsList.AddParameter(contract.Exchange);
paramsList.AddParameter(contract.PrimaryExch);
paramsList.AddParameter(contract.Currency);
paramsList.AddParameter(contract.LocalSymbol);
if (serverVersion >= MinServerVer.TRADING_CLASS)
paramsList.AddParameter(contract.TradingClass);
paramsList.AddParameter(volatility);
paramsList.AddParameter(underPrice);
Send(reqId, paramsList, EClientErrors.FAIL_SEND_REQCALCOPTIONPRICE);
}
示例6: reqRealTimeBars
/**
* @brief Requests real time bars
* Currently, only 5 seconds bars are provided
* @param tickerId the request's unique identifier.
* @param contract the Contract for which the depth is being requested
* @param barSize currently being ignored
* @param whatToShow the nature of the data being retrieved:
* - TRADES
* - MIDPOINT
* - BID
* - ASK
* @param useRTH set to 0 to obtain the data which was also generated ourside of the Regular Trading Hours, set to 1 to obtain only the RTH data
* @sa cancelRealTimeBars, EWrapper::realTimeBar
*/
public void reqRealTimeBars(int tickerId, Contract contract, int barSize, string whatToShow, bool useRTH)
{
if (!CheckConnection())
return;
if (!CheckServerVersion(tickerId, MinServerVer.REAL_TIME_BARS, " It does not support real time bars."))
return;
if (!IsEmpty(contract.TradingClass) || contract.ConId > 0)
{
if (!CheckServerVersion(tickerId, MinServerVer.TRADING_CLASS, " It does not support ConId nor TradingClass parameters in reqRealTimeBars."))
return;
}
const int VERSION = 2;
List<byte> paramsList = new List<byte>();
paramsList.AddParameter(OutgoingMessages.RequestRealTimeBars);
paramsList.AddParameter(VERSION);
paramsList.AddParameter(tickerId);
// paramsList.AddParameter contract fields
if (serverVersion >= MinServerVer.TRADING_CLASS)
{
paramsList.AddParameter(contract.ConId);
}
paramsList.AddParameter(contract.Symbol);
paramsList.AddParameter(contract.SecType);
paramsList.AddParameter(contract.Expiry);
paramsList.AddParameter(contract.Strike);
paramsList.AddParameter(contract.Right);
paramsList.AddParameter(contract.Multiplier);
paramsList.AddParameter(contract.Exchange);
paramsList.AddParameter(contract.PrimaryExch);
paramsList.AddParameter(contract.Currency);
paramsList.AddParameter(contract.LocalSymbol);
if (serverVersion >= MinServerVer.TRADING_CLASS)
{
paramsList.AddParameter(contract.TradingClass);
}
paramsList.AddParameter(barSize); // this parameter is not currently used
paramsList.AddParameter(whatToShow);
paramsList.AddParameter(useRTH);
Send(paramsList, EClientErrors.FAIL_SEND_REQRTBARS);
}
示例7: reqScannerSubscription
/**
* @brief Starts a subscription to market scan results based on the provided parameters.
* @param reqId the request's identifier
* @param subscription summary of the scanner subscription including its filters.
* @sa reqScannerParameters, ScannerSubscription, EWrapper::scannerData
*/
public void reqScannerSubscription(int reqId, ScannerSubscription subscription)
{
if (!CheckConnection())
return;
const int VERSION = 3;
List<byte> paramsList = new List<byte>();
paramsList.AddParameter(OutgoingMessages.RequestScannerSubscription);
paramsList.AddParameter(VERSION);
paramsList.AddParameter(reqId);
paramsList.AddParameterMax(subscription.NumberOfRows);
paramsList.AddParameter(subscription.Instrument);
paramsList.AddParameter(subscription.LocationCode);
paramsList.AddParameter(subscription.ScanCode);
paramsList.AddParameterMax(subscription.AbovePrice);
paramsList.AddParameterMax(subscription.BelowPrice);
paramsList.AddParameterMax(subscription.AboveVolume);
paramsList.AddParameterMax(subscription.MarketCapAbove);
paramsList.AddParameterMax(subscription.MarketCapBelow);
paramsList.AddParameter(subscription.MoodyRatingAbove);
paramsList.AddParameter(subscription.MoodyRatingBelow);
paramsList.AddParameter(subscription.SpRatingAbove);
paramsList.AddParameter(subscription.SpRatingBelow);
paramsList.AddParameter(subscription.MaturityDateAbove);
paramsList.AddParameter(subscription.MaturityDateBelow);
paramsList.AddParameterMax(subscription.CouponRateAbove);
paramsList.AddParameterMax(subscription.CouponRateBelow);
paramsList.AddParameter(subscription.ExcludeConvertible);
if (serverVersion >= 25)
{
paramsList.AddParameterMax(subscription.AverageOptionVolumeAbove);
paramsList.AddParameter(subscription.ScannerSettingPairs);
}
if (serverVersion >= 27)
{
paramsList.AddParameter(subscription.StockTypeFilter);
}
Send(paramsList, EClientErrors.FAIL_SEND_REQSCANNER);
}
示例8: reqExecutions
/**
* @brief Requests all the day's executions matching the filter.
* Only the current day's executions can be retrieved. Along with the executions, the CommissionReport will also be returned. The execution details will arrive at EWrapper:execDetails
* @param reqId the request's unique identifier.
* @param filter the filter criteria used to determine which execution reports are returned.
* @sa EWrapper::execDetails, EWrapper::commissionReport, ExecutionFilter
*/
public void reqExecutions(int reqId, ExecutionFilter filter)
{
if (!CheckConnection())
return;
int VERSION = 3;
List<byte> paramsList = new List<byte>();
paramsList.AddParameter(OutgoingMessages.RequestExecutions);
paramsList.AddParameter(VERSION);//version
if (serverVersion >= MinServerVer.EXECUTION_DATA_CHAIN)
{
paramsList.AddParameter( reqId);
}
//Send the execution rpt filter data
if (serverVersion >= 9)
{
paramsList.AddParameter(filter.ClientId);
paramsList.AddParameter(filter.AcctCode);
// Note that the valid format for time is "yyyymmdd-hh:mm:ss"
paramsList.AddParameter(filter.Time);
paramsList.AddParameter(filter.Symbol);
paramsList.AddParameter(filter.SecType);
paramsList.AddParameter(filter.Exchange);
paramsList.AddParameter(filter.Side);
}
Send(reqId, paramsList, EClientErrors.FAIL_SEND_EXEC);
}
示例9: reqFundamentalData
/**
* @brief Requests the contract's Reuters' global fundamental data.
* Reuters funalmental data will be returned at EWrapper::fundamentalData
* @param reqId the request's unique identifier.
* @param contract the contract's description for which the data will be returned.
* @param reportType there are three available report types:
* - ReportSnapshot: Company overview
* - ReportsFinSummary: Financial summary
- ReportRatios: Financial ratios
- ReportsFinStatements: Financial statements
- RESC: Analyst estimates
- CalendarReport: Company calendar
* @sa EWrapper::fundamentalData
*/
public void reqFundamentalData(int reqId, Contract contract, String reportType)
{
if (!CheckConnection())
return;
if (!CheckServerVersion(reqId, MinServerVer.FUNDAMENTAL_DATA, " It does not support Fundamental Data requests."))
return;
if (!IsEmpty(contract.TradingClass) || contract.ConId > 0 || !IsEmpty(contract.Multiplier))
{
if (!CheckServerVersion(reqId, MinServerVer.TRADING_CLASS, ""))
return;
}
const int VERSION = 2;
List<byte> paramsList = new List<byte>();
paramsList.AddParameter(OutgoingMessages.RequestFundamentalData);
paramsList.AddParameter(VERSION);
paramsList.AddParameter(reqId);
if (serverVersion >= MinServerVer.TRADING_CLASS)
{
//WARN: why are we checking the trading class and multiplier above never send them?
paramsList.AddParameter(contract.ConId);
}
paramsList.AddParameter(contract.Symbol);
paramsList.AddParameter(contract.SecType);
paramsList.AddParameter(contract.Exchange);
paramsList.AddParameter(contract.PrimaryExch);
paramsList.AddParameter(contract.Currency);
paramsList.AddParameter(contract.LocalSymbol);
paramsList.AddParameter(reportType);
Send(reqId, paramsList, EClientErrors.FAIL_SEND_REQFUNDDATA);
}
示例10: reqContractDetails
/**
* @brief Requests contract information.
* This method will provide all the contracts matching the contract provided. It can also be used to retrieve complete options and futures chains. This information will be returned at EWrapper:contractDetails
* @param reqId the unique request identifier.
* @param contract the contract used as sample to query the available contracts. Typically, it will contain the Contract::Symbol, Contract::Currency, Contract::SecType, Contract::Exchange
* @sa EWrapper::contractDetails
*/
public void reqContractDetails(int reqId, Contract contract)
{
if (!CheckConnection())
return;
if(!IsEmpty(contract.SecIdType) || !IsEmpty(contract.SecId))
{
if(!CheckServerVersion(reqId, MinServerVer.SEC_ID_TYPE, " It does not support secIdType not secId attributes"))
return;
}
if (!IsEmpty(contract.TradingClass))
{
if (!CheckServerVersion(reqId, MinServerVer.TRADING_CLASS, " It does not support the TradingClass parameter when requesting contract details."))
return;
}
int VERSION = 7;
List<byte> paramsList = new List<byte>();
paramsList.AddParameter(OutgoingMessages.RequestContractData);
paramsList.AddParameter(VERSION);//version
if (serverVersion >= MinServerVer.CONTRACT_DATA_CHAIN)
{
paramsList.AddParameter(reqId);
}
if (serverVersion >= MinServerVer.CONTRACT_CONID)
{
paramsList.AddParameter(contract.ConId);
}
paramsList.AddParameter(contract.Symbol);
paramsList.AddParameter(contract.SecType);
paramsList.AddParameter(contract.Expiry);
paramsList.AddParameter(contract.Strike);
paramsList.AddParameter(contract.Right);
if (serverVersion >= 15)
{
paramsList.AddParameter(contract.Multiplier);
}
paramsList.AddParameter(contract.Exchange);
paramsList.AddParameter(contract.Currency);
paramsList.AddParameter(contract.LocalSymbol);
if (serverVersion >= MinServerVer.TRADING_CLASS)
{
paramsList.AddParameter(contract.TradingClass);
}
if (serverVersion >= 31)
{
paramsList.AddParameter(contract.IncludeExpired);
}
if (serverVersion >= MinServerVer.SEC_ID_TYPE)
{
paramsList.AddParameter(contract.SecIdType);
paramsList.AddParameter(contract.SecId);
}
Send(reqId, paramsList, EClientErrors.FAIL_SEND_REQCONTRACT);
}
示例11: reqCurrentTime
/**
* @brief Requests the server's current time.
* @sa EWrapper::currentTime
*/
public void reqCurrentTime()
{
int VERSION = 1;
if (!CheckConnection())
return;
if (!CheckServerVersion(MinServerVer.CURRENT_TIME, " It does not support current time requests."))
return;
List<byte> paramsList = new List<byte>();
paramsList.AddParameter(OutgoingMessages.RequestCurrentTime);
paramsList.AddParameter(VERSION);//version
Send(paramsList, EClientErrors.FAIL_SEND_REQCURRTIME);
}
示例12: reqAccountUpdates
/**
* @brief Subscribes to an specific account's information and portfolio
* Through this method, a single account's subscription can be started/stopped. As a result from the subscription, the account's information, portfolio and last update time will be received at EWrapper::updateAccountValue, EWrapper::updateAccountPortfolio, EWrapper::updateAccountTime respectively.
* Only one account can be subscribed at a time. A second subscription request for another account when the previous one is still active will cause the first one to be canceled in favour of the second one. Consider user reqPositions if you want to retrieve all your accounts' portfolios directly.
* @param subscribe set to true to start the subscription and to false to stop it.
* @param acctCode the account id (i.e. U123456) for which the information is requested.
* @sa reqPositions, EWrapper::updateAccountValue, EWrapper::updateAccountPortfolio, EWrapper::updateAccountTime
*/
public void reqAccountUpdates(bool subscribe, string acctCode)
{
int VERSION = 2;
if (!CheckConnection())
return;
List<byte> paramsList = new List<byte>();
paramsList.AddParameter(OutgoingMessages.RequestAccountData);
paramsList.AddParameter(VERSION);
paramsList.AddParameter(subscribe);
if (serverVersion >= 9)
paramsList.AddParameter(acctCode);
Send(paramsList, EClientErrors.FAIL_SEND_REQACCOUNTDATA);
}
示例13: reqAutoOpenOrders
/**
* @brief Requests all order placed on the TWS directly.
* Only the orders created after this request has been made will be returned.
* @param autoBind if set to true, the newly created orders will be implicitely associated with this client.
* @sa reqAllOpenOrders, reqOpenOrders, cancelOrder, reqGlobalCancel, EWrapper::openOrder, EWrapper::orderStatus
*/
public void reqAutoOpenOrders(bool autoBind)
{
if (!CheckConnection())
return;
List<byte> paramsList = new List<byte>();
paramsList.AddParameter(OutgoingMessages.RequestAutoOpenOrders);
paramsList.AddParameter(1);
paramsList.AddParameter(autoBind);
Send(paramsList, EClientErrors.FAIL_SEND_OORDER);
}
示例14: unsubscribeFromGroupEvents
public void unsubscribeFromGroupEvents(int requestId)
{
if (!CheckConnection())
return;
if (!CheckServerVersion(MinServerVer.LINKING, " It does not support unsubscribeFromGroupEvents request."))
return;
const int VERSION = 1;
List<byte> paramsList = new List<byte>();
paramsList.AddParameter(OutgoingMessages.UnsubscribeFromGroupEvents);
paramsList.AddParameter(VERSION);
paramsList.AddParameter(requestId);
Send(paramsList, EClientErrors.FAIL_SEND_UNSUBSCRIBEFROMGROUPEVENTS);
}
示例15: reqOpenOrders
/**
* @brief Requests all open orders places by this specific API client (identified by the API client id)
* @sa reqAllOpenOrders, reqAutoOpenOrders, placeOrder, cancelOrder, reqGlobalCancel, EWrapper::openOrder, EWrapper::orderStatus
*/
public void reqOpenOrders()
{
int VERSION = 1;
if (!CheckConnection())
return;
List<byte> paramsList = new List<byte>();
paramsList.AddParameter(OutgoingMessages.RequestOpenOrders);
paramsList.AddParameter(VERSION);
Send(paramsList, EClientErrors.FAIL_SEND_OORDER);
}