market or exchange, without the need for human intervention. The simplest of bots could be a curl
POST to an OANDA REST API, such as
1 $curl -X POST -d "instrument=EUR_USD&units=2&side=sell&type=market" "https://api-
which can be set up on a UNIX cron
to run every hour, during trading hours. It has no strategy, nor
any external interface or dependencies. It is a one-liner to place an order, which has an equal
probability to be in profit or in loss.
On the other end of the spectrum, it could be a complex program based on a distributed architecture,
consuming lots of feeds from various sources, analyzing them in realtime and then placing an order.
It will be highly available with extremely low latency.
The scale and scope of the bot, as we can see, is varied. To be effective, the bot should be able to
accomplish the following tasks:
Consume market data and/or external news events and social media feeds and distribute them to
interested components within the system.
Have at least one strategy that provides a trading signal.
Based on a trading signal, place orders with the brokerage platform.
Account management, i.e., have the ability to keep track of margin requirements, leverage, PNL,
amount remaining, etc., in order to curb trading if the amount available breaches a given
Position management, i.e., keep track of all currently active positions of various instruments,
units of such positions, average price, etc.
Have the ability to handle events which are triggered by the brokerage platform such as
ORDER_FILLED , STOP_LOSS , etc., and if required take appropriate decisions for such events.
Some basic monitoring and alerting.
Some basic risk management. For example, loss limitation by using stop losses for orders or
making sure that risk is distributed between risky and safe haven instruments. These are just
examples and by no means a comprehensive list of fully managing the risk.