Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Mastering R for Quantitative Finance

You're reading from   Mastering R for Quantitative Finance Use R to optimize your trading strategy and build up your own risk management system

Arrow left icon
Product type Paperback
Published in Mar 2015
Publisher
ISBN-13 9781783552078
Length 362 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Toc

Table of Contents (15) Chapters Close

Preface 1. Time Series Analysis FREE CHAPTER 2. Factor Models 3. Forecasting Volume 4. Big Data – Advanced Analytics 5. FX Derivatives 6. Interest Rate Derivatives and Models 7. Exotic Options 8. Optimal Hedging 9. Fundamental Analysis 10. Technical Analysis, Neural Networks, and Logoptimal Portfolios 11. Asset and Liability Management 12. Capital Adequacy 13. Systemic Risks Index

Modeling in R

In the following section, we will learn the implementation of the previously described models with the help of R.

Data selection

In Chapter 4, Big Data – Advanced Analytics, we will discuss in detail the aspects and methods of getting data from open sources and working with them efficiently. Here, we only present how the time series of stock prices and other relevant information can be acquired and used for the factor model's estimations.

We used the quantmod package to collect the database.

Here is how it works in R:

library(quantmod)
stocks <- stockSymbols()

As a result, we need to wait for a few seconds while data is fetched, and then we can see the output:

Fetching AMEX symbols...
Fetching NASDAQ symbols...
Fetching NYSE symbols...

Now, we have a data frame R object that contains about 6,500 stocks that are traded on different exchanges such as AMEX, NASDAQ, or NYSE. In order to see the variables that the dataset contains, we can use the str command:

str(stocks...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime