Skip to content

Commit

Permalink
adding default datatypes to stock price methods
Browse files Browse the repository at this point in the history
  • Loading branch information
xrgarcia committed May 22, 2022
1 parent eb9b1a1 commit 2c75980
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 839 deletions.
4 changes: 2 additions & 2 deletions alphavantage_api_client/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ def main():
# your API key can be in ~/alphavantage ini file or in event['api_key'] = 'your key here'
client = AlphavantageClient()
result['overview'] = client.get_company_overview(event)
#result['latest_stock_price'] = client.get_latest_stock_price(event)
result['latest_stock_price'] = client.get_latest_stock_price(event)
#result['stock_price'] = client.get_stock_price(event)
#result['earnings'] = client.get_earnings(event)
#result['latest_earnings'] = client.get_latest_earnings(event)
#result['cash_flow'] = client.get_cash_flow(event)
#result['latest_cash_flow'] = client.get_latest_cash_flow(event)
#result['income_statement'] = client.get_income_statement_for_symbol(event)
result['latest_income_statement'] = client.get_latest_income_statement_for_symbol(event)
#result['latest_income_statement'] = client.get_latest_income_statement_for_symbol(event)
print(json.dumps(result))

if __name__ == "__main__":
Expand Down
4 changes: 3 additions & 1 deletion alphavantage_api_client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import os
import configparser


class AlphavantageClient:
__api_key__ = ""

Expand Down Expand Up @@ -58,7 +59,8 @@ def get_stock_price(self, event, context=None):
if "symbol" not in event:
raise ValueError("You must pass in symbol to get stock price")
req = {
"symbol": event['symbol']
"symbol": event['symbol'],
"datatype": "json"
}
json_response = self.get_stock_price_from_alpha_vantage(req)
if json_response == None:
Expand Down
Loading

0 comments on commit 2c75980

Please sign in to comment.