Spot orders VS Futures orders - python

Hi all,

I am beginner in coding, a few days ago I have been completed my bot trading for spot platform. But now I want to start for Futures.

I will put here my orders in spot, could you help me please to write same code in python to send same order for future? I will be thankful.

how can I write these codes for Futures Trading ( I already use these codes for Spot Trading):

  1. getting candlestick data as pandas
    ticker = ‘BTCUSDT’
    interval = Client.KLINE_INTERVAL_15MINUTE
    depth = ‘20 hours ago’
    raw = client.get_historical_klines(ticker, interval, depth)

  2. getting USDT balance
    json = client.get_asset_balance(asset=‘USDT’)

  3. creating limit buy order/position
    .client.create_order(
    symbol=‘BTCUSDT’,
    side=‘BUY’,
    type=‘LIMIT’,
    timeInForce=‘GTC’,
    quantity= 1
    price= 45000
    )

  4. creating buy market order/position
    order = client.order_market_buy(symbol = ‘BTCUSDT’, quantity = 1)

  5. getting open orders
    orders = client.get_open_orders(symbol=‘BTCUSDT’)

  6. cancelling orders
    def cancel_limit_order(self):
    # get open orders
    orders = self.get_open_orders()
    # check if there is open orders
    myOrderId = None
    if orders.shape[0] > 0:
    # get order’s id
    myOrderId = orders[‘orderId’][0]
    # cancel order

     if myOrderId:
         try:
             _ = self.client.cancel_order(symbol='BTCUSDT', orderId= myOrderId)
             helper.send_on_channel('limit buy order ({}) was Cancelled.'.format(myOrderId), True)
         except:
             helper.send_on_channel('faild to canacel your limit order with id ({})'.format(myOrderId), True)
    
  7. making OCO order / take profit and stop loss
    self.client.create_oco_order(symbol= self.ticker,
    side =‘SELL’,
    quantity= 1,
    price = 51000 ,
    stopPrice= 45000,
    stopLimitPrice = 44900,
    limitIcebergQty =0,
    stopIcebergQty = 0,
    stopLimitTimeInForce= ‘GTC’)

  8. how to send short limit position?

  9. how to send short market position?

  10. how to make isolated position, select leverage …

for any question please contact me at llssmmdd@gmail.com

Please use markdown to pretty up the source code.
Also no need to add email address , we will reply here soon.

I am so sorry, this is my first post here

it’s ok, with better format, the others can help you much easier :grinning:

This is actually a code question. Read the source code here - https://github.com/sammchardy/python-binance/blob/master/binance/client.py and look for futures_* methods. They’re all there.

I will check, thanks alot

thanks for your help, your link is really useful, but my problem is that I can’t read this red square in this picture:

I need it simple as python in one sentence, like this:
result = request_client.post_order(symbol=“LTCUSDT”, side=OrderSide.BUY, ordertype=OrderType.LIMIT, price=185, quantity=0.5, timeInForce=TimeInForce.GTC)