Search code examples
pythonstock

module 'robin_stocks' has no attribute 'get_current_positions'


This is my first time using the robinhood api and I am trying out their documentation: https://readthedocs.org/projects/robin-stocks/downloads/pdf/latest/, but one of their key functions is not working. When I call robin_stocks.get_current_positions() I get the error

AttributeError: module 'robin_stocks' has no attribute 'get_current_positions'

Here is my code:

import robin_stocks, json
from robin_stocks import *
import robin_stocks as r
import sys
import time
import requests

content = open('config.json').read()
config = json.loads(content)

login = r.login(config['username'],config['password'], store_session=True)

my_stocks = robin_stocks.build_holdings()
for key,value in my_stocks.items():
    mystocks = key,value

print(mystocks)

WEIbalance = mystocks[1]['equity']
WEI = mystocks[0]
print('YY', WEI)
positions_data = robin_stocks.get_current_positions()

print('my equity', WEIbalance)
print(positions_data)

Is this an error on my part?


Solution

  • As of this commit get_current_positions was renamed to get_open_stock_positions() the corresponding issue can be found here