Introduction [译] 介绍 The TWS API is a simple yet powerful interface through which IB clients can automate their trading strategies, request market data and monitor your account balance and portfolio in real time. [译] TWS API是一个简单但功能强大的基于赢透证券客户端的交易工具,用户可以通过TWS API自动化交易,实时的获取市场数据,监控你的账户头寸,以及管理你的投资组合。 Audience[译] 至用户 Our TWS API components are aimed at experienced professional developers willing to enhance the current TWS functionality. Regrettably, Interactive Brokers cannot offer any programming consulting. Before contacting our API support, please always refer to our available documentation, sample applications and Recorded Webinars [译] 我们的TWS API提供给有经验的开发者使用。但是很遗憾的是,赢透证券不提供任何有关编程方面的咨询。在您咨询我们API技术支持前,请先阅读我们提供的文档、程序示例以及网站。 How to use this guide[译] 如何使用手册 This guide reflects the very latest version of the TWS API -9.72 and higher- and constantly references the Java, VB, C#, C++ and Python Testbed sample projects to demonstrate the TWS API functionality. All code snippets are extracted from these projects and we suggest all those users new to the TWS API to get familiar with them in order to quickly understand the fundamentals of our programming interface. The Testbed sample projects can be found within the samples folder of the TWS API's installation directory. [译] 这份手册包含最新的API(9.72)信息,以及与Java、VB、C#、C++、Python语言的高度关联的示例工程。示例中的代码能为你熟悉TWS API提供非常重要的帮助,尤其是第一次熟悉TWS API的开发者。这些示例代码可以在你下载的TWS API里找到。 Requirements[译] 必备条件 - The TWS API is an interface to TWS or IB Gateway, and as such requires network connectivity to a running instance of one of these programs.
- [译] TWS API是赢透客户端或者网关的接口,因此要求运行API前请确保赢透客户端或者网关处于工作状态,并且确保有效的网络连接。
- To obtain the TWS API source and sample code, download the API Components.
- [译] 请从官网上下载API,获得API的源码和示例程序。
- To make use of TWS API 9.72+, will require TWS build 952.x or higher.
- [译] 使用TWS API 9.72+的版本,需要赢透客户端在build 952.x或更新的版本。
- A working knowledge of the programming language our Testbed sample projects are developed in.
- [译] 请使用您熟悉且有把握的编程语言。
Limitations[译] 限制内容 Our programming interface is designed to automate some of the operations a user normally performs manually within the TWS Software such as placing orders, monitoring your account balance and positions, viewing an instrument's live data... etc. There is no logic within the API other than to ensure the integrity of the exchanged messages. Most validations and checks occur in the backend of TWS and our servers. [译] 我们的API通常是为了方便用户在使用TWS客户端时简化、以及自动化一些操作。例如下订单。监控您的账户余额,查看实时的法律文件等。 TWS除了确保数据的完整性,API中不包含除此以外的逻辑单元。大多数的安全性和完整性检测都在我们的TWS后端以及服务器上。 Because of this it is highly convenient to familiarize with the TWS itself, in order to gain a better understanding on how our platform works. Before spending precious development time troubleshooting on the API side, it is recommended to first experiment with the TWS directly. [译] 因为这将便于用户了解TWS客户端,以更好地理解我们的平台是如何的工作的。在花费您宝贵的开发时间解决API的各种疑难前,高度建议用户先体验TWS客户端。 Remember:
If a certain feature or operation is not available in the TWS, it will not be available on the API side either! [译] 记住:当TWS的任何一项功能不再提供给使用时,对应的API也将无效。 Requests[译] 要求 The TWS is designed to accept up to fifty messages per second coming from the client side. Anything coming from the client application to the TWS counts as a message (i.e. requesting data, placing orders, requesting your portfolio... etc.). This limitation is applied to all connected clients in the sense were all connected client applications to the same instance of TWS combined cannot exceed this number. On the other hand, there are no limits on the amount of messages the TWS can send to the client application. [译] TWS设计的最高消息处理能力为50条/秒。 任何从客户端发送至TWS的数据请求都以消息的形式呈现(例如:获取数据,提交订单,获取您的投资组合...)这条限制适用于任意连接至TWS的单一客户端,并且不会超过这个限制。另一方面,TWS对客户端推送的消息没有数量限制。 Paper Trading[译] 模拟交易 If your regular trading account has been approved and funded, you can use your Account Management page to open a Paper Trading Account which lets you use the full range of trading facilities in a simulated environment using real market conditions. Using a Paper Trading Account will allow you not only to get familiar with the TWS API but also to test your trading strategies without risking your capital. Note the paper trading environment has inherent limitations. [译] 如果您的标准交易账户获得批准并且已经入金。您可以通过账户管理界面开通模拟交易账户,它将允许你使用全部的功能与实时的市场数据。使用虚拟交易账户不仅能让你熟悉TWS API,测试您的交易策略,并且不会损害您的资本金。需要注意的是,模拟交易受到和真实交易账户一样的限制条件。 |