jessecooper / pyetrade

Python E-Trade API Wrapper
GNU General Public License v3.0
209 stars 97 forks source link

Exception: 500 Server Error: Internal Server Error for url When using preview_equity_order function #79

Open ElijahBarbour opened 1 year ago

ElijahBarbour commented 1 year ago

Hello. I am getting:

Exception: 500 Server Error: Internal Server Error for url

when using preview_equity_order function. With this error, it is giving a hyperlink to this message:

Unauthorized request - invalid Consumer key and/or session token

Here is my code that uses the Order Module:

class Order: def init(self,etrade_session) -> None: self.orders = pyetrade.ETradeOrder( client_key=etrade_session.consumer_key, client_secret=etrade_session.consumer_secret, resource_owner_key=etrade_session.tokens['oauth_token'], resource_owner_secret=etrade_session.tokens['oauth_token_secret'], dev=etrade_session.dev, )

def preview_equity_order(self,**kwargs):
    self.orders.preview_equity_order(
        resp_format='json',
        **kwargs
    )

Here is the call to the function: (GOOG is used as an example for sandbox, I have a local "orders" variable that is created of Class Order above. Within this class, I am defining preview_equity_order. Basically, all I am doing is waterfalling variables from local preview_equity_order function to the pyetrade preview_equity_order function. The following code is called from main program.

    preview_order = orders.preview_equity_order(
        accountId=accountID,
        symbol="GOOG",
        orderAction="BUY",
        clientOrderId=Generator.get_random_alphanumeric_string(20),
        priceType="MARKET",
        allOrNone=False,
        quantity=1,
        marketSession="REGULAR",
        orderTerm="GOOD_FOR_DAY",
        routingDestination="NYSE",
    )

the **kwargs within the locally defined preview_equity_order catches all variables from the local call and throws them to the pyetrade preview_equity_order function.

If anyone wants to jump on a Zoom call or discord im more than willing to.

github-actions[bot] commented 1 hour ago

This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 5 days.