hootnot / oanda-api-v20

OANDA REST-V20 API wrapper. Easy access to OANDA's REST v20 API with oandapyV20 package. Checkout the Jupyter notebooks!
MIT License
398 stars 107 forks source link

{"errorMessage":"Missing JSON body"} error response in TradeClose #172

Closed bestoak closed 3 years ago

bestoak commented 3 years ago

Every time i call trades.TradeClose, below error occurs. It works fine last week, but happened all the time since today. Does anyone have same problem or how can i solve this issue?

File "/usr/local/lib/python3.8/site-packages/oandapyV20/oandapyV20.py", line 305, in request response = self.__request(method, url, File "/usr/local/lib/python3.8/site-packages/oandapyV20/oandapyV20.py", line 243, in __request raise V20Error(response.status_code, oandapyV20.exceptions.V20Error: {"errorMessage":"Missing JSON body"}

hootnot commented 3 years ago

Hi, if it worked last week, it is likely that you do something different now compared with last week.

Did you check your parameters ? The error gives me the impression that you pass it the data parameter. Make sure that it is JSON data ( a dict).

bestoak commented 3 years ago

I did nothing, and it now works..... I think it's something wrong with oanda server side. Anyway, Thank you very much for your response. Please let me close this issue.

hootnot commented 3 years ago

if it appears again, check your data parameter. It probably has a value other than None and not a dict with the correct values.