Is there any real time trading platform in linux in which one can test automated trading scripts written in python by ordering to a broker in a trial or demo account? Is IbPy the way to go? But IB does not offer any trial account.
closed as off-topic by Brythan, Dheer, keshlam, MD-Tech, NL - Apologize to Monica Feb 13 '17 at 15:06
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Questions seeking product or service recommendations are off-topic because they tend to become obsolete quickly. Instead, describe your situation and the specific problem you're trying to solve." – Brythan, Dheer, keshlam, MD-Tech, NL - Apologize to Monica
A couple options that I know of:
Interactive Brokers offers a "paper trading" mode to its account holders that allows you to start with a pretend stack of money and place simulated trades to test trading ideas. They also provide an API that allows you to interface with their platform programmatically for retrieving quotes, placing orders, and the such. As you noted, however, it's not free; you must hold a funded brokerage account in order to qualify for access to their platform. In order to maintain an account, there are minimums for required equity and monthly activity (measured in dollars that you spend on commissions), so you won't get access to their platform without having a decent amount of skin in the game.
IB's native API is Java-based; IbPy is an unofficial wrapper that makes the interface available in Python. I've not used IB at all myself, but I've heard good things about their API and its accessibility via IbPy.
Edit: IB now supports Python natively via their published API, so using IbPy is no longer needed, unless you wish to use Python 2.x. The officially supported API is based on Python 3.
TD Ameritrade also offers an API that is usable by its brokerage clients. They do not offer any such "paper trading" mode, so you would need to "execute" transactions based on quotes at the corresponding trade times and then keep track of your simulated account history yourself. The API supports quote retrieval, price history, and trade execution, among other functions. TDA might be more attractive than IB if you're looking for a low-cost link into market data, as I believe their minimum-equity levels are lower.
To get access, you'll need to sign up for an API developer account, which I believe requires an NDA. I don't believe there is an official Python implementation of the API, but if you're a capable Python writer, you shouldn't have trouble hooking up to the published interfaces.
Some caveats: as when doing any strategy backtesting, you'll want to be sure to be pessimistic when doing so, so your optimism doesn't make your trades look more successful than they would be in the real world. At a minimum, you'll want to ensure that your simulations transact at the posted bid/ask prices, not necessarily the last trade's price, as well as any commissions and fees associated with the trade. A more robust scheme would also take into account the depth of the order book (also known as level 2 quotes), which can cause additional slippage in the prices at which you buy/sell your security. An even more robust scheme would take into account the potential latency of trade execution, looking at all prices over some time period that covers the maximum expected latency and simulating the trade at the worst-possible price.
You can have a look at betabrokers. It's an simulated stock trading platform which is entirely email-based. You start with 10 000$ and you make transactions with commands in the subject line of the email (e.g. "buy 250$ AAPL" or "cover 20 shares of AAPL").
It should be straightforward to add an email interface to your python script.
I don't think any open source trading project is going to offer trial or demo accounts. In fact, I'm not clear on what you mean by this. Are you looking for some example data sets so you can see how your algorithm would perform historically? If you contact whatever specific brokers that you'd like to interface with, they can provide things like connection tests, etc., but no one is going to let you do live trades on a trial or demo basis.
For more information about setting this sort of thing up at home, here's a good link: < http://www.stat.cmu.edu/~abrock/algotrading/index.html >. It's not Python specific, but should give you a good idea of what to do.
In Japan, there's a competition well-lasting since 2004 or so where you can run your own software agent in a virtual market. Market data is updated from the real world everyday. And if your agent proves good, the organizer puts it into the real market.
The language is unfortunately limited to
Java only to my knowledge.
OS is not limited since your agent is supposed to run on the organizer's environment. English might not be well supported on their web site...