Skip to content

Latest commit

 

History

History
359 lines (218 loc) · 6.14 KB

TradeInput.md

File metadata and controls

359 lines (218 loc) · 6.14 KB

TradeInput

data class TradeInput(
 val type: OrderType?,
 val side: OrderSide?,
 val marketId: String?,  val marginMode: MarginMode?,  val targetLeverage: Double?,  val size: TradeInputSize?,
 val price: TradeInputPrice?,
 val timeInForce: String?,
 val goodTil: TradeInputGoodUntil?,
 val execution: String?,
 val reduceOnly: Boolean,
 val postOnly: Boolean,
 val fee: Double?,
 val bracket: TradeInputBracket?,
 val marketOrder: TradeInputMarketOrder?,
 val options: TradeInputOptions?,
 val summary: TradeInputSummary?
)

type

OrderType. See SubaccountOrder

side

BUY or SELL

marketId

Selected Market ID

marginMode

CROSS or ISOLATED

size

Size information for the trade

price

Price information for the trade

timeInForce

Time in force

execution

Execution option

reduceOnly

Whether the trade has reduce-only selected

postOnly

Post-only option

fee

Calculated fee

bracket

Bracket orders

marketOrder

Market order structure calculated from orderbook

options

The list of input fields required, based on type

summary

A summary of the order

TradeInputSize

data class TradeInputSize(
 val size: Double?,
 val usdcSize: Double?,
 val leverage: Double?,
 val percent: Double?,
 val balancePercent: Double?,
 val input: String?
)

size

Size of the trade in the token unit

usdcSize

Size of the trade in USDC

leverage

Leverage of the order

percent

Percentage (of existing position) to use for the order. Only used for the close position input.

balancePercent

Percentage (of available balance / free collateral) to use for the order. Currently only on market orders.

input

Which one of the fields are entered by the user:

  • TradeInput: size, usdcSize, leverage, percent, balancePercent
  • ClosePositionInput: size, percent

TradeInputPrice

data class TradeInputPrice(
 val limitPrice: Double?,
 val triggerPrice: Double?,
 val trailingPercent: Double?
)

limitPrice

Entered limit price

triggerPrice

Entered trigger price

trailingPercent

Trailing percent for TrailingStop orders

TradeInputGoodUntil

data class TradeInputGoodUntil(
 val duration: Double?,
 val unit: String?
)

duration

Number of (unit) for the duration

unit

time unit

TradeInputBracket

data class TradeInputBracket(
 val stopLoss: TradeInputBracketSide?,
 val takeProfit: TradeInputBracketSide?,
 val goodTil: TradeInputGoodUntil?,
 val execution: String?
)

stopLoss

Stoploss side of the bracket order

takeProfit

Take profit side of the bracket order

goodTil

Good until settings for the bracket orders

execution

Execution settings for the bracket orders

TradeInputMarketOrder

data class TradeInputMarketOrder(
 val size: Double?,
 val usdcSize: Double?,
 val balancePercent: Double?,
 val price: Double?,
 val worstPrice: Double?,
 val filled: Boolean,
 val orderbook: Array?
)

size

size of the market order

usdcSize

USDC amount of the market order

balancePercent

Percentage (of available balance / free collateral) of the market order

price

Calculated price

worstPrice

Worst price of the market order, based on order book

filled

Whether the market order can be filled with the current order book

orderbook

The orderbook entries taken by the market order

TradeInputOptions

data class TradeInputOptions(
 val needsSize: Boolean,
 val needsLeverage: Boolean,
 val needsBalancePercent: Boolean,  val maxLeverage: Double?,
 val needsLimitPrice: Boolean,  val needsTargetLeverage: Boolean,  val needsTriggerPrice: Boolean,
 val needsTrailingPercent: Boolean,
 val needsGoodUntil: Boolean,
 val needsReduceOnly: Boolean,
 val needsPostOnly: Boolean,
 val needsBrackets: Boolean,
 val typeOptions: Array,
 val sideOptions: Array,
 val timeInForceOptions: Array?,
 val goodTilUnitOptions: Array?,
 val executionOptions: Array?,  val marginModeOptions: Array? )

needsSize

UX should ask user for size

needsLeverage

UX should ask user for leverage input

needsBalancePercent

UX should ask user for balance percent input

maxLeverage

Max leverage for the leverage slider

needsTargetLeverage

UX should ask user to adjust their target leverage when margin mode is ISOLATED

needsTriggerPrice

UX should ask user to enter trigger price

needsLimitPrice

UX should ask user to enter limit price

needsTrailingPercent

UX should ask user to enter trailing percent

needsGoodUntil

UX should ask user to enter GoodTil time

needsReduceOnly

UX should have a check box for reduce-only

needsPostOnly

UX should have a check box for post-only

needsBrackets

UX should allow user to enter bracket orders

typeOptions

Order types available for selection

sideOptions

Order side available for selection

timeInForceOptions

TimeInForce options

goodTilUnitOptions

Time units for goodTil

executionOptions

Execution options for selection

TradeInputSummary

data class TradeInputSummary(
 val price: Double?,
 val size: Double?,
 val usdcSize: Double?,
 val slippage: Double?,
 val fee: Double?,
 val total: Double?,
 val filled: Boolean  val positionMargin: Double?,  val positionLeverage: Double?, )

price

Price of the trade

size

Size of the trade

usdcSize

USDC amount of the trade

slippage

Slippage of the trade

fee

Fee

Total

Total amount of the trade

filled

Whether this trade can be filled

positionMargin

The margin value of the position

positionLeverage

The leverage value of the position