English | MP4 | AVC 1280×720 | AAC 44KHz 2ch | 317 lectures (31h 13m ) | 9.79 GB
Develop robust systems for trading, backtesting, web scraping and web application development.
Whilst fun, Forex trading is not easy! To be successful today, you must have the ability to test strategies, automate trading and access information.
Whether it’s as a hobby or professional, this course will give you the foundation upon which you will be able to:
- Build a live trading bot
- Create a fast, accurate strategy testing system
- Retrieve live headlines, sentiments, technicals and more from the web.
- Use databases to store and correlate data with market moves
- Build a web application showing the latest prices, sentiments and other market data
- Learn full stack development, using MongoDB, Python and JavaScript (with React)
We will start by learning to use Python to access the Oanda REST API. Next, we’ll download a few thousand candles and develop a simple strategy back test, testing multiple parameters and currency pairs at once. We’ll use the results from this back test to learn how to automate the export of results into a spreadsheet format with tables and graphs.
Once the simple strategy has been tested, we’ll get hold of a lot more data – six years’ worth for multiple time frames. We’ll rerun our simple strategy, and then move on to implementing candle pattern detection and indicator calculation. We will also look at using multi-processing to speed up the testing even more.
Now we have some more knowledge, it’s time to create a more comprehensive back testing system – with spread and breaking candles down into finer time frames. For testing we will choose two strategies with over a million views on YouTube and assess whether they really give the claimed 90% win rate…
It’s now time to move on to the big moment – the live trading bot. We will develop a robust trading bot that trades multiple pairs with comprehensive logging. We will structure the code such that it is easy to swap in and out strategies.
Now it’s time to get more advanced and learn how stream prices live – using multi-threading with events and work queues to react to prices and make decisions
We will learn how to use Web Scraping with Python to access live sentiments, technicals, headlines and economic data. Alongside this, we’ll create a MongoDB database to store our data.
Next up: React! We will use the famous framework to develop ourselves a web application that can access live prices, our sentiment data and much more.
Finally, we will deploy our trading bot on a cloud service.
The course includes a quick-start appendix for Python and for HTML/CSS/JavaScript.
What you’ll learn
- Build a robust live 24/7 trading bot with Python
- Learn to use Python and multi-threading to stream live prices
- Leverage multi-threading, events and work queues to make trading decisions
- Build a comprehensive strategy back testing system that tests thousands of trades a second
- Learn how to integrate spread and fine grain prices into your strategy testing for accurate results
- Archive historical data and back test multiple instruments over a six+ year period
- Learn data science techniques with Jupyter Notebooks and Pandas to analyse your results
- Automate spreadsheet creation with tables and charts for further analysis
- Have some fun evaluating popular YouTube strategies with promised 90% win rates
- Learn to identify single, dual and multi-candle patterns
- Learn to develop indicators such as MACD, RSI and Keltner Channels
- Use Python to scrape the web for information to help build your strategies
- Use web scraping to get live economic calendar data, headlines and sentiments
- Create and interact with MongoDB to store information
- Build a full featured React web application to display technicals, sentiments, headlines, prices and your bot status
- Create a Flask API backend with endpoints to access technicals, sentiments, headlines, prices.. etc.
- Deploy your bot to a cloud service
- Learn to implement comprehensive logging
Table of Contents
Introduction
1 What does intermediate mean
2 What is the aim of this course
Account Setup & Forex Trading Introduction
3 Oanda account setup and API access
4 How forex trading works part one
5 How forex trading works part 2
Environment Setup
6 Overview
7 Python installation
8 What are Python virtual environments
9 Python virtual environments on Windows
10 Python virtual environments on Linux Mac OS
11 The pip upgrade warning
12 Visual Studio Code and extensions
13 Postman
The Oanda API
14 Introduction
15 Oanda API documentation and authorization
16 Accounts endpoint
17 Account summary endpoint
18 Account instruments endpoint
19 Instrument Candles Endpoint
20 Pricing endpoint
Initial exploration with Python
21 Introduction
22 Jupyter Notebook setup
23 Our first request
24 The instruments API
25 Fetching candles #1
26 Fetching candles #2
27 Fetching candles #3
28 Fetching candles #4 – saving data to file
29 Fetching candles #5 – saving multiple instruments
30 The OandaApi class
31 Making a request from the OandaApi class
32 Making a request from the OandaApi class #2
33 Instrument class
34 Instrument collection class
35 Instrument collection class #2
The Moving Average Cross Strategy
36 Introduction
37 Plotting a candlestick chart with Plotly
38 Styling the candlestick chart
39 Creating a plotting class
40 Strategy introduction
41 The moving average cross
42 Calculating a moving average
43 Plotting a moving average
44 Plotting multiple moving averages
45 Calculating the deltas
46 Detecting Trades
47 Pandas and groupby
48 Evaluating gains (or losses)
49 Plotting gains over time
50 Moving into a script
51 Loading price data
52 Applying crosses
53 Calculating results for multiple instruments
54 The Result class
55 Creating results
56 Converting results to Dataframes
57 Combining all results together
58 Saving the results #1
59 Saving the results #2
60 Loading back test results
61 Do we have a winner
62 Finding the best cross
63 How good is our chosen cross
Automating Spreadsheets
64 Introduction
65 xlsxwriter changes
66 Preparing the xlsxwriter code
67 Saving results to xlsx
68 Exporting the cumulative gains
69 Charting the cumulative gains
70 Summary
Collecting (much) more data
71 Introduction
72 Fetching candles from the OandaApi class
73 Loading candle DataFrames from the OandaApi class
74 Collection function definitions
75 Collection entry function
76 Date ranges
77 Running the data fetch from the API
78 Collecting a lot of data
79 Checking the collected data
80 Re-run of the moving avg. cross with six years of data
Calculating trading indicators
81 Introduction
82 Bollinger bands introduction
83 Bollinger bands calculation
84 Average True Range
85 Keltner Channels
86 Relative Strength Index (RSI)
87 Moving Average Convergence Divergence (MACD)
Identifying candle patterns
88 Introduction
89 Candle characteristics
90 Coding candle characteristics #1
91 Upcoming Code – a small (one letter!) bug
92 Coding candle characteristics #2
93 Coding candle characteristics – as a script
94 Hanging man hammer
95 Inverted hammer
96 Spinning top
97 Marubozu
98 Engulfing candles
99 Tweezer top
100 Tweezer bottom
101 Morning Evening star
102 Candle patterns script
Advanced back-testing – are the trading gurus right with 90% win rates
103 Introduction
104 Guru Strategy 1 – RSI EMA and the promise of an 85% win rate
105 Guru Strategy 1 – Adding the RSI
106 Guru Strategy 1 – Adding EMA and Patterns
107 Guru Strategy 1 – Trade signals
108 Guru Strategy 1 – SL and TP levels
109 Guru Strategy 1 – Plotting the trades
110 Guru Strategy 1 – Simulation Trade class
111 Guru Strategy 1 – Trade class logic
112 Guru Strategy 1 – First simulation results
113 Guru Strategy 1 – Inspecting the results
114 Guru Strategy 1 – Syncing M5 and H1 candles
115 Guru Strategy 1 – Merging M5 and H1 candles
116 Guru Strategy 1 – M5 simulation results
117 Guru Strategy 1 – H1 simulation results with spread
118 Guru Strategy 1 – M5 simulation results with spread
119 Guru Strategy 1 – Testing Class
120 Guru Strategy 2 – MACD and EMA100, and a claimed 90% win rate
121 Guru Strategy 2 – Detecting signals
122 Guru Strategy 2 – Simulation results
123 Guru Strategy 2 – testing multiple parameters
124 Note for the next video
125 A subtle, misleading error… always check the data!
126 Multiprocessing vs Multithreading
127 Multiprocessing example
128 Multiprocessing batches of instruments
129 Simulation run with Multiprocessing
130 Performance
131 Summary
Making a live trading bot
132 Introduction
133 Order endpoint introduction
134 Order endpoint details
135 Order endpoint placing trades
136 Order endpoint placing stop order and take profit
137 Order endpoint details, get open trades
138 Order endpoint details, get a single trade and close a trade
139 Placing a buy trade from code
140 Placing a sell trade from code
141 Placing a stop loss and take profit from code
142 Close a trade from code
143 Fetching open trades from code
144 Trading bot logic outline
145 Setting up logging
146 Setting up error and main logging
147 Setting up the bot trading settings
148 Get most recent completed candle
149 Candle timing class
150 Candle manager class
151 Detecting new candles
152 Getting a trade decision
153 Logging new candle DataFrames
154 Preparing the indicator
155 Detecting trades
156 Adding stop loss and take profit
157 Trade Decision Class
158 Detecting IF we can trade
159 Placing trades
160 The bot is up and running!
161 Getting the live price for units calculation
162 Setting the risk
163 Calculating the units
164 Trading with calculated units
165 Conversion factors endpoint
Streaming Live Prices
166 Introduction
167 Streaming API
168 Streaming Prices
169 Live Price Class
170 Threads, Locks and Events
171 Creating a thread
172 Thread quirks with Windows vs LinuxMacOS
173 Stream price thread
174 Live API Price
175 Acquiring Locks
176 Updating Shared Prices
177 Firing events
178 Base thread class for streaming
179 Price Processing Class
180 Queues
181 Worker Class and a working structure
182 Example setup
183 Update – The bot with live streaming!
184 Update – Live streaming bot – Trade settings collection
185 Update – Live streaming bot – Streaming Prices
186 Update – Live streaming bot – Detecting new candles live
187 Update – Live streaming bot – Loading live candle data and processing
188 Update – Live streaming bot – Trade decisions
189 Update – Live streaming bot – Placing trades & Done!
Gathering information – web scraping
190 Introduction – important. Slight rant
191 The structure of a web page
192 Introduction to web scraping
193 Example 1 – Scraping sentiment information
194 Loading site content
195 Extracting the data
196 Returning a DataFrame
197 Example 2 – Scraping some technicals
198 Are we human
199 Are we really human (Nov. 2022 Update)
200 Getting the data
201 Formatting the data
202 Collecting multiple technicals
203 Example 3 – Scraping News Headlines
204 News Headlines
205 Note for next video
206 Example 4 – Scraping an economic calendar, a new type of challenge
207 Working out how to make a query
208 Getting dates
209 Getting row data
210 Getting more row data
211 Collecting historical data
212 Using mock data files (when unable to scrape)
Databases – MongoDB
213 Introduction
214 Setting up MongoDB
215 Connecting from Python
216 Inserting data
217 Querying data, distinct values
218 Storing the economic data
219 Storing the tradeable instruments
220 Loading the tradeable instruments
221 Economic data analysis, loading candles
222 Economic data analysis, loading calendar data
223 Economic data analysis, cleaning data
224 Economic data analysis, fixing dates
225 Economic data analysis, merging data
226 Economic data, a little bit of analysis
227 Economic data analysis, charting regressions
Full stack! A ReactJS frontend and a Flask backend
228 Introduction
229 Setting up a Flask server, understanding Cors
230 Headlines endpoint
231 Technicals endpoint
232 Pricing endpoint
233 Installing NodeJs
234 Note for next video (good old React)
235 Setting up the ReactJS project
236 How the project is structured and compiled
237 Editing content
238 Passing props, interaction with events
239 Installing packages
240 Navigation Bar
241 Fonts
242 Routes
243 Link component
244 Title component
245 Account endpoint
246 useState hook
247 useEffect hook
248 Loading account data
249 Account data table
250 Some CSS
251 loading headlines data
252 Finishing the headlines
253 Select component
254 Making a selection
255 Making another selection
256 Adding a button
257 Loading the technicals
258 Displaying the technicals
259 Progress bar component
260 Price chart data and component
261 Plotting the candle chart
262 Styling the candle chart
263 Adding a footer
264 Clean-up
265 Production Build
266 Look-up options endpoint
267 Look-up options frontend
Deploying the live bot to the cloud
268 Setting up a cloud server on Linode
269 Connecting to the remote machine
270 Setting up the remote machine
271 Python requirements file
272 Running on the remote machine!
273 Using screen to background the bot process
274 Running with supervisor and automating setup
275 Project Clean Up (a bit)
276 The end and thank you!
Integrating another API – 2023 Update
277 Introduction
278 FXOpen account creation
279 Creating Credentials
280 Initial look at the new API
281 Setting up the API
282 Account Endpoint
283 Symbols Endpoint
284 Candles Endpoint
285 Pricing Endpoint
286 API Code Setup
287 Instruments Gathering
288 Loading Candles
289 Trading Endpoints
290 Pricing and Pip Value Endpoints
291 Historical Data Collection
292 Running the original simulation code
293 Updating the live trading bot
294 Adding the web candles endpoint
295 Socket streaming!
296 Live Price Streaming
297 End of section (and breathe)
Appendix 1 – Python Basics
298 Introduction
299 Running a Python script
300 Variables, types and casting
301 Operators
302 Lists
303 Dictionaries and JSON
304 Conditionals
305 Loops
306 List and Dictionary comprehension
307 Functions
308 Classes
309 Imports
310 Jupyter Notebooks
311 Pandas
Appendix 2 – JavaScript
312 Introduction
313 let, var, conditionals, types, equality
314 functions, const, formatted strings, comments
315 list, object, array map
316 Imports and modules
Extra
317 Bonus Lecture
Resolve the captcha to access the links!