binance / binance-futures-connector-python

MIT License
738 stars 219 forks source link

API.sign_request() takes from 3 to 4 positional arguments but 5 were given #150

Open youngqqcn opened 8 months ago

youngqqcn commented 8 months ago

API.sign_request() takes from 3 to 4 positional arguments but 5 were given

RandomEstimate commented 3 months ago

need to change the source code.

/binance/um_futures/account.py

def new_batch_order(self, batchOrders: list):
    params = {"batchOrders": batchOrders}
    url_path = "/fapi/v1/batchOrders"
    return self.sign_request("POST", url_path, params)

import json

from binance.um_futures import UMFutures
import constant

if __name__ == '__main__':
    um_futures_client = UMFutures(key=constant.BINANCE_KEY, secret=constant.BINANCE_SECRET,
                                  base_url=constant.BINANCE_BASE_URL, proxies=constant.PROXY)
    params = [
        {
            "symbol": "ETHUSDT",
            "side": "BUY",
            "type": "MARKET",
            "quantity": "0.01",
        },
    ]

    resp = um_futures_client.new_batch_order(json.dumps(params))
    print(resp)