@@ -21,7 +21,7 @@ function show_server_time(time_type::String = "iso")
2121 try
2222 server_time = get_server_time ()
2323 catch
24- @info " Unable to retrieve API server time"
24+ error ( " Unable to retrieve API server time" )
2525 end
2626
2727 return server_time[time_type]
@@ -52,20 +52,24 @@ julia> show_historical_data("ETH-EUR", 3600)
5252function show_historical_data (pair:: String , interval:: Int64 = 300 )
5353
5454 df_candles = DataFrame ()
55+ closest_match = interval
5556
5657 try
57- df_candles = get_historical_data (pair:: String , interval:: Int64 )
58+ df_candles = get_historical_data (pair, interval)
5859 catch e
5960 if isa (e, HTTP. ExceptionRequest. StatusError)
60- @info " 404 Not Found - Check if the pair ID is valid"
61+ error ( " 404 Not Found - Check if the pair ID is valid" )
6162 elseif isa (e, AssertionError)
62- @info " Granularity is NOK, choose only from {60, 300, 900, 3600, 21600, 86400}."
63+ @warn (" Granularity is NOK, choose only one from {60, 300, 900, 3600, 21600, 86400} seconds." )
64+ closest_match = closest_interval (interval)
65+ @info (" Showing result for closest match $(closest_match) " )
66+ df_candles = get_historical_data (pair, closest_match)
6367 else
64- @info " Could not retrieve historical data, try again!"
68+ error ( " Could not retrieve historical data, try again!" )
6569 end
6670 end
6771
68- return df_candles
72+ return df_candles, closest_match
6973end
7074
7175
@@ -99,7 +103,7 @@ function show_all_products(currency::String = "USD")
99103 end
100104
101105 if isempty (products)
102- @info " No products exist for the given currency, try something else!"
106+ error ( " No products exist for the given currency, try something else!" )
103107 else
104108 return products
105109 end
0 commit comments