Book Image

Getting Started with Forex Trading Using Python

By : Alex Krishtop
Book Image

Getting Started with Forex Trading Using Python

By: Alex Krishtop

Overview of this book

Algorithm-based trading is a popular choice for Python programmers due to its apparent simplicity. However, very few traders get the results they want, partly because they aren’t able to capture the complexity of the factors that influence the market. Getting Started with Forex Trading Using Python helps you understand the market and build an application that reaps desirable results. The book is a comprehensive guide to everything that is market-related: data, orders, trading venues, and risk. From the programming side, you’ll learn the general architecture of trading applications, systemic risk management, de-facto industry standards such as FIX protocol, and practical examples of using simple Python codes. You’ll gain an understanding of how to connect to data sources and brokers, implement trading logic, and perform realistic tests. Throughout the book, you’ll be encouraged to further study the intricacies of algo trading with the help of code snippets. By the end of this book, you’ll have a deep understanding of the fx market from the perspective of a professional trader. You’ll learn to retrieve market data, clean it, filter it, compress it into various formats, apply trading logic, emulate the execution of orders, and test the trading app before trading live.
Table of Contents (21 chapters)
1
Part 1: Introduction to FX Trading Strategy Development
5
Part 2: General Architecture of a Trading Application and A Detailed Study of Its Components
11
Part 3: Orders, Trading Strategies, and Their Performance
15
Part 4: Strategies, Performance Analysis, and Vistas

Automated trading – operational risk and regulatory limitations

Operational risk is the risk of direct or indirect loss resulting from inadequate or failed internal procedures, people, and systems, or from external events (Bank for International Settlements, Basel Committee on Banking Supervision, Operational Risk Supporting Documentation to the New Basel Capital Accord (Basel: BIS, 2002), p. 2, https://www.bis.org/publ/bcbsca07.pdf).

Since, in this book, we will talk mostly about developing trading algos with Python and not about running a trading business, the main operational risk in this context could be that you don’t follow your own strategy or intervene in the algorithmic trading process discretionarily.

Another risk that may be considered operational (although it is normally considered as money management) is the improper use of leverage. In essence, leverage is a credit line provided by the broker that allows you to buy more than you have in your account. If the leverage is too high, you are at risk of being unable to enter the market, or in certain cases, even worse – liquidating your positions that are rapidly losing money.

Broker risk can also be attributed to operational risks as the broker is the very entity that provides you with access to the market, gives you a credit line to open positions, and does the clearing and settlement. Some brokers also act as market makers for their clients, netting their positions internally and acting as the counterparty for their own clients, which may lead to a conflict of interest, and even worse – loss of money if the broker didn’t have sufficient capital to perform these operations.

Last, but not least, we should note that algorithmic and/or automated trading may be fully or partially prohibited in certain jurisdictions. So always check with the respective market regulators to make sure you can run your algo trading at all.

Key takeaways

Always perform a background check of all counterparties, especially your broker. Be careful with leverage and check local regulatory documents on algo trading.

Enough on operational risk – at least for a quick start – and let’s move on to another kind of risk that is common for any trading activity but becomes particularly problematic for algo trading: the risk of basing trading decisions on incorrect market data.