Building Trading Bots Using Java - Shekhar Varshney

Building Trading Bots Using Java (eBook)

eBook Download: PDF
2016 | 1st ed.
XIII, 281 Seiten
Apress (Verlag)
978-1-4842-2520-2 (ISBN)
Systemvoraussetzungen
79,99 inkl. MwSt
  • Download sofort lieferbar
  • Zahlungsarten anzeigen

Build an automated currency trading bot from scratch with java. In this book, you will learn about the nitty-gritty of automated trading and have a closer look at Java, the Spring Framework, event-driven programming, and other open source APIs, notably Google's Guava API. And of course, development will all be test-driven with unit testing coverage.

The central theme of Building Trading Bots Using Java is to create a framework that can facilitate automated trading on most of the brokerage platforms, with minimum changes. At the end of the journey, you will have a working trading bot, with a sample implementation using the OANDA REST API, which is free to use.



What You'll Learn

  • Find out about trading bots
  • Discover the details of tradeable instruments and apply bots to them
  • Track and use market data events
  • Place orders and trades
  • Work with trade/order and account events

Who This Book Is For

Experienced programmers new to bots and other algorithmic trading and finance techniques.



Shekhar Varshney is a freelance software developer based in Switzerland with over 19 years of development experience. He started his journey with IBM mainframes, correcting COBOL programs infected with the Y2K bug. At present, his main software development focus is building enterprise services based on SOA principles. He has a keen interest in software design and architecture. In his free time, he loves experimenting with new APIs and frameworks mostly in the Java ecosystem.


Build an automated currency trading bot from scratch with java. In this book, you will learn about the nitty-gritty of automated trading and have a closer look at Java, the Spring Framework, event-driven programming, and other open source APIs, notably Google's Guava API. And of course, development will all be test-driven with unit testing coverage. The central theme of Building Trading Bots Using Java is to create a framework that can facilitate automated trading on most of the brokerage platforms, with minimum changes. At the end of the journey, you will have a working trading bot, with a sample implementation using the OANDA REST API, which is free to use.What You'll LearnFind out about trading botsDiscover the details of tradeable instruments and apply bots to themTrack and use market data eventsPlace orders and tradesWork with trade/order and account eventsWho This Book Is ForExperienced programmers new to bots and other algorithmic trading and finance techniques.

Shekhar Varshney is a freelance software developer based in Switzerland with over 19 years of development experience. He started his journey with IBM mainframes, correcting COBOL programs infected with the Y2K bug. At present, his main software development focus is building enterprise services based on SOA principles. He has a keen interest in software design and architecture. In his free time, he loves experimenting with new APIs and frameworks mostly in the Java ecosystem.

Contents at a Glance 5
Contents 6
About the Author 11
Chapter 1: Introduction to Trading Bot 12
What Is a Trading Bot? 13
Why Do We Need a Trading Bot? 14
The Capabilities of the Trading Bot 14
Design Goals 15
Code Organization and Software Stack Used 17
OANDA REST API as Reference Implementation 19
Opening an OANDA Practice Account 19
OANDA JSON Keys 24
Constructor Dependencies for OANDA Implementations 26
Event-Driven Architecture 27
Google EventBus 29
Provider Helper Interface 31
TradingConfig Class 33
Obtaining the Source Code 35
Try It Yourself Section 35
Chapter 2: Account Management 37
Account Provider Interface 41
A Concrete Implementation for AccountDataProvider 42
Encapsulating Everything Behind a Generic AccountInfoService 47
Try It Yourself 53
Chapter 3: Tradeable Instruments 56
Instrument Provider Interface 60
A Concrete Implementation for InstrumentDataProvider 61
Encapsulating Everything Behind a Generic InstrumentService 65
Try It Yourself 67
Chapter 4: Event Streaming: Market Data Events 70
Streaming Market Data Interface 70
A Concrete Implementation for MarketDataStreamingService 72
Downstream Market Data Event Dissemination: MarketEventCallback 78
Try It Yourself 79
Chapter 5: Historic Instrument Market Data 83
How to Read a Candlestick 83
Enum Defining the Candlestick Granularity 84
Define POJO to Hold Candlestick Information 85
Historical Data Provider Interface 87
A Concrete Implementation for HistoricMarketDataProvider 89
Discussion: An Alternate Database Implementation 93
Candlesticks for Moving Average Calculations 96
MovingAverageCalculationService 97
Try It Yourself 99
Chapter 6: Placing Orders and Trades 104
Order POJO Definition 105
Order Management Provider Interface 108
A Concrete Implementation for OrderManagementProvider 110
A Simple OrderInfoService 122
Validating Orders Before Execution: PreOrderValidationService 123
Putting It All Together in an OrderExecutionService 128
Trade POJO Definition 131
Trade Management Provider Interface 134
A Concrete Implementation for TradeManagementProvider 136
Encapsulating Read Operations Behind TradeInfoService 143
Try It Yourself 151
Chapter 7: Event Streaming: Trade/Order/Account Events 166
Streaming Event Interface 168
A Concrete Implementation for EventsStreamingService 169
Try It Yourself 178
Chapter 8: Integration with Twitter 181
Creating a Twitter Application 181
Spring Social 186
Using and Configuring Spring Social 186
Harvesting FX Tweets 187
TweetHarvester Interface 191
FXTweetHandler Interface 191
AbstractFXTweetHandler Base Class 192
User-Specific TweetHandlers 195
SignalFactoryFXTweetHandler 196
ZuluTrader101FXTweetHandler 199
Try It Yourself 203
Chapter 9: Implementing Strategies 208
Copy Twitter Strategy 209
Fade the Move Strategy 215
Try It Yourself 219
Chapter 10: Heartbeating 224
HeartBeatPayLoad 224
Streaming the Heartbeat Interface 225
A Concrete Implementation for HeartBeatStreamingService 226
HeartBeatCallback Interface 228
DefaultHeartBeatService 228
Try It Yourself 231
Chapter 11: E-Mail Notifications 235
Notification Design 235
EmailPayLoad POJO 235
EmailContentGenerator Interface 236
Sample Implementations 236
EventEmailNotifier Service 239
Try It Yourself 241
Chapter 12: Configuration, Deployment, and Running the Bot 246
Configuring the Trading Bot 246
Core Beans Configuration 247
Twitter-Related Beans Configuration 250
Provider Beans Configuration 251
AccountDataProviderService 252
ProviderHelper 252
InstrumentDataProvider 252
CurrentPriceInfoProvider 253
HistoricMarketDataProvider 253
OrderManagementProvider 253
TradeManagementProvider 253
PositionManagementProvider 254
EventStreamingService 254
Platform Event Handlers 254
MarketDataStreamingService 255
Strategies Configuration 257
Services Configuration 257
AccountInfoService 257
InstrumentService 258
MovingAverageCalculationService 258
OrderInfoService 258
TradeInfoService 258
PreOrderValidationService 258
OrderExecutionService 259
DefaultHeartBeatService 259
Building the Bot 259
Running the Bot 262
Chapter 13: Unit Testing 265
Using Mockito as a Mocking Framework 265
Mocking HTTP Interaction 266
Mocking Streams 269
The Versatile verify Mockito 273
Mocking Twitter Interaction 275
EclEmma Code Coverage Tool for Eclipse IDE 276
Index 279

