Skip to content

Commit

Permalink
Merge branch 'efficiency'
Browse files Browse the repository at this point in the history
  • Loading branch information
alvarob96 committed Mar 5, 2019
2 parents e7736c2 + faf0c1f commit 85807a2
Show file tree
Hide file tree
Showing 12 changed files with 551 additions and 447 deletions.
4 changes: 4 additions & 0 deletions .idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/investpy.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

469 changes: 195 additions & 274 deletions .idea/workspace.xml

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ install:
- pip install pandas==0.23.4
- pip install requests==2.21.0
- pip install beautifulsoup4==4.7.1
- pip install investpy==0.4
- pip install investpy_test==1.4
- pip install pytest==4.1.1
- pip install lxml==4.3.2

script:
- pytest
27 changes: 24 additions & 3 deletions investpy/Data.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,13 @@ class Data(object):
Methods
-------
equity_to_dict()
converts the equity object into a dictionary (JSON format)
converts the equity object into a dictionary
equity_as_json()
converts the equity object into a JSON object
fund_to_dict()
converts the fund object into a dictionary (JSON format)
converts the fund object into a dictionary
fund_as_json()
converts the fund object into a JSON object
"""

def __init__(self, date_, close_, open_, max_, min_, volume_):
Expand All @@ -40,11 +44,28 @@ def equity_to_dict(self):
'Volume': self.volume,
}

def equity_as_json(self):
return {self.date.strftime('%d/%m/%Y'): {
'Close': self.close,
'Open': self.open,
'Max': self.max,
'Min': self.min,
'Volume': self.volume,
}}

def fund_to_dict(self):
return {
'Date': self.date,
'Close': self.close,
'Open': self.open,
'Max': self.max,
'Min': self.min,
}
}

def fund_as_json(self):
return {self.date.strftime('%d/%m/%Y'): {
'Close': self.close,
'Open': self.open,
'Max': self.max,
'Min': self.min,
}}
Loading

0 comments on commit 85807a2

Please sign in to comment.