0

当我尝试在 python 中运行这一行时,使用 Bitmex Rest API

qty2 = self.client.Position.Position_get(json.dumps({'symbol': 'XBTUSD'}),json.dumps({'currentQty'})).result()

我收到这个错误

File "c:/Users/User2/sample_market_maker/SAMPLE/botv2.py", line 113, in place_orders
qty2 = self.client.Position.Position_get(json.dumps({'symbol': 'XBTUSD'}),json.dumps({'currentQty'})).result()
File "c:\users\user2\appdata\local\programs\python\python37-32\Lib\json\__init__.py", line 231, in dumps
return _default_encoder.encode(obj)
File "c:\users\user2\appdata\local\programs\python\python37-32\Lib\json\encoder.py", line 199, in encode
chunks = self.iterencode(o, _one_shot=True)
File "c:\users\user2\appdata\local\programs\python\python37-32\Lib\json\encoder.py", line 257, in iterencode
return _iterencode(o, 0)
File "c:\users\user2\appdata\local\programs\python\python37-32\Lib\json\encoder.py", line 179, in default
raise TypeError(f'Object of type {o.__class__.__name__} '

TypeError: Object of type set is not JSON serializable

我见过如何 JSON 序列化集合?. 它通过示例显示了类似的问题,但我不确定如何在我的代码中实现它。

4

0 回答 0