vendredi 16 décembre 2022

How to send an OCO Order to Binance in Python ?

 #Open_position_order function on Binance

def open_position_order(symbol,quantity, side, order_type = ORDER_TYPE_MARKET):

    try:
        print("sending order")
        order = client.create_order(
        symbol=symbol,
        side=side,
        type=order_type,
        quantity=quantity)
   
        print(order)
       
    except Exception as e:
        print('open position order error')
        return False
   
    return True


You might need to install the following dependency :
pip install python-binance

jeudi 15 décembre 2022

Exemple pyinstaller

 pyinstaller.exe --onefile MyPythonScript.py

The Windows executable file will then be created in the "dist" directory.