tôi sẽ đánh giá cao nếu ai đó có thể cung cấp cho tôi với một lời giải thích cho rằng "VERSION" biến, những gì nó có nghĩa là để làm/đạt được, và làm thế nào/nơi chúng tôi có thể tìm thấy một danh sách các số phiên bản cho các yêu cầu khác nhau đối với API môi giới tương tác.
Sự cố tiến hóa API.
Nhìn vào class EClientSocket
trong mã thư viện máy khách API Java (hoặc C++). Jeff Ryan có lẽ đã nhặt/phải nhận số VERSION từ đây.
Về cơ bản, khi các khả năng của Nền tảng/Máy chủ IB phát triển, các phiên bản cũ hơn cũng như các phiên bản mới hơn của API ứng dụng khách đang được khách hàng sử dụng. Do đó, máy chủ IB có thể xử lý các yêu cầu từ các phiên bản cũ hơn của IB API Clients cũng như các phiên bản mới hơn. VERSION giúp máy chủ phân biệt phiên bản của cuộc gọi API mà nó đang xử lý.
Ví dụ: các phiên bản mới hơn của API ứng dụng khách IB có thể reqMktData()
cho toàn bộ Combos có nhiều Chân trong một lần chụp mà Khách hàng cũ không thể thực hiện. Vì vậy, như bạn đã lưu ý, nó là 1 cho API đơn giản hơn mà không phát triển, chẳng hạn như cancelHistoricalData()
, cancelScannerSubscription()
vv ;, nhưng có thể cao tới 7 hoặc 9 cho các API có xu hướng phát triển theo thời gian, chẳng hạn như reqMktData() .
Trong các điều khoản cấp thấp hơn, VERSION cho máy chủ biết thông số nào Máy khách sẽ chuyển vào Ổ cắm ngay lập tức sau send()
-ing the VERSION
. Dưới đây là đoạn trích mã từ reqScannerSubscription()
. Lưu ý số send(VERSION);
ngay sau send(REQ_SCANNER_SUBSCRIPTION);
(Lưu ý rằng có hai loại số phiên bản khác: số phiên bản máy chủ IB (Platform Server) và số phiên bản API IB TWS Client API! mỗi phiên bản API mà bạn quan tâm.Cho dù IB thực sự cần một cuộc gọi API VERSION mà là riêng biệt với phiên bản IB Client không phải là ngay lập tức rõ ràng với tôi, nhưng đó là cách họ cuộn ngay bây giờ).
Xin lỗi vì câu trả lời rambling; một cái nhìn tại EClientSocket.java
sẽ xóa nó đi! :-)
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());
Lịch sử phiên bản ứng dụng ở đầu 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";