Skip to content

Commit

Permalink
fix type, add minutes to tests
Browse files Browse the repository at this point in the history
  • Loading branch information
eohne committed Oct 6, 2024
1 parent dbe03e4 commit b0c73b8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
6 changes: 3 additions & 3 deletions docs/src/VersionChanges.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
!!! info "v0.1.10"
## Improvements
* `get_prices` now supports retrieving minute data for periods longer than 7 days by sending multiple requests of length equal to 7 days and stitching the responses together (minute data still needs to be within the last 30 days - this is a limit set by Yahoo)
* `get_prices` now supports the retrieval of minute level data for periods longer than 7 days. This is facilitated by making multiple requests and stitching the responses together (minute data still needs to be within the last 30 days - this is a limit set by Yahoo)
* `get_prices` now allows `startdt` and `enddt` to be of different types (e.g., `startdt="2024-01-01", enddt=today()` is now valid)
* The `range` argument in `get_prices` has been reworked to convert to `startdt` and `enddt`. Previously, this parameter was simply passed to the Yahoo API. The new way prings multiple improvements:
* The `range` argument in `get_prices` has been reworked to convert to `startdt` and `enddt`. Previously, this parameter was simply passed to the Yahoo API. The new way brings multiple improvements:
- more flexible range inputs
- specified intervals are now observed
* Significant code refactoring for improved maintainability and readability of the `get_prices` function
* An `OrderedDict{String, Union{String,Vector{DateTime},Vector{Float64}}}` is now returned by get_prices rather than `OrderedDict{String,Any}`
* `get_prices` now returns a `OrderedDict{String, Union{String,Vector{DateTime},Vector{Float64}}}` rather than `OrderedDict{String,Any}`
* Added precompilation for the response processing part of the `get_prices` function only


Expand Down
13 changes: 4 additions & 9 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,16 @@ using Test
@test_throws ErrorException get_prices("aapl",startdt=Date(1800), enddt=Date(1900),throw_error=true)
ta= get_prices("aapl",startdt=Date(1800), enddt=Date(1900),throw_error=false)
@test isempty(ta)
@test_throws ErrorException get_prices("aapl",interval="1m", range="2mo",throw_error=true)
ta = get_prices("aapl",interval="1m", range="18d")
@test !isempty(ta)

ta = get_prices("AAPL",range="max",exchange_local_time=true)
ta = get_prices("ADANIENT.NS",startdt ="2014-10-06" , enddt = "2024-10-06")
@test length(ta["timestamp"]) > 100
if isdefined(Base, :get_extension)
@test typeof(sink_prices_to(TimeArray,ta)) <: TimeArray
@test typeof(sink_prices_to(TSFrame,ta)) <: TSFrame
end

ta = get_prices("AAPL",interval="1m",range="5d")
@test length(ta["timestamp"]) > 100

ta = get_prices("ADANIENT.NS",startdt =Dates.today()-Year(10) , enddt = Dates.today())
@test length(ta["timestamp"]) > 100

if isdefined(Base, :get_extension)
ta = get_prices(TimeArray,"AAPL",interval="1m",range="2d")
@test typeof(ta) <:TimeArray
Expand All @@ -44,7 +39,7 @@ using Test
end
end
@testset "Dividends and Splits" begin
ta = get_prices("GOOGL",interval="1d",startdt="2022-01-01",enddt="2023-01-01",divsplits=true)
ta = get_prices("GOOGL",interval="1d",startdt="2022-01-01",enddt="2023-01-01",exchange_local_time=true,divsplits=true)
@test haskey(ta, "div")
@test haskey(ta, "split_ratio")
@test isequal(maximum(ta["split_ratio"]), 20)
Expand Down

0 comments on commit b0c73b8

Please sign in to comment.