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.

  • 4
    People's answers are naming specific service providers (businesses), which is what the OP is asking for. They're good answers. It is not a question about programming (i.e. about his software), but about (real-world) businesses. It would be off-topic on a programmer's forum: too 'domain-specific' (the domain in this case being finance/trading), and not even about the software.
    – ChrisW
    Feb 23, 2012 at 4:32
  • This topic was closed in a programmers forum stating it was out of topic. I heard that Marketcetera is a python program which allows to connect to any broker supporting FIX protocol although don't know which brokers do that.
    – pappu
    Feb 23, 2012 at 9:29
  • 1
    This is a general question on a narrow topic. The only justification to close the question is if you assume that trading cannot be a personal finance activity. All you need to do is watch a single commercial segment on CNBC to see that good or bad, trading platforms for individual investors are a real thing. Feb 24, 2012 at 16:17
  • Product and service recommendations are considered off topic almost everywhere on Stack Exchange, because they rapidly become outdated and thus don't fit the qoal of a crowdsourced FAQ. Our scope has become better defined since 2012, and by today's standards this would probably be voted closed.
    – keshlam
    Feb 12, 2017 at 4:03

4 Answers 4


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.

  • The paper trading account at Interactive Brokers does not necessarily require you to have a minimum monthly turnover, if you do not have the minimum you simply pay an inactivity fee (interactivebrokers.com/en/index.php?f=4969) and your market data subscriptions, which i personally think is a good deal for what the paper trading account has to offer.
    – Waldfee
    Jan 17, 2013 at 16:05
  • It's also worth pointing out that even though TD Ameritrade doesn't state this on their site, if you ask for access to the API and don't have $25,000 in your account, your request will be rejected. (I know this from personal experience). Apr 15, 2013 at 13:49
  • As an individual doing automated trading myself, I've been trading and continuously researching brokers' API offerings for quite some time, and Interactive Brokers is the only choice that makes sense for me - at times I've actually wanted to switch but there's really nobody else that can replace them. Their commissions are dirt cheap, they support more markets globally than anybody else in the retail space, and they have a free and quite usable API. I mostly use ibPy and it works perfectly, although it's not actively updated so sometimes new features are not available. Aug 3, 2015 at 5:29

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...

Not the answer you're looking for? Browse other questions tagged .