fastquant

fastquant — Backtest and optimize your trading strategies with only 3 lines of code!

Features

  1. Easily access historical stock data
  2. Backtest and optimize trading strategies with only 3 lines of code

* - Both Yahoo Finance and Philippine stock data data are accessible straight from fastquant

Check out our blog posts in the fastquant website and this intro article on Medium!

Installation

Python

pip install fastquant

R

R support is pending development and lagging in features, but you may install the R package by typing the following:

## To install the stable version: 
install.packages("fastquant")

## To install the development version: 
## install.packages("remotes")
remotes::install_github("enzoampil/fastquant", subdir = "R")

Get stock data

All symbols from Yahoo Finance and Philippine Stock Exchange (PSE) are accessible via get_stock_data.

Python

from fastquant import get_stock_data
df = get_stock_data("JFC", "2018-01-01", "2019-01-01")
print(df.head())

##           dt  close
##   2019-01-01  293.0
##   2019-01-02  292.0
##   2019-01-03  309.0
##   2019-01-06  323.0
##   2019-01-07  321.0

R

library(fastquant)

get_stock_data("JFC", "2018-01-01", "2018-02-01")

#> ## A tibble: 22 x 7
#>    symbol dt         name     currency close percent_change  volume
#>    <chr>  <date>     <chr>    <chr>    <dbl>          <dbl>   <dbl>
#>  1 JFC    2018-01-03 Jollibee PHP       255\.             NA  745780
#>  2 JFC    2018-01-04 Jollibee PHP       255              NA  617010
#>  3 JFC    2018-01-05 Jollibee PHP       255              NA  946040
#>  4 JFC    2018-01-08 Jollibee PHP       256              NA  840630
#> ...

Get crypto data

The data is pulled from Binance, and all the available tickers are found here.

Python

from fastquant import get_crypto_data
crypto = get_crypto_data("BTC/USDT", "2018-12-01", "2019-12-31")
crypto.head()

##             open    high     low     close    volume
## dt                                                          
## 2018-12-01  4041.27  4299.99  3963.01  4190.02  44840.073481
## 2018-12-02  4190.98  4312.99  4103.04  4161.01  38912.154790
## 2018-12-03  4160.55  4179.00  3827.00  3884.01  49094.369163
## 2018-12-04  3884.76  4085.00  3781.00  3951.64  48489.551613
## 2018-12-05  3950.98  3970.00  3745.00  3769.84  44004.799448

#data visualization #visual studio code #visual studio #code

Backtest and optimize your trading strategies with only 3 lines of code
4.15 GEEK