INNER CODE UNIT · Python

__curl_binancefutures

nkaz001/sample-trading-bot · tradingbot/binancefutures.py:120

    async def __curl_binancefutures(self, path, query=None, timeout=None, verb=None, rethrow_errors=True, max_retries=None):
        if timeout is None:
            timeout = self.timeout

        # Default to POST if data is attached, GET otherwise
        if not verb:
            verb = 'POST' if query else 'GET'

        # By default don't retry POST or PUT. Retrying GET/DELETE is okay because they are idempotent.
        # In the future we could allow retrying PUT, so long as 'leavesQty' is not used (not idempotent),
        # or you could change the clOrdID (set {"clOrdID": "new", "origClOrdID": "old"}) so that an amend
        # can't erroneously be applied twice.
        if max_retries is None:
            max_retries = 0 if verb in ['POST', 'PUT'] else 3

        if query is None:
            query = {}
        query['timestamp'] = str(int(time.time() * 1000) - 1000)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…