Erscheint lt. Verlag 7.12.2016
Zusatzinfo XIII, 281 p. 61 illus.
Verlagsort Berkeley
Sprache englisch
Themenwelt Informatik Programmiersprachen / -werkzeuge Java
Informatik Theorie / Studium Künstliche Intelligenz / Robotik
Recht / Steuern Wirtschaftsrecht
Wirtschaft Betriebswirtschaft / Management Finanzierung
Schlagworte AI • Bonds • Bots • Capital • Finance • Invest • Java • Stocks • Trading
ISBN-10 1-4842-2520-1 / 1484225201
ISBN-13 978-1-4842-2520-2 / 9781484225202
Haben Sie eine Frage zum Produkt?
PDFPDF (Wasserzeichen)
Größe: 6,4 MB

DRM: Digitales Wasserzeichen
Dieses eBook enthält ein digitales Wasser­zeichen und ist damit für Sie persona­lisiert. Bei einer missbräuch­lichen Weiter­gabe des eBooks an Dritte ist eine Rück­ver­folgung an die Quelle möglich.

Dateiformat: PDF (Portable Document Format)
Mit einem festen Seiten­layout eignet sich die PDF besonders für Fach­bücher mit Spalten, Tabellen und Abbild­ungen. Eine PDF kann auf fast allen Geräten ange­zeigt werden, ist aber für kleine Displays (Smart­phone, eReader) nur einge­schränkt geeignet.

Systemvoraussetzungen:
PC/Mac: Mit einem PC oder Mac können Sie dieses eBook lesen. Sie benötigen dafür einen PDF-Viewer - z.B. den Adobe Reader oder Adobe Digital Editions.
eReader: Dieses eBook kann mit (fast) allen eBook-Readern gelesen werden. Mit dem amazon-Kindle ist es aber nicht kompatibel.
Smartphone/Tablet: Egal ob Apple oder Android, dieses eBook können Sie lesen. Sie benötigen dafür einen PDF-Viewer - z.B. die kostenlose Adobe Digital Editions-App.

Zusätzliches Feature: Online Lesen
Dieses eBook können Sie zusätzlich zum Download auch online im Webbrowser lesen.

Buying eBooks from abroad
For tax law reasons we can sell eBooks just within Germany and Switzerland. Regrettably we cannot fulfill eBook-orders from other countries.

Mehr entdecken
aus dem Bereich
Einführung, Ausbildung, Praxis

von Christian Ullenboom

eBook Download (2023)
Rheinwerk Computing (Verlag)
34,93
Moderne GUIs für RIAs und Java-Applikationen

von Ralph Steyer

eBook Download (2022)
Springer Fachmedien Wiesbaden (Verlag)
42,99