Automating buy/sell operations

Hi,
is it possible to automate buy/sell operations based on some criteria available on a google sheet or on the broker itself (Interactive Brokers in my case)
More specifically, using google sheet I monitor my two ETFs:
IWDA (stocks) 40%
DBZB (obligations) 60%

When the IWDA drops 7% (in a time frame of 6 months) I get notified by google sheets and move 16% of DBZB into IWDA.
When the market recovers I get notified by google sheets and I move it back.

Is there a way to automate this?
I realised that I might not be available to sell/buy when the threshold is crossed (despite google sheet will send me emails when the 7% threshold is breached) . For that reason, an automation could come handy.

Depends on your level of programming skills everything is possible. What might fit your needs would be TradingView they have integrations with many brokers however I’m not sure if they support complex buy/sells based on your rules.

1 Like

IBKR offers API’s, see here. I would probably look into the Client Portal API and use Python to use it. Word of caution tough - as a software engineer myself, I would be VERY CAUTIOUS with automating trading. Develop one serious bug in your code, and your capital is at stake. Think a bug in a loop, where you order hundrets of sell orders in a couple of seconds, or stuff like that. Hedge funds with a lot of smart people have done this in the past. So build in saftey mechanisms :wink:

2 Likes

I have only a basic knowledge about programming.
Thanks for underlining the risks involved.
Do you know if the automation (checks and executions) can be implemented within the broker portal itself without the need of an external computer which logs in every 10 minutes (for example) checks something (on Google?) and eventually executes the order?
I really have no idea about how this could work (high level).

Hi Patron,
thank for your feedback.
The risks has been already raised by the previous user and I have the impression that you are over complicating thins, considering that you don’t know the details about what I am trying to do.and what is my approach to do it.
I would like to know how this could work high level to understand is it is worth or not.

Beside that the credential is quite a hot topic. That’s why I am asking if the automation can run directly on the broker systems.

thanks again for the information.
I am also not happy to leave my credentials on those websites…so it seems there are not many option left, until the broker decides to allow some kind of automation internally. I will ask them as it seems quite a basic function. Perhaps one day they will add it if many users demands it.

They will refer you to the APIs that’s what they’re there for.

They will refer you to the APIs that’s what they’re there for.

The problem is that the thing running the API request is something external to their system domain.At least based on my understanding. They could just allow people to automate locally, within their account…that’s what I meant.