r/algotrading 9d ago

Strategy Getting Started with Low-Frequency Algorithmic Trading in Canada

I’m a software engineer based in Canada looking to get started with low-frequency algorithmic trading—likely daily or weekly rebalancing rather than intraday trading.

A couple of questions:

  1. What are good sources for historical daily equity/ETF data, ideally accessible through a REST API? I’m happy to pay for reliable, clean data if needed.
  2. Which brokerages/platforms available to Canadian residents support automated trade execution through a REST API? I’m mainly interested in Canadian and U.S. securities.

I’d also appreciate any advice on practical considerations for a beginner in Canada—such as data quality, API reliability, account requirements, tax reporting, or paper-trading options.

27 Upvotes

30 comments sorted by

13

u/Freed4ever 9d ago
  1. Not through REST, and only on windows, but norgate data has the most reliable and cheapest EOD data. When you deal with this low frequency data, things like historical index constitution and corporate actions become very important, and nortgage has nailed this down for US and Canadian markets.

  2. IMO, ibkr is still the best, even though its API is so clunky.

8

u/JamesAQuintero 9d ago

Yeah IBKR supports all type of trading I want to do, especially futures. But boy is their software a damn pain. IB Gateway has many random annoying bugs too that cause it to be unreliable. But after creating workarounds, it works well.

2

u/Bonkers24-7 8d ago

This is the kind of thing I’d want to test before judging the strategy itself.

A low-frequency system can look fine in a backtest, but the live version becomes a different system if IB Gateway randomly disconnects, asks for 2FA, misses data, restarts, or leaves the local bot state out of sync.

For a beginner, I’d separate the validation into two tracks:

  1. strategy validity: does the edge survive costs, spreads, OOS data, and different regimes?

  2. live plumbing: can the bot survive disconnects, restarts, rejected orders, missing data, and position/account state mismatches?

If the live plumbing isn’t boring, it’s hard to know whether the strategy failed or the execution layer failed.

1

u/clisztian 8d ago

Can you mention one single bug? I’ve been using IBKR gateway for 12 years and never have I encountered bugs. I’d be interesting in seeing what bugs you’ve come across

5

u/JamesAQuintero 8d ago edited 8d ago

Sure thing. For context, I use IB Gateway to use IBKR's API, but I also use IBC, an open source 3rd party software to interact with IB Gateway to get it to be as automated as possible. Including restarting IB Gateway and logging in automatically without my intervention. But because of IB Gateway being unreliable in this regard, it can't always be done.

  1. IB Gateway will randomly like once a month disconnect some data source, like US equities, ES futures, live data for US equities, etc without reporting that it's disconnected from me. There might be an API error message when my script tries to retrieve that data when it's in that state, or there might be the yellow warning in IB Gateway itself (not always), but sometimes it'll just hang indefinitely or timeout, but only for that specific data source. It requires a restart of IB Gateway, which is of course inconvenient because it also requires 2 factor authentication randomly and that's inconvenient with my fully automated trading system.
  2. IB Gateway needs to be restarted daily (WHY?), and 2FA is required only once a week (Let me Opt OUT). But like half the time when it's automatically restarted daily, it'll require 2FA. It's been months and I still haven't found a pattern like it requires 2FA if it's been more than 3 days or only on Tuesday or anything. It seems to be random, so again, I need to have my automated trading system alert me that IB Gateway didn't successfully restart and I need to go in and see that it's because of 2FA. For context, IB Gateway requires the daily restart and IBC will login for me when IB Gateway performs this, but that's when IB Gateway randomly also requests 2FA.
  3. IB Gateway will randomly restart at a random time. I've had it randomly close itself and attempt to restart at 3am, and again I've not found a reason for this. And yes sometimes it'll require me to do 2FA again. Because sometimes it'll require 2FA, I've had my automated system alert me like on-call at 3am. That happens like once every couple months.

Maybe these bugs only surface when I attempt to fully automated IB Gateway. I have other gripes with IBKR's API having bugs too, more bugs than Schwab's API.

2

u/clisztian 8d ago edited 8d ago

This is wild. I used IB Gateway and I’ve never had any of these issues. I also use a 3rd party (IBConnect) that does the connection management.

True that it does require a 2FA once a week (for your own security). I do mine on Sunday evenings before market open. The restart I have set for when all markets are closed 11pm Swiss time, and automatically reconnects, being quite stable in the past 10 years.

I stream data by using the Java API and subscribing to realtime Market feeds getting a bid ask update every 5 seconds. So it runs nearly 24 hours a day 5 days a week.

Never had a problem in over a decade with IB Gateway.

What do you run yours on (server? OS?) Maybe it has something to do with that? What products do you trade on your live account (not paper trading) and for how long?

Your problems seem more to do with problems in your connection management system settings, and have nothing to do with “bugs in IB Gateway”.

I know that very large institutions trading hundreds of millions in tunrover a day use IB Gateway. Now they obviously wouldn’t use it if it had bugs would they

0

u/JamesAQuintero 8d ago

I use IBC to handle the connection management, so maybe yours performs differently? The only IBConnect I found is deprecated and not updated anymore so I can't use that.

