sammchardy / python-binance

Binance Exchange API python implementation for automated trading
https://python-binance.readthedocs.io/en/latest/
MIT License
6.01k stars 2.2k forks source link

Error: OverflowError: Python int too large to convert to C long #1319

Open vkorobeynyk opened 1 year ago

vkorobeynyk commented 1 year ago

I am trying to place few orders by using the following piece of code:

client$futures_create_order(symbol = coin, side = "BUY", type = "MARKET", positionSide="LONG", quantity = qty)

and I am getting the OverflowError of python int too large to convert to C long.

Some background on my OS/language: I am using windows10 64-bit. I am also using Rstudio/R and importing python-binance via reticulate package. From the error, I think that the problem is with the timestamp that is returned from futures_create_order which is too large to be converted to C long.. In theory, if I would be using python and creating an int that large, I could convert it to int64 but in this situation i dont know how to solve my issue and was hoping for some tips. Not sure if its from reticulate package side or not...

halfelf commented 1 year ago

From the error message, it looks like your python interpreter is 32-bit .

vkorobeynyk commented 1 year ago

Initially I also thought that but i am using 64bit...

Reticulate uses python3.10 use_python("/Users/vkorobeynyk/AppData/Local/Programs/Python/Python310/python.exe")

and

>>> sys.maxsize is 9223372036854775807

the only weird thing is that if I use reticulate and import sys within Rstudio and check sys$maxsize, it returns -1