'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
Solution 1:[1]
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)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Nicolò andreetto |