Sunday, December 18, 2011

IB SDK/API review

This article reflects my experience developing an automated equity trading platforms using the IB SDK/API. I have written this article as an individual, not representing IB (Interactive brokers) in ANY way.

The IB Application Program Interface (API) connects through the Trader Workstation (often known as TWS) or the IB Gateway. TWS is programmed in Java, which is platform-independent and can be very useful( but, it is not as fast as it would be if it was programmed in C or C++ ). In order to connect to IB, the TWS (Trading Work Station ) application must be running in the background. The connection takes place via a network connection. If the TWS and the API application run on the same system this network connection will be through localhost ( which is a bit awkward, since trading program execution requires TWS to be run first to establish a session).

The good news is that, TWS provides a great API ( application programming interface ) in several programming languages, which including Java,C++, ActiveX and DDE for Excel ( there is also a possibility to get an interface in C# ), and this can be used to access almost all of the TWS' features via other programs. The API code makes a TCP/IP or local host connection to the TWS software( usually to port 7496 on the local host). There are two sides to the communication: the request and the response. This means that the process of reading from the socket and writing to the call back methods, is asynchronous and it takes place in separate threads. IB transaction either go through the TWS (trading software),or through CTCI FIX. When using The IB API, A single account (user name and password) is limited to 50 messages a second. Using the CTCI FIX interface the limit is150 messages a second. If you have the possibility, I would suggest to avoid using the CTCI FIX since its complex and sample applications are not provided.

Beside that, this are some of the issues that I had to deal with :
1) Opening an account with IB takes a long time. Application forms are the largest I have seen.
2) The API Chat is usually empty ( Which mean that I am the only person in the room ). Only Registered clients ( customers who paid money ), will get a full customer support by mail.
3) There were several technical issues, which forced me to find a creative solution inorder to make my trading platform work as I needed. For Eg: I placed a limit BUY at $60 for a stock at $30, IB rejected the order as too far outside the NBBO. Well, IB allows you to override TWS order price percentage constraints ( which are applied to orders that TWS sees as deviating too much from the NBBO` of the contract ). Unfortunately, setting this param ( from TWS or the API ) had no effect, and my only alternative was to place a market order. I guess, That this param exist there as a restriction created by the exchange in order to "protect" me. But, If I'm responsible enough for my own trades and want to make some more money, why this feature is not working ? Maybe if enough people will complain to IB , they will fix it.
4) Limits to data requests : 60 requests in 10 mins (almost) without pacing violations, But also this issue can be handled by implementing a smart mechanism ( Or you can just get real time data from Yahoo! Finance )

Despite of the problems I've described above, My main impression is good. The very best advantage that IB offers for developers is that there is a discussion forum, which serves as a serviceable message board where traders read and share information or even post programming code, also a very good API reference guide is presented, and you get code samples which,ship with the IB's API package.(Code samples :Cpp, Java, VB6, VB.NET, C#.NET).

IB support ( Only Registered clients ), a paper trading account which allows traders to test the full range of IB trading facilities in a simulated environment using real market conditions. Its especially beneficial to traders that want a special strategy implemented for them by a developer, without using there real account (paper trading account works just like the production account, but has different username/password). as well, Users can test new strategies and ideas risk-free or learn about order execution of global products they've never traded in the past. Last but not least, IB allows very sophisticated, advanced order specification and routing. They allow you to trade just about every kind of tradable security.

Moris oz
Algorithmic trading Consulting and development
www.caapitech.com

Sunday, July 3, 2011

Artificial Intelligence Goes to Wall Street: Trading Platforms Get Smarter

Press Release

It is no secret that for many years global banks have used artificial intelligence to make better trades. Now that technology might be coming to your local independent investment advisory service.
Caapi Technologies just announced that it signed a deal to use artificial intelligence technology to build custom trading systems for small to mid-size investment firms. Caapi will build applications with software development kits (SDKs) from ai-one that enable computers to understand human language to find undervalued stocks, bonds and derivatives.
The partnership makes Caapi one of the first consulting firms to use ai-one’s machine learning technology to build trading algorithms and platforms for traders, banks and hedge funds.
Building custom trading algorithms is a huge industry propelled by the success of high-frequency trading across global markets. Originally, these algorithms were designed to find and exploit pricing differences between stocks, commodities and derivatives. Now trading algorithms are so widespread and so sophisticated that they have completely reshaped markets to the point where pricing is often driven more by speculation than it is by the underlying value of the asset class.
The challenge now is to find underpriced opportunities that generate returns based on actual performance rather than market volatility. This requires that investors sort through vast amounts of unstructured data to find undervalued assets before they are identified by the rest of the market. Often this means reading text that can’t be processed by search engines like Google. Traditional algorithmic approaches, such as Google’s, fail as they only know what they are programmed to know or programmed to find. They miss finding unexpected results that don’t fit into an equation.
ai-one’s technology is described as “biologically inspired intelligence.” It is modeled after the human brain and does not depend on algorithms. Rather, it automatically sees the inherent patterns within data and forms associations between each data element. This enables machines to learn without any human intervention. More importantly, it enables people to ask the questions they wouldn’t normally know to ask.
The CEO of Caapi, Mr. Moris Oz, sees machine learning as the key to discovering hidden investment opportunities. “a-one’s technology enables us to build semantic associative search engines for our clients that understand how the price of any given investment is related to the unstructured data found on the internet.”
Caapi’s approach is to combine proven techniques using sophisticated algorithms with machine learning that understands words.  “Language is not math,” adds Olin Hyde, VP of Business Development at ai-one. “Algorithms are fantastic at processing structured data. But human behaviors and communications are inherently unstructured and complex. We learn through words not equations. So why not enable computers to do the same?”
According to Moris Oz, CEO of Caapi, “ai-one’s SDK for machine learning could be the answer for understanding and correlating soft data driving price moves in the markets.  I’m looking forward to applying this to new applications.” The market will soon tell if it works or not.
About Caapi TechnologiesCaapi Technologies is a small, dynamic and friendly software-development company, capable of providing quick solutions for a variety of systems. Caapi Technologies was founded by Moris Oz, a skilled software developer with vast experience in various technologies, who leads all software projects. The company offer solutions for the many various stages of development, and services such as software development, web applications development and algorithmic trading solutions. Caapi Technologies's expertise spans the most common technologies such as C, C++, C#, .NET, Java, Jscript, PHP, ASP, VBscript, GWT, Flex, PHP, CSS, XML, Facebook SDK and more. They designed, programmed and delivered some very challenging and rewarding projects in the US and abroad
For more information see http://www.caapitech.com
Contact Moris Oz, Ph +972-9-8656875 email moris@caapitech.com
About ai-one inc., ai-one provides an “API for building learning machines”.  Based in San Diego, Zurich and Berlin, ai-one’s software technology is an adaptive holosemantic data space with semiotic capabilities (“biologically inspired intelligence”).  The Topic-Mapper™ SDK for text enables developers to create intelligent applications that deliver better sense-making capabilities for semantic discovery, lightweight ontologies, knowledge collaboration, sentiment analysis, artificial intelligence and data mining.
For more information see http://www.ai-one.com
Contact: Olin Hyde, Ph: 1-858-531-0674, email: oh@ai-one.com, web: www.ai-one.com

Wednesday, June 22, 2011

Troubleshoot - Android Platform Sooner Single ADB Interface error

When installing The Android ADB Interface drivers , There are situations where the system complain that the driver is not found , or the driver installation has failed. I was researching the web and found many solution , but neither of them really worked for me.
Anyway , This is my solution : 

1) Using a free tool called USBDeview you should first spot your ADB Interface driver (Using the USBDeview You can try uninstalling devices until you see in the DeviceManager that the ADB Interface is not there anymore) 
2) Now, unplug-plug your mobile device and spot the ADB Interface in the USBDeview,   look at the vid info of that interface , Over my place it looks like that :
Description =  Android Composite ADB Interface , Instance ID = USB\VID_1004&PID_618E_ADBInterface\6&34ef9180&5&0000 )
2) You need to download Google's android_usb_windows.zip package that contains the
driver.  Then unpack the zip file.
3) In the android USB windows folder ( C:\Program Files\Android\android-sdk\extras\google\usb_driver ) , edit the android_usb.inf file and add the specific Instance ID As followed :
"%CompositeAdbInterface%     = USB_Install, USB\{Your Vid Info}" 
Over my place the row Looks like that --> 
"%CompositeAdbInterface%     = USB_Install, USB\VID_1004&PID_618E&ADB.DeviceDescRelease%=androidusb.Dev, USB\VID_1004&PID_618E_ADBInterface"
4) Now , Try again to Update the ADB driver from the android USB folder, and make sure the ADB Interface driver has been installed without error in Device Manager.

If you still have problems , please let me know.

Good Luck.

Moris Oz
Caapi Technologies

Monday, June 13, 2011

Web Applications Development services

Hello All,

I'm pleased to announce the availability of Caapi Technlogies's new web applications development services. With all of the emails and questions we’ve been getting from our customers about providing custom web applications development services that are easier to use, attractive to look at, and serve the purpose of the clients, we’ve decided to start. So head on over to the Services page to get a full range of web site application development services, from requirements gathering and definition, through the delivery and deployment of web solutions. Our expertise spans the most common technology platforms such as Java, .NET, GWT, Flex, PHP, CSS , JS ,Facebook SDK etc., for building scalable, feature-rich Web applications. As part of our web development services we provide customized, secure and advanced Facebook Application development services. We build Facebook applications with unique, fresh concepts and stylish designs; and provide all the ongoing support needed thereafter.

Best Regards,

Moris Oz
Founder and CEO
Caapi Technologies

Sunday, May 22, 2011

MBTrading SDK/API review

This article reflects my experience developing an automated equity trading platforms using the MBTrading SDK/API. I have written this article as an individual, not representing the MBTrading in ANY way.

MB Trading's SDK/API is a fully Microsoft COM-compliant. It is dependent on Microsoft COM Objects and is suggested for use with VB, C,.C# and Excel.
MB Trading's support and high level technical folks are very helpful, but they could not resolve all of my technical issues, which been raised during development phase.
Here are some of the issues that I had to deal with :
1) The source code samples, provided by MB, shows how to pull one quote using the main thread , but there are some problems when pulling many quotes(with different symbols ) using the main thread. In order to solve it , I needed to work my way finding a creative multithreaded solutions .
2) When asking for historical data using the API , the document gives good specification on the various parameters , but when putting all things together in my own code , there was a need to play around with the parameters till the mechanism was really working.
3) A minor "minus", which was not a big concern for me , was that MB Trading's API "consumes" a login, and clients (by default) get only 1 login. This means , You just can't be logged into both of them with the same username( BTW , Forex traders are entitled to a free secondary login ID ).

Despite of the problems I've described above , My main impression is good. The very best advantage that MB Trading offers is their customer support and a  SDK site (http://sdk.mbtrading.com/)  with associated Yahoo! groups forum, and a very well documented API. You can check out the library of the code samples (VB6, VB.NET, C#.NET) ,which you can download in a zip file ( http://sdk.mbtrading.com/v.htm )
That should give you some examples of how to employ various approaches in your coding to use the objects in the SDK. The big plus for developers , is that MB provide a free demo , which is great to get your software developed and fine tuned. (Even though ,Demo logins may not see the current day for day bars, the current hour for min bars, or the current 20 mins for tick bars)

Moris oz
Algorithmic trading Consulting and development
www.caapitech.com