---
title: "Getting Started with rKraken"
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{Getting Started with rKraken}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
---

## Generating your token file

1. To get started please visit \donttest{Kraken} and request api access. 

2. All requests in this package must be authenticated. You will need to save you token files as "rk_tokens.rds" in your working directory. Here is an example of how to run it and save them.

Helper script to store tokens in your working directory.
```{r setup, include=FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  eval = FALSE
)

# step 1 - Paste your secret key into line 25 & secret token into line 26. These come from Kraken (Online)
api_token = 'INSERT_API_KEY_HERE'
secret = 'INSERT_SECRET_TOKEN_HERE'

```

## Assign values into an environment

```{r , echo=FALSE}
# step 3 - Run This block to assign in environment 'pw'
pw = new.env()

assign('api_key', api_token, envir = pw)
assign( 'secret', secret, envir=pw)

```

## Save Tokens as an RDS file

This is where the tokens are saved. The `rKraken` package will use the working directory to try and access them.
```{r, echo=FALSE}
# step 3 - Run the block to save them as 'rk_tokens.rds'.
tmp_out <- file.path(tempdir(), "rk_tokens.rds")
saveRDS(pw, tmp_out)
message("Output saved temporarily to: ", tmp_out)

```
