Last active
March 28, 2021 20:37
-
-
Save vnegi10/cb3e38651753389f6da5846fda846b8f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function average_price_df(currency::String, df_in::DataFrame, df_out_price::DataFrame, df_out_candle::DataFrame) | |
if isempty(names(df_out_price)) | |
df_out_price[!,:Date] = df_in[!,:Date] | |
end | |
df_out_price[!,Symbol("$currency")] = (df_in[!,Symbol("open (EUR)")] + df_in[!,Symbol("high (EUR)")] + df_in[!,Symbol("low (EUR)")] + df_in[!,Symbol("close (EUR)")])/4 | |
candle_col = [] | |
for i in 1:size(df_in)[1] | |
push!(candle_col, (df_in[!,Symbol("open (EUR)")][i], df_in[!,Symbol("high (EUR)")][i], df_in[!,Symbol("low (EUR)")][i], df_in[!,Symbol("close (EUR)")][i])) | |
end | |
if isempty(names(df_out_candle)) | |
df_out_candle[!,:Date] = df_in[!,:Date] | |
end | |
df_out_candle[!,Symbol("$currency")] = candle_col | |
end | |
function vol_df(currency::String, df_in::DataFrame, df_out_vol::DataFrame) | |
if isempty(names(df_out_vol)) | |
df_out_vol[!,:Date] = df_in[!,:Date] | |
end | |
df_out_vol[!,Symbol("$currency")] = df_in[!,:volume] | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment