kucoin-python-sdk
kucoin-python-sdk copied to clipboard
position internal error
Getting this error on a market send request {'code': '200000', 'msg': 'position internal error'}
symbol = "1INCH/USDT"
side = "buy"
amount = 10
order_id = kt.market_order(symbol=symbol,
side=side,
amount=amount)
the market_order source
def market_order(self, symbol: str, side: str, amount: float) -> str:
"""
:param symbol: trading pare
:param side: "buy"/"sell"
:param amount:
:return: order_id
:raise: IncuficcientBallance, NetworkError
"""
params = {
"symbol": symbol,
"side": side,
"type": "market",
"size": amount
}
params['clientOid'] = clientOid = self.get_unique_id()
data_json = json.dumps(params)
url = self.base + "/api/v1/margin/order"
now = int(time.time() * 1000)
str_to_sign = str(now) + 'POST' + '/api/v1/margin/order' + data_json
signature = base64.b64encode(
hmac.new(self.API_SECRET.encode('utf-8'), str_to_sign.encode('utf-8'), hashlib.sha256).digest())
passphrase = base64.b64encode(hmac.new(self.API_SECRET.encode(
'utf-8'), self.TRADING_PASSPHRASE.encode('utf-8'), hashlib.sha256).digest())
headers = {
"KC-API-SIGN": signature,
"KC-API-TIMESTAMP": str(now),
"KC-API-KEY": self.API_KEY,
"KC-API-PASSPHRASE": passphrase,
"KC-API-KEY-VERSION": "2",
"Content-Type": "application/json"
}
try:
response = requests.post(url, headers=headers, data=data_json)
except NetworkError as e:
raise Exception(e)
if response.status_code == 200:
return response.json()["data"]["orderOid"] # return order id on success
return response.json()
else:
raise Exception(response.json()["msg"])
the return code:
```python
{'code': '200000', 'msg': 'position internal error'}
I think this is a n internal error on your end is that correct??
1INCH/USDT
symbol = "1INCH-USDT"
NOT 1INCH/USDT
Since this issue has already been addressed and there have been no updates for a long time, we will now close it. If you need any further assistance, feel free to ask!