Dave-Vallance / bt-ccxt-store

Fork of Ed Bartosh's CCXT Store Work
MIT License
420 stars 187 forks source link

1104 error when create order in biance sandbox #42

Open ijasperyang opened 3 years ago

ijasperyang commented 3 years ago

CCXTBroker._submit() should be updated to not use 'created' parameter.

Traceback (most recent call last): File "./main.py", line 132, in main() File "./main.py", line 117, in main result = cerebro.run() File "/home/wdog/anaconda3/envs/cell/lib/python3.8/site-packages/backtrader/cerebro.py", line 1127, in run runstrat = self.runstrategies(iterstrat) File "/home/wdog/anaconda3/envs/cell/lib/python3.8/site-packages/backtrader/cerebro.py", line 1298, in runstrategies self._runnext(runstrats) File "/home/wdog/anaconda3/envs/cell/lib/python3.8/site-packages/backtrader/cerebro.py", line 1630, in _runnext strat._next() File "/home/wdog/anaconda3/envs/cell/lib/python3.8/site-packages/backtrader/strategy.py", line 347, in _next super(Strategy, self)._next() File "/home/wdog/anaconda3/envs/cell/lib/python3.8/site-packages/backtrader/lineiterator.py", line 271, in _next self.next() File "/home/wdog/cellboost/strategies/basic_rsi.py", line 46, in next self.long() File "/home/wdog/cellboost/strategies/base.py", line 61, in long return self.buy(size=amount) File "/home/wdog/anaconda3/envs/cell/lib/python3.8/site-packages/backtrader/strategy.py", line 933, in buy return self.broker.buy( File "/home/wdog/anaconda3/envs/cell/lib/python3.8/site-packages/ccxtbt/ccxtbroker.py", line 244, in buy return self._submit(owner, data, exectype, 'buy', size, price, kwargs) File "/home/wdog/anaconda3/envs/cell/lib/python3.8/site-packages/ccxtbt/ccxtbroker.py", line 226, in _submit ret_ord = self.store.create_order(symbol=data.p.dataname, order_type=order_type, side=side, File "/home/wdog/anaconda3/envs/cell/lib/python3.8/site-packages/ccxtbt/ccxtstore.py", line 142, in retry_method return method(self, *args, kwargs) File "/home/wdog/anaconda3/envs/cell/lib/python3.8/site-packages/ccxtbt/ccxtstore.py", line 172, in create_order return self.exchange.create_order(symbol=symbol, type=order_type, side=side, File "/home/wdog/anaconda3/envs/cell/lib/python3.8/site-packages/ccxt/binance.py", line 1911, in create_order response = getattr(self, method)(self.extend(request, params)) File "/home/wdog/anaconda3/envs/cell/lib/python3.8/site-packages/ccxt/base/exchange.py", line 470, in inner return entry(_self, inner_kwargs) File "/home/wdog/anaconda3/envs/cell/lib/python3.8/site-packages/ccxt/binance.py", line 2907, in request response = self.fetch2(path, api, method, params, headers, body) File "/home/wdog/anaconda3/envs/cell/lib/python3.8/site-packages/ccxt/base/exchange.py", line 491, in fetch2 return self.fetch(request['url'], request['method'], request['headers'], request['body']) File "/home/wdog/anaconda3/envs/cell/lib/python3.8/site-packages/ccxt/base/exchange.py", line 618, in fetch self.handle_errors(http_status_code, http_status_text, url, method, headers, http_response, json_response, request_headers, request_body) File "/home/wdog/anaconda3/envs/cell/lib/python3.8/site-packages/ccxt/binance.py", line 2901, in handle_errors self.throw_exactly_matched_exception(self.exceptions, error, feedback) File "/home/wdog/anaconda3/envs/cell/lib/python3.8/site-packages/ccxt/base/exchange.py", line 509, in throw_exactly_matched_exception raise exactstring ccxt.base.errors.BadRequest: binance {"code":-1104,"msg":"Not all sent parameters were read; read '9' parameter(s) but was sent '10'."}

DEBUG:ccxt.base.exchange:POST https://testnet.binance.vision/api/v3/order, Request: {'X-MBX-APIKEY': '', 'Content-Type': 'application/x-www-form-urlencoded', 'User-Agent': 'python-requests/2.21.0', 'Accept-Encoding': 'gzip, deflate'} timestamp=1617953716986&recvWindow=5000&symbol=BTCUSDT&type=MARKET&side=BUY&newClientOrderId=x-R4BD3S82c6b4080059babf27962668&newOrderRespType=FULL&quantity=1.1&created=1617874020000&signature=912c3bf95905f2cf2cd66fcd4d5eefe61c7a584ab14c3990be158ae9b1ff157a DEBUG:urllib3.connectionpool:https://testnet.binance.vision:443 "POST /api/v3/order HTTP/1.1" 400 98 DEBUG:ccxt.base.exchange:POST https://testnet.binance.vision/api/v3/order, Response: 400 {'Content-Type': 'application/json;charset=UTF-8', 'Content-Length': '98', 'Connection': 'keep-alive', 'Date': 'Fri, 09 Apr 2021 07:35:17 GMT', 'Server': 'nginx', 'x-mbx-uuid': '0e33c5e5-d105-49fa-8d58-8ff5cb6c2f07', 'x-mbx-used-weight': '33', 'x-mbx-used-weight-1m': '33', 'Strict-Transport-Security': 'max-age=31536000; includeSubdomains', 'X-Frame-Options': 'SAMEORIGIN', 'X-Xss-Protection': '1; mode=block', 'X-Content-Type-Options': 'nosniff', 'Content-Security-Policy': "default-src 'self'", 'X-Content-Security-Policy': "default-src 'self'", 'X-WebKit-CSP': "default-src 'self'", 'Cache-Control': 'no-cache, no-store, must-revalidate', 'Pragma': 'no-cache', 'Expires': '0', 'X-Cache': 'Error from cloudfront', 'Via': '1.1 eb66232d6b1e64b4346cf2ac56fa1bd5.cloudfront.net (CloudFront)', 'X-Amz-Cf-Pop': 'NRT20-C2', 'X-Amz-Cf-Id': 'W_6cdF_R2isHiq9bKB3c6QRfbxdDnNulBpOxpXikxWZZIU0mEn4kPA=='} {"code":-1104,"msg":"Not all sent parameters were read; read '9' parameter(s) but was sent '10'."}

hoflz5 commented 3 years ago

Yeah, I also noticed this issue.

mped-oticon commented 3 years ago

https://github.com/Dave-Vallance/bt-ccxt-store/pull/44 works for me.

868jjm commented 2 years ago

44 works for me.

How did you?