dvlt
dvlt

Reputation: 41

ccxt FTX long/short position

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

Upvotes: 1

Views: 1228

Answers (1)

Nicolò andreetto
Nicolò andreetto

Reputation: 11

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)

Upvotes: 1

Related Questions