-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add fundamental data support #9
Open
tylerhaugen-stanley
wants to merge
8
commits into
StefanoMartin:master
Choose a base branch
from
tylerhaugen-stanley:add_fundamental_data_support
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
4233e13
Add support for the fundamental api
tylerhaugen-stanley-amount daf3413
Add gemfile.lock
tylerhaugen-stanley-amount 249326a
Add specs and a few other ways to intantiate a Fundamental_Data objec…
tylerhaugen-stanley-amount 85cb114
Revert and add fundamental data to core gem file
tylerhaugen-stanley-amount 0a96a58
Clean up specs
tylerhaugen-stanley-amount ff5e4b9
Add constants for endpoints and small code cleanup based on code review
tylerhaugen-stanley-amount 53f3b91
Update readme
tylerhaugen-stanley-amount bebdcb8
Add argument checking
tylerhaugen-stanley-amount File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next
Next commit
Add support for the fundamental api
- Loading branch information
commit 4233e13b547188a69a83687a747a6c0aad4a4040
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
spec/config.yml | ||
*.lock | ||
*.gem | ||
.idea |
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 @@ | ||
module Alphavantage | ||
class Fundamental_Data | ||
include HelperFunctions | ||
|
||
def initialize(symbol:, datatype: "json", key:, verbose: false) | ||
@client = return_client(key, verbose) | ||
tylerhaugen-stanley marked this conversation as resolved.
Show resolved
Hide resolved
|
||
@symbol = symbol | ||
@datatype = datatype | ||
end | ||
|
||
def overview(file: nil, datatype: @datatype) | ||
make_request(file: file, datatype: datatype, endpoint: 'OVERVIEW') | ||
end | ||
|
||
def income_statement(file: nil, datatype: @datatype, period: :both) | ||
make_request(file: file, datatype: datatype, endpoint: 'INCOME_STATEMENT') | ||
end | ||
|
||
def balance_sheet(file: nil, datatype: @datatype, period: :both) | ||
payload = make_request(file: file, datatype: datatype, endpoint: 'BALANCE_SHEET') | ||
|
||
return quarterly(payload) if period == :quarterly | ||
return annual(payload) if period == :annual | ||
payload | ||
end | ||
|
||
private | ||
|
||
def make_request(file: nil, datatype: @datatype, endpoint:) | ||
check_datatype(datatype, file) | ||
url = "function=#{endpoint}&symbol=#{@symbol}" | ||
return @client.download(url, file) if datatype == "csv" | ||
@client.request(url) | ||
end | ||
|
||
def quarterly(payload) | ||
payload['quarterlyReports'] | ||
end | ||
|
||
def annual(payload) | ||
payload['annualReports'] | ||
end | ||
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
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 |
---|---|---|
@@ -1,15 +1,17 @@ | ||
require "httparty" | ||
require "humanize" | ||
require "open-uri" | ||
require "ostruct" | ||
require_relative "helper_function" | ||
require_relative "Timeseries" | ||
require_relative "Indicator" | ||
require_relative "Stock" | ||
require_relative "Errors" | ||
require_relative "Exchange" | ||
require_relative "Exchange_Timeseries" | ||
require_relative "Crypto" | ||
require_relative "Crypto_Timeseries" | ||
require_relative "Sector" | ||
require_relative "Client" | ||
require "httparty" | ||
require "humanize" | ||
require "open-uri" | ||
require "ostruct" | ||
require_relative "helper_function" | ||
require_relative "Timeseries" | ||
require_relative "Indicator" | ||
require_relative "Stock" | ||
require_relative "Errors" | ||
require_relative "Exchange" | ||
require_relative "Exchange_Timeseries" | ||
require_relative "Crypto" | ||
require_relative "Crypto_Timeseries" | ||
require_relative "Sector" | ||
require_relative "Client" | ||
require_relative "Fundamental_Data" | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nit] Why?
edit: in description, my bad