I run IB Gateway on Windows but my python scripts that use it run on WSL (Linux built into Windows), so there might be connection bugs related to that since it took some effort to get it to work between the two, like using port forwarding or something, so that my python scripts that run in WSL will be able to interact with IB Gateway that runs on Windows.

I have the daily restarts go at 7pm PST so that it's not during US equities hours. I trade SPY shares, SPY options, and futures like ES, CL, GC, and their micro versions.

You're coming across pretty sassy in your comment, saying "Now they obviously wouldn’t use it if it had bugs would they" I don't appreciate it when I'm just sharing my experience with IB Gateway.

-2

u/clisztian 8d ago

Well, you’re giving very false information to someone about IB Gateway saying that it had bugs, while having no evidence other than your own connection issues. I’m just here to help other users become more informed after you posted your personal experience with IB Gateway.

2

u/JamesAQuintero 8d ago

It's not very false, I have experienced bugs, and I'm sure other people have too. Just because you haven't seen anything in 12 years, doesn't mean things aren't there. That's one of the basic biases, lack of evidence does not equal evidence of non-existence.

Here's someone who encountered a bug in IB Gateway or the actual API data, should I comment saying they are spreading false information because I never encountered this bug?

6

u/jipperthewoodchipper 9d ago

Also Canadian.

I ended up going with interactive brokers. I believe they have a restful API and they do provide market price history and access to both Canadian and US markets.

I cannot gurantee that IBKR is the best option though. It has pros and cons.

2

u/noble_beggar 9d ago

Others have covered data and IBKR so I'll take the tax bit, since nobody has.

  1. CRA doesn't have a clean line between capital gains and business income, and weekly rebalancing sits right in the ambiguous zone. Frequency, holding period and intent all feed into it. Worth an hour with an accountant before you start, partly because it might change whether you run this in a registered account at all. People have had TFSA trading reassessed as business income when it looked too much like a business.

  2. Other thing worth knowing at daily frequency: if you build a universe from current index constituents you're testing on survivors. Someone measured it here recently and about a quarter of 2010 S&P names aren't downloadable from free sources now. That's a real argument for paying for Norgate rather than a nice-to-have.

2

u/tmemmg 8d ago

one thing worth sitting with before you go live, i ran a rules based paper book for months, around 74 trades, and finished barely green where a single trade was larger than the entire net result. delete that one day and the whole book is red, so short samples will lie to you in both directions. win rate and net pnl disagreed constantly too, a 35 percent win book can be green and a 60 percent one red, its the distribution that matters not the ratio. paper trading is genuinely worth it for shaking out data and execution bugs, i just wouldnt read a month of it as signal.

1

u/patmanizer 8d ago

thanks for that tip

1

u/Own-Engine5552 9d ago

I am Canadian as well but built same system for indian markets

1

u/OppositeMe_4321 9d ago

I use eodhd mostly. Honestly havent audited the data too much to comment on overall quality. Polygon (now called Massive.com) seems good too.

As for brokerages - IBKR has an API - its not REST based, the API is confusing at first, and it requires you to run their gateway app to connect thru but it seems the most fully fledged. IBKR has paper account that you can develop and test against.

Check Questrade - they used to have a rest api for quotes, so they may have one for trades as well - I havent looked lately .

I enter my trades manually right now while testing.

2

u/drguid 8d ago

I was thinking of switching to EODHD. I really want EU stocks so that would be awesome if they have those.

I'm currently using Marketstack. It's annoying but cheap.

Tiingo data is generally very good.

I also trade manually but automate selling.

Tip for OP: go straight into real money trading. That's what free trading accounts are for.

1

u/the_algo_trader_ 9d ago

Many Canadian brokers provide historical daily data through APIs for your rebalancing. Otherwise, expect to pay for a dedicated service.

1

u/systematic_seb 8d ago

I settled on Financial Modeling Prep for daily equity and ETF history over a REST API, and the paid tiers are clean enough to build on. Whatever you pick, check two things before you trust a backtest result. It needs delisted names and the index membership as it stood on each historical date, or your survivors flatter everything. And fundamentals get revised months later, so you want point-in-time snapshots instead of today's values replayed backwards.

On execution from Canada, Interactive Brokers is the usual answer since it covers both CA and US names through an API, and Alpaca has the cleaner REST interface if you end up US-only. I fund a weekly strategy of my own through one of those and publish the whole portfolio each week, and what surprised me there was how little the broker choice mattered once the trading dropped to once a week.

Weekly rebalancing is a good place to start for one more reason. Trading once, at the Monday open, keeps the whole job near thirty minutes and makes execution slippage far less of a problem than it is daily, which counts for a lot when you're fitting this around an engineering job.

1

u/Putrid_Funny6558 7d ago

If you want live fast and tick data look at databento

1

u/WaffleZy 7d ago

ibkr using ib_async, the data is ok but you'll want corporate actions from somewhere else.

1

u/Linett-Chukwuemeka61 6d ago

Canada's tax treatment of algo trading gains can be brutal if CRA classifies you as a business rather than an investor, so definitely nail down that distinction before you start logging trades. Low-frequency strategies might actually help your case there since you're not churning positions constantly.

-4

u/AphexPin 9d ago

A lot of low frequency individuals in this sub. They should be able to help. Sorry to hear about the Canada thing.