gpt4 book ai didi

r - 特定请求的版本号,盈透证券的IBrokers包

转载 作者:行者123 更新时间:2023-12-04 15:58:59 24 4
gpt4 key购买 nike

我正在尝试了解 IBrokers 包,并在阅读其 Real Time vignettes 时,在第 2.4.1 节的末尾,包的作者 Jeffrey A. Ryan 写道:

[...] to request the current time from the TWS, one needs to send the code for "Current Time"(.twsOutgoingMSG$REQ CURRENT TIME): "49" and the current version number of the specific request. In the case of current time, the version is simply the character "1".



扫描IBrokers包的源代码,我注意到作者对不同的请求使用了不同的VERSION编号(例如对于reqMrktData,VERSION = 9)。谁,当我,看着盈透证券 API document ,对于 reqMktData() 函数,我看到该函数不需要“版本号”作为参数。

我还试图寻找特定请求的版本号以及我们可能需要它的时间/地点的一般解释,但我找不到任何解释。

如果有人能向我解释该“版本”变量,它的意义是做什么/实现,以及我们如何/在哪里可以找到对盈透证券 API 的各种请求的版本号列表,我将不胜感激。

先感谢您

最佳答案

I would appreciate if someone can provide me with an explanation to that "VERSION" variable, what it's meant to do/achieve, and how/where we can find a list of version number for various request to the Interactive Brokers API.



API 演进问题。

class EClientSocket在 Java(或 C++)API 客户端库代码中。 Jeff Ryan 可能从这里获取/不得不从这里获取版本号。

基本上,随着 IB 平台/服务器功能的发展,客户使用的客户端 API 版本有新旧版本。因此,IB 服务器能够处理来自旧版本 IB API 客户端以及新版本的请求。 VERSION 帮助服务器区分它正在处理的 API 调用版本。

例如,IB 客户端 API 的较新版本可以 reqMktData()一次射击中具有多个腿的整个组合,这是老客户无法做到的。因此,正如您所指出的,对于没有进化的更简单的 API,它是 1,例如 cancelHistoricalData() , cancelScannerSubscription()等;但对于倾向于随时间演变的 API,例如 reqMktData(),可以高达 7 或 9。

在更底层的术语中,VERSION 告诉服务器客户端将在 send() 之后立即在 Socket 上传递哪些参数。 -ing VERSION .以下是来自 reqScannerSubscription() 的代码摘录.请注意 send(VERSION);紧跟在 send(REQ_SCANNER_SUBSCRIPTION); 之后

(请注意,还有两种其他类型的版本号:服务器端(IB 服务器/平台)版本号和 IB TWS 客户端 API 版本号!这些与您关注的每个 API 版本分开。是否IB 确实需要一个与 IB 客户端版本分开的每个 API 调用 VERSION 对我来说不是很明显,但这就是它们现在的滚动方式)。

为一个漫无目的的回答道歉;一看 EClientSocket.java将清除它! :-)
public synchronized void reqScannerSubscription( int tickerId,
ScannerSubscription subscription) {
// not connected?
if (!m_connected) {
error(EClientErrors.NO_VALID_ID, EClientErrors.NOT_CONNECTED, "");
return;
}

if (m_serverVersion < 24) {
error(EClientErrors.NO_VALID_ID, EClientErrors.UPDATE_TWS,
" It does not support API scanner subscription.");
return;
}

final int VERSION = 3;

try {
send(REQ_SCANNER_SUBSCRIPTION);
send(VERSION);
send(tickerId);
sendMax(subscription.numberOfRows());
send(subscription.instrument());
send(subscription.locationCode());

EClientSocket 顶部的客户端版本历史记录。
public class EClientSocket {

// Client version history
//
// 6 = Added parentId to orderStatus
// 7 = The new execDetails event returned for an order filled status and reqExecDetails
// Also market depth is available.
// 8 = Added lastFillPrice to orderStatus() event and permId to execution details
// 9 = Added 'averageCost', 'unrealizedPNL', and 'unrealizedPNL' to updatePortfolio event
// 10 = Added 'serverId' to the 'open order' & 'order status' events.
// We send back all the API open orders upon connection.
// Added new methods reqAllOpenOrders, reqAutoOpenOrders()
// Added FA support - reqExecution has filter.
// - reqAccountUpdates takes acct code.
// 11 = Added permId to openOrder event.
// 12 = requsting open order attributes ignoreRth, hidden, and discretionary
// 13 = added goodAfterTime
// 14 = always send size on bid/ask/last tick
// 15 = send allocation description string on openOrder
// 16 = can receive account name in account and portfolio updates, and fa params in openOrder
// 17 = can receive liquidation field in exec reports, and notAutoAvailable field in mkt data
// 18 = can receive good till date field in open order messages, and request intraday backfill
// 19 = can receive rthOnly flag in ORDER_STATUS
// 20 = expects TWS time string on connection after server version >= 20.
// 21 = can receive bond contract details.
// 22 = can receive price magnifier in version 2 contract details message
// 23 = support for scanner
// 24 = can receive volatility order parameters in open order messages
// 25 = can receive HMDS query start and end times
// 26 = can receive option vols in option market data messages
// 27 = can receive delta neutral order type and delta neutral aux price in place order version 20: API 8.85
// 28 = can receive option model computation ticks: API 8.9
// 29 = can receive trail stop limit price in open order and can place them: API 8.91
// 30 = can receive extended bond contract def, new ticks, and trade count in bars
// 31 = can receive EFP extensions to scanner and market data, and combo legs on open orders
// ; can receive RT bars
// 32 = can receive TickType.LAST_TIMESTAMP
// ; can receive "whyHeld" in order status messages
// 33 = can receive ScaleNumComponents and ScaleComponentSize is open order messages
// 34 = can receive whatIf orders / order state
// 35 = can receive contId field for Contract objects
// 36 = can receive outsideRth field for Order objects
// 37 = can receive clearingAccount and clearingIntent for Order objects

private static final int CLIENT_VERSION = 37;
private static final int SERVER_VERSION = 38;
private static final byte[] EOL = {0};
private static final String BAG_SEC_TYPE = "BAG";

关于r - 特定请求的版本号,盈透证券的IBrokers包,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18199391/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com