Skip to content

Commit

Permalink
updated url for stock loan payments
Browse files Browse the repository at this point in the history
  • Loading branch information
anarghya-das committed Jul 5, 2024
1 parent 4507383 commit 8a78c1e
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
2 changes: 1 addition & 1 deletion robin_stocks/robinhood/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def referral_url():


def stockloan_url():
return('https://api.robinhood.com/stock_loan/payments/')
return('https://api.robinhood.com/accounts/stock_loan_payments/')


def subscription_url():
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
long_description = f.read()

setup(name='robin_stocks',
version='3.1.0',
version='3.1.1',
description='A Python wrapper around the Robinhood API',
long_description=long_description,
long_description_content_type='text/x-rst',
Expand Down
23 changes: 22 additions & 1 deletion tests/test_robinhood.py
Original file line number Diff line number Diff line change
Expand Up @@ -835,4 +835,25 @@ def isFloat(f):
assert isFloat(order['quantity'])
assert isFloat(order['cumulative_quantity'])
if(order['state'] == 'filled'):
assert (order['quantity'] == order['cumulative_quantity'])
assert (order['quantity'] == order['cumulative_quantity'])

class TestAccountInformation:
@classmethod
def setup_class(cls):
totp = pyotp.TOTP(os.environ['robin_mfa']).now()
login = r.login(os.environ['robin_username'], os.environ['robin_password'], mfa_code=totp)

def test_get_stock_loan_payments(cls):
def isFloat(f):
try:
float(f)
return True
except ValueError:
return False

loanPayments = r.get_stock_loan_payments()
assert loanPayments
for payment in loanPayments:
assert isFloat(payment['amount']['amount'])
assert ('symbol' in payment)
assert ('description' in payment)

0 comments on commit 8a78c1e

Please sign in to comment.