Closed ghost closed 4 years ago
getting a similar error in previously working code, did they change somthing?
Just tested non-async version and seems to be working.
@CryptoGnome in short, yes: https://github.com/ccxt/ccxt/issues/7454
This is the clip I was using FYI - Thanks for the amazing support @kroitor
exchange.create_limit_sell_order(self.pair, abs(self.size), int(self.takeprofit), {'reduce_only': True})
Well, just tried the code transformed from async and it still keeps throwing the same so I don't know.
Totally weird, int(...code to get the price from a list...) works. I guess the problem could be it doesn't accept like 11550.0, only 11550?
Basically what's in @CryptoGnome's code.
@ZB83486 is your version of CCXT up to date?
import ccxt
print(ccxt.__version__) # what does it say?
pip3 show ccxt Name: ccxt Version: 1.33.53
int(price) seems to be working though I am not sure why that is or how that can be, I guess it's not even really a problem of CCXT in this case.
@ZB83486 nope, i mean the actual runtime version (not a pip3 output), please run your python3 interpreter and type:
# in python
import ccxt
print(ccxt.__version__)
Just asking, since this version has been addressed before and we have to isolate it if it's still there.
import ccxt
print(ccxt.__version__)
1.33.53
I am on
1.33.27
Guess i should update
Anyway, basically, I am fine with that for now because I can work with only integer number variables, and I guess it could work with half decimals too having done some tweaking (probably won't be accepting the full numbers with decimals .0 so needs rounding). I have reversed all the code back to async again and it just runs fine for the time being.
@ZB83486 with the implicit privatePostOrderCreate
you have to format the values according to the ByBit API docs. As you can see from here: https://bybit-exchange.github.io/docs/inverse/#t-placeactive Bybit requires the amount for Inverse swaps (USD contracts) to be an integer. If you use the CCXT's unified createOrder
method instead of privatePostOrderCreate
CCXT will resolve this for you. If you're using the implicit methods directly, then you should pre-format your values correctly.
@CryptoGnome lmk if you have the same issue with the most recent version of the lib.
@kroitor Yes same issue after update
bybit {"ret_code":10004,"ret_msg":"error sign! origin_string[api_key=keygoeshere\u0026order_type=Limit\u0026price=11372.0\u0026qty=2\u0026recv_window=5000\u0026reduce_only=true\u0026side=Buy\u0026symbol=BTCUSD\u0026time_in_force=GoodTillCancel\u0026timestamp=1598473350183]","ext_code":"","ext_info":"","result":null,"time_now":"1598473350.878895"}
Yeah, I haven't checked that, sorry, though it still seems a bit odd to me that this matters at all in the present day and logs itself as an auth problem(?). Never mind, thanks a lot for your time, I appreciate it knowing you must have a lot of work to do on the project. Take care.
Traceback (most recent call last):
File "C:/Users/oimap/Desktop/LickHunterPro2/bybitProfit.py", line 258, in <module>
bot.start_bot()
File "C:/Users/oimap/Desktop/LickHunterPro2/bybitProfit.py", line 249, in start_bot
bot.check_positions(pairs)
File "C:/Users/oimap/Desktop/LickHunterPro2/bybitProfit.py", line 101, in check_positions
bot.take_profit(self.symbol)
File "C:/Users/oimap/Desktop/LickHunterPro2/bybitProfit.py", line 144, in take_profit
bot.cancel_tp()
File "C:/Users/oimap/Desktop/LickHunterPro2/bybitProfit.py", line 215, in cancel_tp
bot.short_profit()
File "C:/Users/oimap/Desktop/LickHunterPro2/bybitProfit.py", line 239, in short_profit
exchange.create_limit_buy_order(self.pair, abs(self.size), int(self.takeprofit), {"reduce_only": True})
File "C:\Users\oimap\Desktop\LickHunterPro2\venv\lib\site-packages\ccxt\base\exchange.py", line 1801, in create_limit_buy_order
return self.create_order(symbol, 'limit', 'buy', *args)
File "C:\Users\oimap\Desktop\LickHunterPro2\venv\lib\site-packages\ccxt\bybit.py", line 1248, in create_order
response = getattr(self, method)(self.extend(request, params))
File "C:\Users\oimap\Desktop\LickHunterPro2\venv\lib\site-packages\ccxt\base\exchange.py", line 465, in inner
return entry(_self, **inner_kwargs)
File "C:\Users\oimap\Desktop\LickHunterPro2\venv\lib\site-packages\ccxt\base\exchange.py", line 490, in request
return self.fetch2(path, api, method, params, headers, body)
File "C:\Users\oimap\Desktop\LickHunterPro2\venv\lib\site-packages\ccxt\base\exchange.py", line 486, in fetch2
return self.fetch(request['url'], request['method'], request['headers'], request['body'])
File "C:\Users\oimap\Desktop\LickHunterPro2\venv\lib\site-packages\ccxt\base\exchange.py", line 608, in fetch
self.handle_errors(http_status_code, http_status_text, url, method, headers, http_response, json_response, request_headers, request_body)
File "C:\Users\oimap\Desktop\LickHunterPro2\venv\lib\site-packages\ccxt\bybit.py", line 2057, in handle_errors
raise ExchangeError(feedback) # unknown message
ccxt.base.errors.ExchangeError: bybit {"ret_code":10004,"ret_msg":"error sign! origin_string[api_key=KEYGOESHERE\u0026order_type=Limit\u0026price=11372.0\u0026qty=2\u0026recv_window=5000\u0026reduce_only=true\u0026side=Buy\u0026symbol=BTCUSD\u0026time_in_force=GoodTillCancel\u0026timestamp=1598473514315]","ext_code":"","ext_info":"","result":null,"time_now":"1598473515.030975"}
@ZB83486
and logs itself as an auth problem(?)
Yeah, not all exchanges are super-consistent with their error reporting. Anyways, glad you've figured it out.
@CryptoGnome can you post a snippet of code to reproduce it, including the exchange instantiation, but without your keys?
PYTHON:
self.pair = 'BTCUSD' self.size = -2 self.takeprofit = 11500.50
def long_profit(self):
print("Placing Long Take Profit", self.pair)
exchange.create_limit_sell_order(self.pair, abs(self.size), int(self.takeprofit), {'reduce_only': True})
To note i am able to call positions and use market orders, only limits are failing.
@CryptoGnome i'll check that and will get back to you asap.
Hey @kroitor, I know you are busy, wanted to check if had a chance to look at his or if there is currently a workaround, kind of surprised no one else is reporting this...
@CryptoGnome pardon for the delay, i'll debug this on my side and will let you know shortly
@CryptoGnome let me know if you have the same issue with version 1.33.76+, it will arrive in 15 minutes. If you still have errors, please follow the guidelines precisely and paste your entire verbose output here:
import ccxt
from pprint import pprint
print('CCXT Version:', ccxt.__version__)
exchange = ccxt.bybit({
'enableRateLimit': True,
'apiKey': 'YOUR_API_KEY',
'secret': 'YOUR_SECRET',
})
markets = exchange.load_markets()
symbol = 'BTC/USD'
type = 'limit'
side = 'sell'
amount = 2
price = 11500
params = {
"reduce_only": True
}
exchange.verbose = True
order = exchange.create_order(symbol, type, side, amount, price, params)
pprint(order)
Fixed! You sir a legend, thank you for resolving this!
Seems to have been fixed for me as well, thanks.
@CryptoGnome @ZB83486 thanks for your feedback!
Sure thing, just a little update. It seems that openapiPostOrderReplace endpoint keeps throwing that error (only async tested). Could you check that?
@ZB83486 plz run and post the output of this snippet here: https://github.com/ccxt/ccxt/issues/7515#issuecomment-683950512
I'll try to reproduce it again manually when I have time and let you know, thanks. Think it was the price adjustment (not qty) to be precise but let's see.
Hi, I am getting this error below when I try to create an order on Bybit. I am sure the parameters should be correct. Also, I have some other private calls before that in my code which work and fetch data just fine.