-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from tbreloff/master
added fundamentals
- Loading branch information
Showing
4 changed files
with
77 additions
and
0 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
|
||
# Company Overview (https://www.alphavantage.co/documentation/#company-overview) | ||
# ex: https://www.alphavantage.co/query?function=OVERVIEW&symbol=IBM&apikey=demo | ||
|
||
function company_overview(symbol::String; outputsize::String="compact", datatype::String="json") | ||
@argcheck in(datatype, ["json", "csv"]) | ||
uri = _form_uri_head("OVERVIEW") * "&symbol=$symbol" * _form_uri_tail(outputsize, datatype) | ||
data = _get_request(uri) | ||
return _parse_response(data, datatype) | ||
end | ||
export company_overview | ||
|
||
# Income Statement (https://www.alphavantage.co/documentation/#income-statement) | ||
# ex: https://www.alphavantage.co/query?function=INCOME_STATEMENT&symbol=IBM&apikey=demo | ||
|
||
function income_statement(symbol::String; outputsize::String="compact", datatype::String="json") | ||
@argcheck in(datatype, ["json", "csv"]) | ||
uri = _form_uri_head("INCOME_STATEMENT") * "&symbol=$symbol" * _form_uri_tail(outputsize, datatype) | ||
data = _get_request(uri) | ||
return _parse_response(data, datatype) | ||
end | ||
export income_statement | ||
|
||
# Balance Sheet (https://www.alphavantage.co/documentation/#balance-sheet) | ||
# ex: https://www.alphavantage.co/query?function=BALANCE_SHEET&symbol=IBM&apikey=demo | ||
|
||
function balance_sheet(symbol::String; outputsize::String="compact", datatype::String="json") | ||
@argcheck in(datatype, ["json", "csv"]) | ||
uri = _form_uri_head("BALANCE_SHEET") * "&symbol=$symbol" * _form_uri_tail(outputsize, datatype) | ||
data = _get_request(uri) | ||
return _parse_response(data, datatype) | ||
end | ||
export balance_sheet | ||
|
||
# Cash Flow (https://www.alphavantage.co/documentation/#cash-flow) | ||
# ex: https://www.alphavantage.co/query?function=CASH_FLOW&symbol=IBM&apikey=demo | ||
|
||
function cash_flow(symbol::String; outputsize::String="compact", datatype::String="json") | ||
@argcheck in(datatype, ["json", "csv"]) | ||
uri = _form_uri_head("CASH_FLOW") * "&symbol=$symbol" * _form_uri_tail(outputsize, datatype) | ||
data = _get_request(uri) | ||
return _parse_response(data, datatype) | ||
end | ||
export cash_flow |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
@testset "Fundamentals" begin | ||
symbol = "IBM" | ||
|
||
@testset "Overview" begin | ||
data = company_overview(symbol) | ||
@test typeof(data) === Dict{String, Any} | ||
@test length(data) === 59 | ||
sleep(TEST_SLEEP_TIME + 2*rand()) #as to not overload the API | ||
end | ||
|
||
@testset "Income Statement" begin | ||
data = income_statement(symbol) | ||
@test typeof(data) === Dict{String, Any} | ||
@test length(data) === 3 | ||
sleep(TEST_SLEEP_TIME + 2*rand()) #as to not overload the API | ||
end | ||
|
||
@testset "Balance Sheet" begin | ||
data = balance_sheet(symbol) | ||
@test typeof(data) === Dict{String, Any} | ||
@test length(data) === 3 | ||
sleep(TEST_SLEEP_TIME + 2*rand()) #as to not overload the API | ||
end | ||
|
||
@testset "Cash Flow" begin | ||
data = cash_flow(symbol) | ||
@test typeof(data) === Dict{String, Any} | ||
@test length(data) === 3 | ||
sleep(TEST_SLEEP_TIME + 2*rand()) #as to not overload the API | ||
end | ||
end |
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