Giter VIP home page Giter VIP logo

bt-ccxt-store-cn's Issues

样例文件中报错,不知如何解决?

Buy_order 示例文件运行后报错如下:

`HTTPError Traceback (most recent call last)
C:\ProgramData\Anaconda3\lib\site-packages\ccxt\base\exchange.py in fetch(self, url, method, headers, body)
658 self.logger.debug("%s %s, Response: %s %s %s", method, url, http_status_code, headers, http_response)
--> 659 response.raise_for_status()
660

C:\ProgramData\Anaconda3\lib\site-packages\requests\models.py in raise_for_status(self)
952 if http_error_msg:
--> 953 raise HTTPError(http_error_msg, response=self)
954

HTTPError: 400 Client Error: Bad Request for url: https://api.binance.com/api/v3/order

During handling of the above exception, another exception occurred:

BadRequest Traceback (most recent call last)
C:\Users\ADMINI~1\AppData\Local\Temp\2/ipykernel_5980/3713414783.py in
17
18 # Run the strategy
---> 19 cerebro.run()

C:\ProgramData\Anaconda3\lib\site-packages\backtrader-1.9.76.123-py3.9.egg\backtrader\cerebro.py in run(self, **kwargs)
1125 # let's skip process "spawning"
1126 for iterstrat in iterstrats:
-> 1127 runstrat = self.runstrategies(iterstrat)
1128 self.runstrats.append(runstrat)
1129 if self._dooptimize:

C:\ProgramData\Anaconda3\lib\site-packages\backtrader-1.9.76.123-py3.9.egg\backtrader\cerebro.py in runstrategies(self, iterstrat, predata)
1296 self._runnext_old(runstrats)
1297 else:
-> 1298 self._runnext(runstrats)
1299
1300 for strat in runstrats:

C:\ProgramData\Anaconda3\lib\site-packages\backtrader-1.9.76.123-py3.9.egg\backtrader\cerebro.py in _runnext(self, runstrats)
1628 self._check_timers(runstrats, dt0, cheat=False)
1629 for strat in runstrats:
-> 1630 strat._next()
1631 if self._event_stop: # stop if requested
1632 return

C:\ProgramData\Anaconda3\lib\site-packages\backtrader-1.9.76.123-py3.9.egg\backtrader\strategy.py in _next(self)
345
346 def _next(self):
--> 347 super(Strategy, self)._next()
348
349 minperstatus = self._getminperstatus()

C:\ProgramData\Anaconda3\lib\site-packages\backtrader-1.9.76.123-py3.9.egg\backtrader\lineiterator.py in _next(self)
269 minperstatus = self._getminperstatus()
270 if minperstatus < 0:
--> 271 self.next()
272 elif minperstatus == 0:
273 self.nextstart() # only called for the 1st value

C:\Users\ADMINI~1\AppData\Local\Temp\2/ipykernel_5980/1888998214.py in next(self)
14 # size x price should be >10 USDT at a minimum at Binance
15 # make sure you use a price that is below the market price if you don't want to actually buy
---> 16 self.order = self.buy(size=10, exectype=Order.Limit, price=35000)
17 # And immediately cancel the buy order
18 self.cancel(self.order);

C:\ProgramData\Anaconda3\lib\site-packages\backtrader-1.9.76.123-py3.9.egg\backtrader\strategy.py in buy(self, data, size, price, plimit, exectype, valid, tradeid, oco, trailamount, trailpercent, parent, transmit, **kwargs)
931
932 if size:
--> 933 return self.broker.buy(
934 self, data,
935 size=abs(size), price=price, plimit=plimit,

C:\ProgramData\Anaconda3\lib\site-packages\bt_ccxt_store-1.0-py3.9.egg\ccxtbt\ccxtbroker.py in buy(self, owner, data, size, price, plimit, exectype, valid, tradeid, oco, trailamount, trailpercent, **kwargs)
300 del kwargs['parent']
301 del kwargs['transmit']
--> 302 return self._submit(owner, data, exectype, 'buy', size, price, kwargs)
303
304 def sell(self, owner, data, size, price=None, plimit=None,

C:\ProgramData\Anaconda3\lib\site-packages\bt_ccxt_store-1.0-py3.9.egg\ccxtbt\ccxtbroker.py in _submit(self, owner, data, exectype, side, amount, price, params)
287 params = params['params'] if 'params' in params else params
288 params['created'] = created # Add timestamp of order creation for backtesting
--> 289 ret_ord = self.store.create_order(symbol=data.p.dataname, order_type=order_type, side=side, amount=amount, price=price, params=params)
290 order = CCXTOrder(owner, data, exectype, side, amount, price, ret_ord)
291 self.open_orders.append(order)

C:\ProgramData\Anaconda3\lib\site-packages\bt_ccxt_store-1.0-py3.9.egg\ccxtbt\ccxtstore.py in retry_method(self, *args, **kwargs)
138 time.sleep(self.exchange.rateLimit / 1000)
139 try:
--> 140 return method(self, *args, **kwargs)
141 except (NetworkError, ExchangeError):
142 if i == self.retries - 1:

C:\ProgramData\Anaconda3\lib\site-packages\bt_ccxt_store-1.0-py3.9.egg\ccxtbt\ccxtstore.py in create_order(self, symbol, order_type, side, amount, price, params)
166 def create_order(self, symbol, order_type, side, amount, price, params):
167 # returns the order
--> 168 return self.exchange.create_order(symbol=symbol, type=order_type, side=side,
169 amount=amount, price=price, params=params)
170

C:\ProgramData\Anaconda3\lib\site-packages\ccxt\binance.py in create_order(self, symbol, type, side, amount, price, params)
2722 params = self.omit(params, 'stopPrice')
2723 request['stopPrice'] = self.price_to_precision(symbol, stopPrice)
-> 2724 response = getattr(self, method)(self.extend(request, params))
2725 return self.parse_order(response, market)
2726

C:\ProgramData\Anaconda3\lib\site-packages\ccxt\base\exchange.py in inner(_self, params, context)
499 if context is not None:
500 inner_kwargs['context'] = params
--> 501 return entry(_self, **inner_kwargs)
502 return inner
503 to_bind = partialer()

C:\ProgramData\Anaconda3\lib\site-packages\ccxt\binance.py in request(self, path, api, method, params, headers, body, config, context)
4953
4954 def request(self, path, api='public', method='GET', params={}, headers=None, body=None, config={}, context={}):
-> 4955 response = self.fetch2(path, api, method, params, headers, body, config, context)
4956 # a workaround for {"code":-2015,"msg":"Invalid API-key, IP, or permissions for action."}
4957 if (api == 'private') or (api == 'wapi'):

C:\ProgramData\Anaconda3\lib\site-packages\ccxt\base\exchange.py in fetch2(self, path, api, method, params, headers, body, config, context)
546 self.lastRestRequestTimestamp = self.milliseconds()
547 request = self.sign(path, api, method, params, headers, body)
--> 548 return self.fetch(request['url'], request['method'], request['headers'], request['body'])
549
550 def request(self, path, api='public', method='GET', params={}, headers=None, body=None, config={}, context={}):

C:\ProgramData\Anaconda3\lib\site-packages\ccxt\base\exchange.py in fetch(self, url, method, headers, body)
673 except HTTPError as e:
674 details = ' '.join([self.id, method, url])
--> 675 skip_further_error_handling = self.handle_errors(http_status_code, http_status_text, url, method, headers, http_response, json_response, request_headers, request_body)
676 if not skip_further_error_handling:
677 self.handle_http_status_code(http_status_code, http_status_text, url, method, http_response)

C:\ProgramData\Anaconda3\lib\site-packages\ccxt\binance.py in handle_errors(self, code, reason, url, method, headers, body, response, requestHeaders, requestBody)
4931 return True
4932 feedback = self.id + ' ' + body
-> 4933 self.throw_exactly_matched_exception(self.exceptions['exact'], error, feedback)
4934 raise ExchangeError(feedback)
4935 if not success:

C:\ProgramData\Anaconda3\lib\site-packages\ccxt\base\exchange.py in throw_exactly_matched_exception(self, exact, string, message)
564 def throw_exactly_matched_exception(self, exact, string, message):
565 if string in exact:
--> 566 raise exactstring
567
568 def throw_broadly_matched_exception(self, broad, string, message):

BadRequest: binance {"code":-1104,"msg":"Not all sent parameters were read; read '11' parameter(s) but was sent '12'."}

`

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.