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):
-
getting candlestick data as pandas
ticker = ‘BTCUSDT’
interval = Client.KLINE_INTERVAL_15MINUTE
depth = ‘20 hours ago’
raw = client.get_historical_klines(ticker, interval, depth) -
getting USDT balance
json = client.get_asset_balance(asset=‘USDT’) -
creating limit buy order/position
.client.create_order(
symbol=‘BTCUSDT’,
side=‘BUY’,
type=‘LIMIT’,
timeInForce=‘GTC’,
quantity= 1
price= 45000
) -
creating buy market order/position
order = client.order_market_buy(symbol = ‘BTCUSDT’, quantity = 1) -
getting open orders
orders = client.get_open_orders(symbol=‘BTCUSDT’) -
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 orderif 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)
-
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’) -
how to send short limit position?
-
how to send short market position?
-
how to make isolated position, select leverage …
for any question please contact me at llssmmdd@gmail.com