Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/PolygonIO.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ include("streaming_socket.jl")

######### Global export of user API ################
export PolyOpts, tickers, ticker_types, ticker_details, ticker_details_vX,
ticker_news
ticker_news, markets, locales


end
23 changes: 23 additions & 0 deletions src/reference_api.jl
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,33 @@ function ticker_news(opts::PolyOpts,
end

############ Markets ####################
"""
"""
function markets(opts::PolyOpts)
params = Dict("apiKey" => opts.api_key)
request_json = HTTP.get(markets_base_url, query=params).body |> JSON3.read

if opts.sink === nothing
return request_json.results
else
return request_json.results |> opts.sink
end
end


############ Locales ####################
"""
"""
function locales(opts::PolyOpts)
params = Dict("apiKey" => opts.api_key)
request_json = HTTP.get(locales_base_url, query=params).body |> JSON3.read

if opts.sink === nothing
return request_json.results
else
return request_json.results |> opts.sink
end
end

############ Stock Splits ####################

Expand Down
6 changes: 5 additions & 1 deletion src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,8 @@ tickers_base_url = "https://api.polygon.io/v3/reference/tickers"

ticker_types_base_url = "https://api.polygon.io/v2/reference/types"

ticker_new_base_url = "https://api.polygon.io/v2/reference/news"
ticker_new_base_url = "https://api.polygon.io/v2/reference/news"

markets_base_url = "https://api.polygon.io/v2/reference/markets"

locales_base_url = "https://api.polygon.io/v2/reference/locales"
8 changes: 8 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,12 @@ const regular_opts = PolyOpts(API_KEY, nothing)
# ticker_news test
@test ticker_news(tabular_opts, "AAPL") |> length == 10
@test ticker_news(regular_opts, "AAPL") |> length == 10

# markets test
@test markets(regular_opts) |> length == 7
@test markets(tabular_opts) |> size == (7,)

# locales test
@test locales(regular_opts) |> size == (19,)
@test locales(tabular_opts) |> size == (19,)
end