Hello,
I would like to share my experiences working with different broker APIs.
HotspotFX
This is my favorite broker. They offer a Java based API.
First you sign an API agreement, then they send you the API
in a .jar file and the documentation. The documentation is very good.
When they set the API up for you, they give you access to a 'Live Demo'
account called the HSFXUAT environment. This is similar to the
Interactive Brokers 'Simulated Trading' account.
I found the API easy to work with.
Java is not a language that I use on a daily basis, but even with my limited
Java experience, I had no trouble implementing my strategies.
The only thing that I missed was a price history server.
If you are programming indicator based trading systems, then you will
have to collect the history yourself, or wait until you have sufficient data
for the indicators to be effective.
The best thing about HotspotFX is the speed of execution.
It's instantaneous. There is no 1-2 second delay common with other brokers.
You can place bids/offers, or use a 'fill or cancel' type market order.
The great thing about the fill or cancel order is that there is no slippage.
You are either filled at the price you want, or your order is canceled.
The other thing that you should be aware of is that because they use the
ECN business model, they group all currency positions together.
There is no hedging on the same account.
So if you buy 1 Lot GBPUSD and sold 2 Lots GBPUSD, you will have a
combined position of 1 Lot Short GBPUSD.
If you want to seperate the positions, you have to do it in code.
Each trade has a unique TradeID which has data associated with that
trade such as entry price, size etc.....
1 Lot on their system is 1mil (1,000,000) of the base currency.
The minimum trade size is 0.1 lots (100,000) of the base currency.
Leverage is 50:1 and min account size is $7.5k
Commissions are $30/1mil traded.
They do not charge for the API.
It took me about 6 weeks to get my complicated strategy integrated
with HotspotFX. But this would have been faster if I was more familiar
with Java.
I highly recommend this broker and their API for implementing existing
successful strategies. Do not attempt to use this API for prototyping.
Metatrader 4
Speaking of prototyping, Metatrader 4 provides the best API like access
for creating and testing strategies quickly.
The metatrader 4 language, MQL4, is based on the C programming language syntax.
The language is flexible enough to quickly prototype ideas in a short space of time.
MQL4 can use standard Win32 DLLs which allows the programmer the flexibility to
extend the features of the language.
I had a project where I needed to have external real-time access to the MT4 quotes.
DDE was too slow and cumbersome and couldn't be used with multiple data
feeds without resorting to hacking.
By using a DLL, I was able to export the variables containing BID/ASK quotes
to a DLL function call, which then wrote the variables memory address to a
text file. A third party program, read the memory address from the text file
and scanned the memory address every 250ms to get the latest BID/ASK quotes from MT4.
This would not be possible without using a DLL.
Using the same technique, I was able to establish two way communication
between MT4 and the custom external application.
If you can develop an successful strategy in MT4, the next step would be
to convert it over to an ECN broker API.
MBTrading/EFX
The MBTrading API is contained withing several ActiveX controls.
The API is accessable from any programming language that supports the COM object model.
You can either use the existing visual components that when combined, make
up the MBTrading trading platform, or you can access everything via code.
I chose the 'access everything via code' route. This gave me more control over
the layout and functionality of the project.
The programming was straight forward. Documentation is good.
The only problems I had were the frequent disconnects from the servers.
They have three different servers which need to be active for everything
to run smoothly.
If you are going to use them for live trading via the API, you will need to have
a strategy in place to monitor the slippage.
I didn't continue live trading with them because of this issue.
People have suggested using a 'marketable limit order', but my strategy at the time
required a quick fill at the specified price.
Interactive Brokers
IB has many ways to connect with their brokerage services.
I chose the TWS.ocx ActiveX control.
The IB API is very similar to the MBTrading/EFX API.
It has a good range of features, and works quite well.
The only problem (which was a major one) that I experienced with
IB, was that the quotes streaming through were sometimes not
matching the true market BID/ASK. I'm not talking 1-2pips difference,
it was more like 10-15pips difference between the quote and the
actual market price that I was filled at.
To get around this issue, I had to use an EFX demo account
to stream prices into the external software to compare against
the IB's prices. If noticed a difference of more than 2 pips, I would
not place the trade.
The other thing that I found with the IB API, is that when ever
a new version is released, I run into problems.
You will really need to test any new releases before
deploying them into a live environment.
This is where I would like to end up because of the cheap trading,
but I'm not confident in the quotes, slippage or service to deploy
too heavily with this broker via their API.
Oanda
I haven't used the Oanda API yet, mainly because of the excessive
$600/month charge.
The charge is reduced by $50/each 1 million traded.
I'm doing enough volume to get the API for free, but its cheaper
to trade at HotspotFX, and there is no real gain to be
made by my changing over.
Coder
I would like to share my experiences working with different broker APIs.
HotspotFX
This is my favorite broker. They offer a Java based API.
First you sign an API agreement, then they send you the API
in a .jar file and the documentation. The documentation is very good.
When they set the API up for you, they give you access to a 'Live Demo'
account called the HSFXUAT environment. This is similar to the
Interactive Brokers 'Simulated Trading' account.
I found the API easy to work with.
Java is not a language that I use on a daily basis, but even with my limited
Java experience, I had no trouble implementing my strategies.
The only thing that I missed was a price history server.
If you are programming indicator based trading systems, then you will
have to collect the history yourself, or wait until you have sufficient data
for the indicators to be effective.
The best thing about HotspotFX is the speed of execution.
It's instantaneous. There is no 1-2 second delay common with other brokers.
You can place bids/offers, or use a 'fill or cancel' type market order.
The great thing about the fill or cancel order is that there is no slippage.
You are either filled at the price you want, or your order is canceled.
The other thing that you should be aware of is that because they use the
ECN business model, they group all currency positions together.
There is no hedging on the same account.
So if you buy 1 Lot GBPUSD and sold 2 Lots GBPUSD, you will have a
combined position of 1 Lot Short GBPUSD.
If you want to seperate the positions, you have to do it in code.
Each trade has a unique TradeID which has data associated with that
trade such as entry price, size etc.....
1 Lot on their system is 1mil (1,000,000) of the base currency.
The minimum trade size is 0.1 lots (100,000) of the base currency.
Leverage is 50:1 and min account size is $7.5k
Commissions are $30/1mil traded.
They do not charge for the API.
It took me about 6 weeks to get my complicated strategy integrated
with HotspotFX. But this would have been faster if I was more familiar
with Java.
I highly recommend this broker and their API for implementing existing
successful strategies. Do not attempt to use this API for prototyping.
Metatrader 4
Speaking of prototyping, Metatrader 4 provides the best API like access
for creating and testing strategies quickly.
The metatrader 4 language, MQL4, is based on the C programming language syntax.
The language is flexible enough to quickly prototype ideas in a short space of time.
MQL4 can use standard Win32 DLLs which allows the programmer the flexibility to
extend the features of the language.
I had a project where I needed to have external real-time access to the MT4 quotes.
DDE was too slow and cumbersome and couldn't be used with multiple data
feeds without resorting to hacking.
By using a DLL, I was able to export the variables containing BID/ASK quotes
to a DLL function call, which then wrote the variables memory address to a
text file. A third party program, read the memory address from the text file
and scanned the memory address every 250ms to get the latest BID/ASK quotes from MT4.
This would not be possible without using a DLL.
Using the same technique, I was able to establish two way communication
between MT4 and the custom external application.
If you can develop an successful strategy in MT4, the next step would be
to convert it over to an ECN broker API.
MBTrading/EFX
The MBTrading API is contained withing several ActiveX controls.
The API is accessable from any programming language that supports the COM object model.
You can either use the existing visual components that when combined, make
up the MBTrading trading platform, or you can access everything via code.
I chose the 'access everything via code' route. This gave me more control over
the layout and functionality of the project.
The programming was straight forward. Documentation is good.
The only problems I had were the frequent disconnects from the servers.
They have three different servers which need to be active for everything
to run smoothly.
If you are going to use them for live trading via the API, you will need to have
a strategy in place to monitor the slippage.
I didn't continue live trading with them because of this issue.
People have suggested using a 'marketable limit order', but my strategy at the time
required a quick fill at the specified price.
Interactive Brokers
IB has many ways to connect with their brokerage services.
I chose the TWS.ocx ActiveX control.
The IB API is very similar to the MBTrading/EFX API.
It has a good range of features, and works quite well.
The only problem (which was a major one) that I experienced with
IB, was that the quotes streaming through were sometimes not
matching the true market BID/ASK. I'm not talking 1-2pips difference,
it was more like 10-15pips difference between the quote and the
actual market price that I was filled at.
To get around this issue, I had to use an EFX demo account
to stream prices into the external software to compare against
the IB's prices. If noticed a difference of more than 2 pips, I would
not place the trade.
The other thing that I found with the IB API, is that when ever
a new version is released, I run into problems.
You will really need to test any new releases before
deploying them into a live environment.
This is where I would like to end up because of the cheap trading,
but I'm not confident in the quotes, slippage or service to deploy
too heavily with this broker via their API.
Oanda
I haven't used the Oanda API yet, mainly because of the excessive
$600/month charge.
The charge is reduced by $50/each 1 million traded.
I'm doing enough volume to get the API for free, but its cheaper
to trade at HotspotFX, and there is no real gain to be
made by my changing over.
Coder