Hi and thanks for the response.
What I am trying to do the following:
- Create a LIMIT BUY ORDER that has a STOP LOSS associated with it
- Create a LIMIT SELL ORDER
Below is what I am doing to work with (#1)
I have also opened a Stackoverflow Message as well.
I am using Python, Binance, and CCXT API libraries to create a BUY order on Binance. I am getting an error when executing the code below.
ERROR: ccxt.base.errors.InvalidOrder: binance Order would trigger immediately.
I have also added the inputs.
Why am I getting this error?
TIA
=> CODE
def ccxt_create_buy_order( self, symbol: str, amount: float, price: float, stop_price: float ):
try:
print(" ======= BUY ORDER : ccxt_create_buy_order ================ ")
results = {}
params = { ‘stopPrice’: stop_price , ‘timeInForce’:‘GTC’ }
print("inputs symbo " + symbol + " amount/quantity " + str(amount) + " price " + str(price) )
print( params )
output = self.ccxt_binance.createOrder(symbol, 'STOP_LOSS_LIMIT', amount=amount, side="buy", price=price, params=params)
=> INPUTS
======= BUY ORDER : ccxt_create_buy_order =================
symbol BTC/USDT
amount/quantity 0.0015
price 9872.49
params {‘stopPrice’: 9773.77, ‘timeInForce’: ‘GTC’}
=> LOG FILE
ERR-3A59F2841 Traceback (most recent call last): File
“/usr/local/lib/python3.7/dist-packages/ccxt/base/exchange.py”, line
568, in fetch
[ … snip …]
489, in throw_exactly_matched_exception
raise exactstring
ERROR: ccxt.base.errors.InvalidOrder: binance Order would trigger immediately.