delta-exchange / python-rest-client

https://pypi.org/project/delta-rest-client/
13 stars 19 forks source link

Unauthorized for url ! #44

Closed JunaidAfr closed 7 months ago

JunaidAfr commented 7 months ago

Could you please help me solve this problem and please explain how to place the original order for trading?

code:-

from delta_rest_client import DeltaRestClient, create_order_format, cancel_order_format, round_by_tick_size, OrderType, TimeInForce import requests import time

delta_client = DeltaRestClient( base_url='https://testnet-api.delta.exchange', api_key=' ', api_secret=' ', )

starttime = time.time() product_id = 84

Create Order

order1 = create_order_format(product_id=product_id, size=10, side="sell", price=9000) delta_client.create_order(order1) # will create order on testnet

error response:-

delta_client.create_order(order1)  # will create order on testnet

File "C:\Program Files\Python311\Lib\site-packages\delta_rest_client\delta_rest_client.py", line 87, in create_order response = self.request('POST', "/v2/orders", order, auth=True) File "C:\Program Files\Python311\Lib\site-packages\delta_rest_client\delta_rest_client.py", line 64, in request res.raise_for_status() File "C:\Program Files\Python311\Lib\site-packages\requests\models.py", line 1021, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://testnet-api.delta.exchange/v2/orders