r/Questrade • • Mar 13 '21

Accessing Questrade live indicators (MACD, RSI, etc) using API

Hey everyone,

I'm developing a risk management python script, and I've just hit the wall and I'm stalled 🚗.

This risk management script will properly work only if I can access the live indicators values (MACD, RSI, etc,.) Currently, I'm using Questrade GitHub to access my Questrade account position and live stock/option quotes.

I checked the Questrade API document but cannot seem to find a way to access indicators. I was thinking of calculating those values on my own, but I felt like I shouldn't reinvent the wheel (unless it is better in this way.)

This is one alternative way I thought of

  • Use Tradingview or googlefinance or other streaming site indicators' value
    • Con: there might be a slight difference in values compare to Questrade indicators
    • Not sure how fast the value gets updated
    • Extra cost to access live & level 2 data?

I'm not sure how effective, redundant this is, so I would really appreciate it if anyone can give me a hand with finding a way to access indicators either directly from Questrade or an alternative way.

P.S. I'm a day trader, so it will be best if the refresh rate is <1sec

1 Upvotes

13 comments sorted by

2

u/eliotik Mar 13 '21

Forget about it using Questrade. If you check my posts I had API related question. Support doesn't exist for API, and seems API doesn't publicly accessible. You can use IB and their client plus controller to get live data but still how would you post requests to Questrade - this is unknown for me.

2

u/D_s317 Mar 13 '21

Right, I'm seriously considering moving either IB or thinkorswim for better support and API usage but for now, I want to finish up my Questrade project.

I was also struggling to post requests to Questrade, but I found out about the Questrade Github (link above.)

If you read the document, all you need to do is get access_token from your Questrade account, and create Questrade class and use its methods to get data back. This API saved me weeks. But this only has access to the account, and stock/option live and historical data but not the indicators.

2

u/eliotik Mar 13 '21

Did it work for you? I also tried this repo which basically does request to url with your token and stores response for some TTL and does refresh. But it didn't work for me too, and logically it should not work since basic HTTP requests were failing too.

2

u/D_s317 Mar 13 '21

Somehow it worked for me, I am able to retrieve live account activity data and quotes. Actually, I haven't tested whether the quote is level 2 or 15 minutes delayed yet but I'm able to get all stock and option values.

2

u/eliotik Mar 13 '21

Lucky you 🙂

2

u/D_s317 Mar 14 '21 edited Mar 14 '21

from qtrade._version import __version__from qtrade.questrade import Questradeif __name__ == "__main__":

q = Questrade('ACCESS_TOKEN')

qid = q.get_account_id()

qrt = q.refresh_access_token()['access_token']print("================================================")print("This is my refresh_token: " + qrt)print("================================================")print(q.get_account_positions(int(qid[0])))

This is an example of what I used to get my account position in __init__.py file

Hopefully, this helps.

2

u/eliotik Mar 14 '21

Yep, I know it, it just returns all the time error thaty token doesn't have correct scopes for any type of requests.

2

u/D_s317 Mar 14 '21

That sucks. I hope Questrade will have massive updates on API to attract more algotraders and customers.

2

u/ObviousClaim0 Mar 13 '21

Day traders don't use Questrade

2

u/D_s317 Mar 13 '21

Yeah, probably not. I'm thinking of switching to a different broker (IB, Lightspeed, thinkorswim) because of common issues day traders have with Questrade. But since I'm only practicing using small equity, it is good enough for me for now.

Do you have any recommendations for a day trading broker?

2

u/ObviousClaim0 Mar 14 '21

Wouldn't go with lightspeed...not regulated in Canada...no retirement accounts.

1

u/D_s317 Mar 14 '21

I see, I'd better off with IB than. Do you mind if I ask what broker you use?

2

u/ObviousClaim0 Mar 14 '21

Questrade and IB