JavTradingInteractions
General Description
The JavTradingInteractions contract used for manage and interact with various types of trading orders, including limit, stop, and market orders, for a trading platform. It enables users to open, close, update, and manage the terms of their trades, including slippage, position size, leverage, and take-profit/stop-loss (TP/SL) parameters. Additionally, it supports the initiation and updating of trigger orders, and allows for the cancellation of open orders. This system provides a wide range of functionalities to give users full control over their trading positions and strategies.
Core Functionalities
openTrade
openTrade
Opens a new trade, limit order, or stop order with specified parameters.
Parameters:
_trade
: The trade data (structure containing details about the trade)._maxSlippageP
: Maximum allowed slippage in percentage (1e3 precision)._referrer
: Address of the referrer (can only be set once per trader)._priceUpdate
: Array containing price update data.
Access Control: Public.
updateTermsAndConditionsAddress
updateTermsAndConditionsAddress
Updates the address for the terms and conditions.
Parameters:
_termsAndConditionsAddress
: New address for the terms and conditions.
Access Control: Public.
updateMaxClosingSlippageP
updateMaxClosingSlippageP
Updates the maximum slippage allowed for closing a trade.
Parameters:
_index
: Index of the trade to be updated._maxSlippageP
: New maximum closing slippage percentage (1e3 precision).
Access Control: Public.
closeTradeMarket
closeTradeMarket
Closes an open trade using a market order.
Parameters:
_index
: Index of the trade to be closed._priceUpdate
: Array containing price update data.
Access Control: Public.
updateOpenOrder
updateOpenOrder
Updates an existing limit or stop order with new parameters.
Parameters:
_index
: Index of the existing order._triggerPrice
: New trigger price for the order (1e10 precision)._tp
: New take-profit price (1e10 precision)._sl
: New stop-loss price (1e10 precision)._maxSlippageP
: New maximum slippage percentage (1e3 precision).
Access Control: Public.
cancelOpenOrder
cancelOpenOrder
Cancels an open limit or stop order.
Parameters:
_index
: Index of the order to be canceled.
Access Control: Public.
updateTp
updateTp
Updates the take-profit (TP) value of an open trade.
Parameters:
_index
: Index of the open trade._newTp
: New TP value (1e10 precision).
Access Control: Public.
updateSl
updateSl
Updates the stop-loss (SL) value of an open trade.
Parameters:
_index
: Index of the open trade._newSl
: New SL value (1e10 precision).
Access Control: Public.
updateLeverage
updateLeverage
Updates the leverage for a trade.
Parameters:
_index
: Index of the trade._newLeverage
: New leverage value (1e3 precision)._priceUpdate
: Array containing price update data.
Access Control: Public.
increasePositionSize
increasePositionSize
Increases the position size of an open trade by adding collateral and adjusting leverage.
Parameters:
_index
: Index of the trade._collateralDelta
: Amount of collateral to add (collateral precision)._leverageDelta
: Amount of leverage to increase by (1e3 precision)._expectedPrice
: Expected price for execution (1e10 precision)._maxSlippageP
: Maximum slippage percentage allowed (1e3 precision)._priceUpdate
: Array containing price update data.
Access Control: Public.
decreasePositionSize
decreasePositionSize
Decreases the position size of an open trade by removing collateral and adjusting leverage.
Parameters:
_index
: Index of the trade._collateralDelta
: Amount of collateral to remove (collateral precision)._leverageDelta
: Amount of leverage to decrease by (1e3 precision)._priceUpdate
: Array containing price update data.
Access Control: Public.
triggerOrder
triggerOrder
Initiates a trigger order based on a packed data structure (order type, trader, index) for TP, SL, liquidation, limit, or stop orders.
Parameters:
_packed
: Packed data for the trigger order (encodes order type, trader address, index)._priceUpdate
: Array containing price update data.
Access Control: Public.
Last updated