I am using python-binance to connect to binance cryptocurrency exchange. I am able to send orders simply using this code:
client.create_margin_order(
symbol = 'BTCUSDT',
side = Client.SIDE_BUY,
type = Client.ORDER_TYPE_LIMIT,
timeInForce = Client.TIME_IN_FORCE_GTC,
quantity = 100,
price = 10000
recvWindow = 5000,
timestamp = time.time_ns())
I am able to get a FOR loop to send the correct number of orders but i need each order in the range to send an order at 5% below the last order. How can I achieve this?
My current idea looks like this, however it sends all 10 orders at 5% below the bid price as opposed to 5% below each previous order.
for x in range(10):
client.create_margin_order(
symbol = 'BTCUSDT',
side = Client.SIDE_BUY,
type = Client.ORDER_TYPE_LIMIT,
timeInForce = Client.TIME_IN_FORCE_GTC,
quantity = 100,
price = d.Decimal(bidprice) * d.Decimal(0.95), #????????
recvWindow = 5000,
timestamp = time.time_ns())
Thank you for your suggestions!