-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path9_hourly.R
47 lines (32 loc) · 1.05 KB
/
9_hourly.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# Libraries
library(DBI)
library(odbc)
library(dplyr)
library(crypto2)
# Daily Refresh for BTC
coin_list_all <- crypto_listings(
which = "latest",
convert = "USD",
limit = 1000,
start_date = sys.date(),
interval = "day",
quote = FALSE,
sort = "cmc_rank",
sort_dir = "asc",
sleep = 0,
wait = 60,
finalWait = FALSE
)
# Dataframe 9: Ranks 801-900
df9 <- coin_list_all %>% filter(cmc_rank >= 801 & cmc_rank <= 900)
##
hourly_all_coins<-crypto_history(coin_list = df9,convert = "USD",limit = 100, interval= "1h",
sleep = 1, start_date = Sys.Date()-1, end_date = Sys.Date()+1)
# Set up your Azure SQL Database connection
con <- dbConnect(odbc::odbc(), Driver = "ODBC Driver 17 for SQL Server",
Server = "cp-io-sql.database.windows.net", Database = "sql_db_ohlcv",
UID = "yogass09", PWD = "Qwerty@312",Port = 1433)
# Write data to the SQL database
dbWriteTable(con, "hourly_all_coins_ohlcv", hourly_all_coins, append = TRUE)
# Disconnect from the database
dbDisconnect(con)