Skip to content

Commit f055188

Browse files
authored
Merge pull request #480 from anarghya-das/master
Updated url for stock loan payments
2 parents 4507383 + 000d3ac commit f055188

File tree

3 files changed

+25
-3
lines changed

3 files changed

+25
-3
lines changed

robin_stocks/robinhood/urls.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ def referral_url():
150150

151151

152152
def stockloan_url():
153-
return('https://api.robinhood.com/stock_loan/payments/')
153+
return('https://api.robinhood.com/accounts/stock_loan_payments/')
154154

155155

156156
def subscription_url():

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
long_description = f.read()
88

99
setup(name='robin_stocks',
10-
version='3.1.0',
10+
version='3.1.1',
1111
description='A Python wrapper around the Robinhood API',
1212
long_description=long_description,
1313
long_description_content_type='text/x-rst',

tests/test_robinhood.py

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -835,4 +835,26 @@ def isFloat(f):
835835
assert isFloat(order['quantity'])
836836
assert isFloat(order['cumulative_quantity'])
837837
if(order['state'] == 'filled'):
838-
assert (order['quantity'] == order['cumulative_quantity'])
838+
assert (order['quantity'] == order['cumulative_quantity'])
839+
840+
class TestAccountInformation:
841+
@classmethod
842+
def setup_class(cls):
843+
totp = pyotp.TOTP(os.environ['robin_mfa']).now()
844+
login = r.login(os.environ['robin_username'], os.environ['robin_password'], mfa_code=totp)
845+
846+
def test_get_stock_loan_payments(cls):
847+
def isFloat(f):
848+
try:
849+
float(f)
850+
return True
851+
except ValueError:
852+
return False
853+
854+
loanPayments = r.get_stock_loan_payments()
855+
assert loanPayments
856+
for payment in loanPayments:
857+
assert ('amount' in payment)
858+
assert isFloat(payment['amount']['amount'])
859+
assert ('symbol' in payment)
860+
assert ('description' in payment)

0 commit comments

Comments
 (0)