Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ElijahBarbour opened this issue Feb 27, 2023 · 1 comment
Labels

Comments

@ElijahBarbour
Copy link

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.

Copy link

github-actions bot commented Nov 8, 2024

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.

@github-actions github-actions bot added the Stale label Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant