You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to place a trade using the paper account, however im getting an error saying i dont have permission to access this resource.
i'm not able to find any info on what could be the problem, does anyone knows what could be causing the error?
import time
from config import CONSUMER_KEY, REDIRECT_URI, JSON_PATH, ACCOUNT_NUMBER
from hqtrades import TD_ACCOUNT
from datetime import datetime
from datetime import timedelta
import pprint
import pandas as pd
# Import the client
from td.client import TDClient
# Create a new session, credentials path is required.
TDSession = TDClient(
client_id=CONSUMER_KEY,
redirect_uri=REDIRECT_URI,
credentials_path='JSON_PATH',
account_number=ACCOUNT_NUMBER
)
# Login to the session
TDSession.login()
# Define the Order.
order_template = buy_limit_enter = {
"orderType": "LIMIT",
"session": "NORMAL",
"duration": "DAY",
"price": 10.0,
"orderStrategyType": "SINGLE",
"orderLegCollection": [
{
"instruction": "BUY",
"quantity": 1,
"instrument": {
"symbol": "MSFT",
"assetType": "EQUITY"
}
}
]
}
# Place the Order.
order_response = TDSession.place_order(
account=ACCOUNT_NUMBER,
order=order_template
)
# Print the Response.
pprint.pprint(order_response)
Below are the results:
Traceback (most recent call last):
File "F:\using_td_library.py", line 145, in <module>
order_response = TDSession.place_order(
File "F:\venv\lib\site-packages\td\client.py", line 1925, in place_order
return self._make_request(method='post', endpoint=endpoint, mode='json', json=order, order_details=True)
File "F:\venv\lib\site-packages\td\client.py", line 624, in _make_request
raise ForbidError(message=response.text)
td.exceptions.ForbidError: {
"error" : "You don't have permission to access this resource."
}
Process finished with exit code 1
The text was updated successfully, but these errors were encountered:
Hi All
I'm trying to place a trade using the paper account, however im getting an error saying i dont have permission to access this resource.
i'm not able to find any info on what could be the problem, does anyone knows what could be causing the error?
Below are the results:
The text was updated successfully, but these errors were encountered: