API grabber for trading with coinex
Just input your access key with your private api key here and change the variables here:
LEVERAGE = leverages.LEVERAGE_100.value
BETPERCENT = 0.1
STOPLOSS = 0.5 # [0, 1]access_id = "" # Replace with your access id
secret_key = "" # Replace with your secret keyTo place the trade:
- Determine the number of units of the asset you would like to purchase, currently it places a trade based on current balance and leverage
- stopLoss is derived from STOPLOSS, which if multiplied by 100, is the percentage of the position until stoploss.
- takeProfit can be added onto market_buy or limit_buy functions.
size = str(LEVERAGE * BETPERCENT * currentBalance / assetPrice)
stopLoss = str(assetPrice * (1 - (STOPLOSS/LEVERAGE)))
response_5 = market_buy(size, stopLoss)