Muutke küpsiste eelistusi

E-raamat: Automated Trading with R: Quantitative Research and Platform Development

  • Formaat: PDF+DRM
  • Ilmumisaeg: 28-Sep-2016
  • Kirjastus: APress
  • Keel: eng
  • ISBN-13: 9781484221785
  • Formaat - PDF+DRM
  • Hind: 80,26 €*
  • * hind on lõplik, st. muud allahindlused enam ei rakendu
  • Lisa ostukorvi
  • Lisa soovinimekirja
  • See e-raamat on mõeldud ainult isiklikuks kasutamiseks. E-raamatuid ei saa tagastada.
  • Formaat: PDF+DRM
  • Ilmumisaeg: 28-Sep-2016
  • Kirjastus: APress
  • Keel: eng
  • ISBN-13: 9781484221785

DRM piirangud

  • Kopeerimine (copy/paste):

    ei ole lubatud

  • Printimine:

    ei ole lubatud

  • Kasutamine:

    Digitaalõiguste kaitse (DRM)
    Kirjastus on väljastanud selle e-raamatu krüpteeritud kujul, mis tähendab, et selle lugemiseks peate installeerima spetsiaalse tarkvara. Samuti peate looma endale  Adobe ID Rohkem infot siin. E-raamatut saab lugeda 1 kasutaja ning alla laadida kuni 6'de seadmesse (kõik autoriseeritud sama Adobe ID-ga).

    Vajalik tarkvara
    Mobiilsetes seadmetes (telefon või tahvelarvuti) lugemiseks peate installeerima selle tasuta rakenduse: PocketBook Reader (iOS / Android)

    PC või Mac seadmes lugemiseks peate installima Adobe Digital Editionsi (Seeon tasuta rakendus spetsiaalselt e-raamatute lugemiseks. Seda ei tohi segamini ajada Adober Reader'iga, mis tõenäoliselt on juba teie arvutisse installeeritud )

    Seda e-raamatut ei saa lugeda Amazon Kindle's. 

This book explains the broad topic of automated trading, starting with its mathematics and moving to its computation and execution. Readers will gain a unique insight into the mechanics and computational considerations taken in building a backtester, strategy optimizer, and fully functional trading platform.

Automated Trading with R provides automated traders with all the tools they need to trade algorithmically with their existing brokerage, from data management, to strategy optimization, to order execution, using free and publically available data. If your brokerage’s API is supported, the source code is plug-and-play.

The platform built in this book can serve as a complete replacement for commercially available platforms used by retail traders and small funds. Software components are strictly decoupled and easily scalable, providing opportunity to substitute any data source, trading algorithm, or brokerage. The book’s three objectives are:

  • To provide a flexible alternative to common strategy automation frameworks, like Tradestation, Metatrader, and CQG, to small funds and retail traders.
  • To offer an understanding the internal mechanisms of an automated trading system.
  • To standardize discussion and notation of real-world strategy optimization problems.

What you’ll learn

  • Programming an automated strategy in R gives the trader access to R and its package library for optimizing strategies, generating real-time trading decisions, and minimizing computation time.
  • How to best simulate strategy performance in their specific use case to derive accurate performance estimates.
  • Important machine-learning criteria for statistical validity in the context of time-series.
  • An understanding of critical real-world variables pertaining to portfolio management and performance assessment, including latency, drawdowns, varying trade size, portfolio growth, and penalization of unused capital.

Who This Book Is For

This book is for traders/practitioners at the retail or small fund level with at least an undergraduate background in finance or computer science. Graduate level finance or data science students. 

About the Author xv
About the Technical Reviewers xvii
Acknowledgments xix
Introduction xxi
Part 1 Problem Scope
Chapter 1 Fundamentals of Automated Trading
1(20)
Equity Curve and Return Series 3
3(3)
Characteristics of the Equity Curve
5(1)
Characteristics of the Return Series
5(1)
Risk-Return Metrics
6(2)
Characteristics of Risk-Return Metrics
8(12)
Sharpe Ratio
10(2)
Maximum Drawdown Ratios
12(2)
Partial Moment Ratios
14(2)
Regression-Based Performance Metrics
16(4)
Optimizing Performance Metrics
20(1)
Part 2 Building the Platform
21(132)
Chapter 2 Networking Part I
23(14)
Yahoo! Finance API
24(5)
Setting Up Directories
25(1)
URL Query Building
25(1)
Data Acquisition
26(1)
Loading Data into Memory
27(1)
Updating Data
28(1)
YQL Web Service
29(4)
URL and Query Building
30(3)
Note on Quantmod
33(1)
Background
33(1)
Comparison
33(1)
Organizing as Date-Uniform zoo Object
34(3)
Note on zoo Objects
35(2)
Chapter 3 Data Preparation
37(14)
Handling NA Values
37(6)
Note: NAvs. NaN in R
37(1)
IPOs and Additions to S&P 500
37(2)
Merging to the Uniform Date Template
39(1)
Forward Replacement
40(1)
Linearly Smoothed Replacement
41(1)
Volume-Weighted Smoothed Replacement
42(1)
Discussion of Replacement Methods
43(1)
Real Time vs. Simulation
43(1)
Influence on Volatility Metrics
43(1)
Influence on Trading Decisions
44(1)
Conclusion
44(1)
Closing Price and Adjusted Close
44(3)
Adjusting for Stock Splits
45(1)
Adjusting for Cash Dividends
45(1)
Efficient Updating and Adjusted Close
46(1)
Implementing Adjustments
47(1)
Test for and Correct Inactive Symbols
47(1)
Computing the Return Matrix
48(3)
Chapter 4 Indicators
51(8)
Indicator Types
51(1)
Overlays
51(1)
Oscillators
51(1)
Accumulators
52(1)
Pattern/Binary/Ternary
52(1)
Machine Learning/Nonvisual/Black Box
52(1)
Example Indicators
52(5)
Simple Moving Average
52(1)
Moving Average Convergence Divergence Oscillator (MACD)
53(1)
Bollinger Bands
54(1)
Custom Indicator Using Correlation and Slope
55(1)
Indicators Utilizing Multiple Data Sets
56(1)
Conclusion
57(2)
Chapter 5 Rule Sets
59(6)
Our Process Flow as Nested Functions
59(1)
Terminology
59(2)
Example Rule Sets
61(1)
Overlays
61(1)
Oscillators
61(1)
Accumulators
61(1)
Filters, Triggers, and Quantifications of Favor
62(3)
Chapter 6 High-Performance Computing
65(18)
Hardware Overview
65(9)
Processing
65(1)
Multicore Processing
65(1)
Hyperthreading
66(1)
Memory
67(1)
The Disk
68(1)
Random Access Memory (RAM)
68(1)
Processor Cache
68(1)
Swap Space
68(1)
Software Overview
69(1)
Compiled vs. Interpreted
69(1)
Scripting Languages
70(1)
Speed vs. Safety
70(1)
Takeaways
71(1)
For Loops vs. apply Functions
71(1)
For Loops and Memory Allocation
72(1)
Apply-Style Functions
73(1)
Use Binaries Creatively
73(1)
Note on Measuring Compute Time
74(1)
Multicore Computing in R
74(3)
Embarrassingly Parallel Processes
75(1)
doMC and doParallel
75(1)
The foreach Package
76(1)
The foreach Package in Practice
77(6)
Integer Mapping
77(1)
Computing the Return Matrix with foreach
78(1)
Computing Indicators with foreach
79(4)
Chapter 7 Simulation and Backtesting
83(18)
Example Strategies
83(2)
Our Simulation Workflow
85(8)
Listing 7-1 Pseudocode
85(1)
Listing 7-1 Explanation of Inputs and User Guide
86(6)
Discussion
92(1)
Implementing Example Strategies
93(4)
Summary Statistics and Performance Metrics
97(2)
Conclusion
99(2)
Chapter 8 Optimization
101(30)
Cross Validation in Time Series
101(1)
Numerical vs. Analytical Optimization
102(1)
Numerical Optimization Overview
103(2)
Parameter Transform for Unbounded Search Algorithms
104(1)
Declaring an Evaluator
105(5)
Listing 8-1 Pseudocode
105(1)
Listing 8-1 Explanation of Inputs and User Guide
106(4)
Exhaustive Search Optimization
110(4)
Pattern Search Optimization
114(6)
Generalized Pattern Search Optimization
114(6)
Nelder-Mead Optimization
120(7)
Nelder-Mead with Random Initialization
120(7)
Projecting Trading Performance
127(3)
Conclusion
130(1)
Chapter 9 Networking Part II
131(22)
Market Overview: Brokerage APIs
131(2)
Secure Connections
133(2)
Establishing SSL Connections
133(1)
Proprietary SSL Connections
134(1)
HTTP/HTTPS
135(1)
OAuth
135(1)
Feasibility Analysis for Trading APIs
135(1)
Feasibility of Custom R Packages
135(1)
HTTPS + OAuth Through Existing R Packages
136(1)
FIX Engines
136(1)
Exporting Directions to a Supported Language
136(1)
Planning and Executing Trades
136(4)
The PLAN Job
137(2)
The TRADE Job
139(1)
Common Data Formats
140(12)
Manipulating XML
140(6)
Generating XML Documents
146(1)
Manipulating JSON Data
147(1)
The Financial Information exchange Protocol
148(1)
The FIX extensible Markup Language
149(1)
OAuth in R
150(2)
Conclusion
152(1)
Part 3 Production Trading
153(14)
Chapter 10 Organizing and Automating Scripts
155(6)
Organizing Scripts into Jobs
155(1)
Calling Jobs with the Source Function
155(1)
Calling Jobs via Sourcing
156(1)
Task Scheduling in Windows
156(3)
Running R from the Command Line in Windows
156(2)
Setting Up and Managing the Task Scheduler
158(1)
Task Scheduling in UNIX
159(1)
Conclusion
160(1)
Chapter 11 Looking Forward
161(6)
Language Considerations
161(1)
Python
161(1)
C/C++
161(1)
Hardware Description Languages
162(1)
Retail Brokerages and Right to Refuse
162(1)
Right to Refuse in the Swiss Currency Crisis
163(1)
Connection Latency
163(1)
Ethernet vs. WiFi
163(1)
Proximity to Exchanges
164(1)
Prime Brokerages
164(1)
Digesting News and Fundamentals
165(1)
Conclusion
165(2)
Appendix A Source Code
167(28)
Platform/config.R
167(1)
Platform/load
168(10)
Platform/load.R
168(1)
Platform/update.R
169(1)
Platform/functions/yahoo. R
170(1)
Platform/load/initial.R
170(1)
Platform/load/loadToMemory.R
171(1)
Platform/load/updateStocks.R
172(4)
Platform/load/dateUnif.R
176(1)
Platform/load/spClean.R
177(1)
Platform/load/adjustClose.R
177(1)
Platform/load/return.R
177(1)
Platform/load/filllnactive.R
178(1)
Platform/compute
178(6)
Platform/compute/MCinit.R
178(1)
Platform/compute/functions.R
178(6)
Platform/plan
184(5)
Plarform/plan.R
184(1)
Platform/plan/decisionGen.R
185(4)
Platform/trade
189(1)
Platform/trade.R
169(20)
Platform/model
189(6)
Platform/model.R
189(1)
Platform/model/optimize.R
190(1)
Platform/model/evaluateFunc.R
190(2)
Platform/model/optimizeFunc.R
192(3)
Appendix B Scoping in Multicore R
195(8)
Scoping Rules in R
195(2)
Using Lexical Scoping
195(1)
Takeaways
196(1)
The UNIX fork System Call
197(2)
The fork Call and Memory Management
197(1)
Scoping Implications for R
197(2)
Instance Replication in Windows
199(4)
Instance Replication and Memory Management
199(1)
Scoping Implications for R
200(3)
Index 203
Chris Conlan began his career as an independent data scientist specializing in trading algorithms. He attended the University of Virginia where he completed his undergraduate statistics coursework in three semesters. During his time at UVA, he secured initial fundraising for a privately held high-frequency forex group as president and chief trading strategist. He is currently managing the development of private technology companies in high-frequency forex, machine vision, and dynamic reporting.