ccxt FTX long/short position

Viewed 663

i am trying to open and close short positions on FTX using ccxt with python. I do not find any kind of information or examples about how to do this.

Does anyone know how to do that, or has any example on opening and closing short positions using ccxt over FTX?

Thank you so much!

David

1 Answers
import ccxt

ftx = ccxt.ftx({
            'enableRateLimit': True,
                "apiKey": "-----------------------",
                "secret": "-----------------------",
            #'headers': {
             #   'FTX-SUBACCOUNT': "----",
            #},
            "hostname": "ftx.com"
        })
response = ftx.set_leverage(1)
print('set_leverage - ', response)

#Long
ftx.create_order('USDT-PERP', 'market', 'buy', 10)

ftx.create_order('USDT-PERP', 'market', 'sell', 10)

#Short
ftx.create_order('USDT-PERP', 'market', 'sell', 10)

ftx.create_order('USDT-PERP', 'market', 'buy', 10)
Related