3.TWS API v9.72 在线文档 —— 软件架构【翻译】
2018-03-01 04:21
218 查看
【译者注】 IB API 在线文档包含有 C#/Java/CPP/Python 等版本,程序的调用方法基本一致。但因为时间有限,不能翻译全部的版本,而且考虑到适用性和性能,因此在这个版本里,主要围绕着 Java API 进行翻译。您可以从 IB API 在线文档中找到自己熟悉的语言部分,差异不会很大。
http://interactivebrokers.github.io/tws-api/introduction.html
API Software Architecture
【译】 API 软件架构EClientSocket and EWrapper Classes
Once the TWS is up and running and actively listening for incoming connections we are ready to write our code. This brings us to the TWS API's two major classes: the IBApi.EWrapper interface and the IBApi.EClientSocket【译】 当TWS运行后,并开始监听来自我们程序的消息请求。这里,将介绍两个重要的类,IBApi.EWrapper 接口和 IBApi.EClientSocket。Implementing the EWrapper Interface
【译】 对EWrapper接口的实现The IBApi.EWrapper interface is the mechanism through which the TWS delivers information to the API client application. By implementing this interface the client application will be able to receive and handle the information coming from the TWS. For further information on how to implement interfaces, refer to your programming language's documentation.【译】 IBApi.EWrapper 接口是客户端接收来自TWS消息的机制。通过对它的实现,客户端能够获取以及处理来自TWS的消息。更多关于如何实现IBApi.EWrapper的方法,请参考您自己的编程语言的相关说明。public class EWrapperImpl implements EWrapper
The EClientSocket Class
The class used to send messages to TWS is IBApi.EClientSocket. Unlike EWrapper, this class is not overriden as the provided functions in EClientSocket are invoked to send messages to TWS. To use EClientSocket, first it may be necessary to implement the IBApi.EWrapper interface as part of its constructor parameters so that the application can handle all returned messages. Messages sent from TWS as a response to function calls in IBApi.EClientSocket require a EWrapper implementation so they can processed to meet the needs of the API client.【译】 EClientSocket 类用于向TWS发送消息,与 EWrapper 不同,它不需要被重写,因为它提供的函数将被用于向TWS发送消息。为了使用EclientSocket,首先需要实现 IBApi.EWrapper 的接口,并作为参数传递至构造函数中,从而使得程序能够处理全部的返回消息。此外对于程序来说,从TWS发送的消息,需要依靠实现 EWrapper 的接口,并作为 IBApi.EClientSocket 的回掉函数进行处理。Another crucial element is the IBApi.EReaderSignal object passed to theEClientSocket's constructor. With the exception of Python, this object is used in APIs to signal a message is ready for processing in the queue. (In Python the Queue class handles this task directly). We will discuss this object in more detail in the The EReader Thread section.【译】 另一个关键元素是传递给 EClientSocket 构造函数的 IBApi.EReaderSignal。除了Python之外,这个对象在 API 中被用于表示消息队列的状态。(在Python中,队列直接处理这些任务)。我们将在 EReader Thread 章节中详细的讨论这个对象。private EReaderSignal readerSignal; private EClientSocket clientSocket; protected int currentOrderId = -1;...
public EWrapperImpl() { Signal = new EReaderMonitorSignal(); clientSocket = new EClientSocket(this, readerSignal); }
相关文章推荐
- 发布在线文档【软件=业务+架构+流程+组织.pptx】
- 发布在线文档【软件=业务+架构+流程+组织.pptx】
- 一个定期翻译国外Android优质的技术、开源库、软件架构设计、测试等文章的开源项目
- REST 软件架构设计开源文档
- 翻译Husky文档-PyHusky的架构汉化版
- 向架构师进军--->如何编写软件架构文档
- WSE 3.0 文档翻译:WSE架构
- Extjs MVC架构 (官方文档翻译)【带源码】
- Spring Security 文档翻译 - 架构与实现之一技术一览
- Java 调用翻译软件实现英文文档翻译
- Swagger: 一个restful接口文档在线生成+功能测试软件
- 如何编写软件架构文档
- [翻译]NHibernate1.2.0文档学习(2)-架构
- 2.TWS API v9.72 在线文档 —— 初始准备【翻译】
- 面型对象软件架构文档SAD的基本形式
- Ext JS4 架构你的应用 第3节 (官方文档翻译)
- u-boot-2012.10 官方文档翻译--构建软件
- 编写软件架构文档说明
- 电商系统Broadleaf文档翻译(五) - 架构图表architecture diagrams
- 开源软件架构翻译计划-卷2:第3章 FreeRTOS