Skip to content

Commit

Permalink
added test
Browse files Browse the repository at this point in the history
  • Loading branch information
AxelGard committed Nov 1, 2021
1 parent dd93a31 commit 11ae3ff
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 12 deletions.
6 changes: 2 additions & 4 deletions temp.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,5 @@
"""


stk = cira.Stock("MMLP")
stks = [stk]

portfolio.sell_list(lst=stks)
stk = cira.Stock("TSLA")
print(stk.historical_data(10))
27 changes: 19 additions & 8 deletions tests/test_stock.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,28 @@

def test_stock():
""" test relatied to the stock class """
portfolio = cira.Portfolio()
exchange = cira.Exchange()
portfolio = cira.Portfolio()
exchange = cira.Exchange()
stk = cira.Stock("PYPL")

assert stk.is_shortable == True
assert stk.can_borrow == True
assert stk.is_tradable == True
assert stk.is_shortable == True
assert stk.can_borrow == True
assert stk.is_tradable == True

assert stk + 2 == stk.price + 2
assert stk - 2 == stk.price - 2
assert stk * 2 == stk.price * 2
assert stk + 2 == stk.price + 2
assert stk - 2 == stk.price - 2
assert stk * 2 == stk.price * 2
for op in (operator.add, operator.sub, operator.mul, operator.truediv, operator.floordiv):
assert op(stk, 2) == op(stk.price, 2), f"test of op {op}"


def test_is_shortable():
pass

def test_historical_data():
""" Test that we historical data can be collected """
portfolio = cira.Portfolio()
exchange = cira.Exchange()
stk = cira.Stock("PYPL")
days = 10
assert len(stk.historical_data(days)) == days

0 comments on commit 11ae3ff

Please sign in to comment.