Market order
A market order is an order to buy or sell immediately. This type of order guarantees that the order will be executed, but does not guarantee the execution price. A market order generally will execute at or near the current bid (for a sell order) or ask (for a buy order) price.
Limit order
A limit order is used to buy or sell a security at a pre-determined price and will not execute unless the security's price meets those qualifications.
If-touched market order
An if-touched market order is a conditional order. It triggers a Market Order if a given stop price is reached or crossed. The direction of crossing is resolved at order creation using the current market price. A fill is not guaranteed.
In the following section all methods to send if-touched market orders on Trality are explained. For convenience if-touched orders cannot only be sent with the specified amount but also in value of quoted currency.
order_iftouched_market_amount
This will send an iftouched market order in units of base currency.
Method
order_iftouched_market_amount(symbol="BTCUSDT", amount=0.05, stop_price=8050.00)
symbol string |
The symbol to buy or sell. |
amount string or float or Decimal |
The desired amount to buy or sell denoted in base currency. Negative values result in a sell order, while positive values result in a buy order. |
stop_price string or float or Decimal |
A price that when reached or crossed triggers an order. |
PLEASE NOTE: An amount > 0 indicates a buying order, whereas an amount < 0 refers to a selling order!
e.g:
buy_order = order_iftouched_market_amount("BTCUSDT", 1.6,8050.00)
sell_order = order_iftouched_market_amount("BTCUSDT", -1.6,8050.00)
order_iftouched_market_value
This will send an if-touched market order converting value in quoted currency to units of base currency.
Method
order_iftouched_market_value(symbol="BTCUSDT", value=1000.0, stop_price=8050.00)
symbol string |
The symbol to buy or sell. |
value string or float or Decimal |
The desired value to buy or sell denoted in quoted currency. Negative values result in a sell order, while positive values result in a buy order. |
stop_price string or float or Decimal |
A price that when reached or crossed triggers an order. |
(AGAIN) PLEASE NOTE: An amount > 0 indicates a buying order, whereas an amount < 0 refers to a selling order!
e.g:
buy_order = order_iftouched_market_value("BTCUSDT", 1000.0, 8050.00)
sell_order = order_iftouched_market_value("BTCUSDT", -1000.0, 8050.00)
If-touched limit order
An if-touched limit order is a conditional order. It triggers a Limit Order if a given stop price is reached or crossed. The direction of crossing is resolved at order creation using the current market price. A fill is not guaranteed. In the following section all methods to send if-touched limit orders on Trality are explained. For convenience if-touched orders cannot only be sent with the specified amount but also in value of quoted currency.
order_iftouched_limit_amount
This will sends an if-touched limit order in units of base currency.
Method
order_iftouched_limit_amount(symbol="BTCUSDT", amount=0.05, stop_price=8050.00, limit_price=7800.00)
symbol string |
The symbol to buy or sell. |
amount string or float or Decimal |
The desired amount to buy or sell denoted in base currency. Negative values result in a sell order, while positive values result in a buy order. |
stop_price string or float or Decimal |
A price that when reached or crossed triggers an order. |
limit_price string or float or Decimal |
The least favourable price for an order to be filled. An order will be filled if the current price on the exchange is at or below (above) the limit price in case of a buy (sell) order. |
Returns an order.
e.g:
buy_order = order_iftouched_limit_amount("BTCUSDT", 1.6,8050.00, 7800.00)
sell_order = order_iftouched_limit_amount("BTCUSDT", -1.6,8050.00, 7800.00)
order_iftouched_limit_value
This will send an if-touched limit order converting value in quoted currency to units of base currency.
Method:
order_iftouched_limit_value(symbol="BTCUSDT", value=1000.0, stop_price=8050.00, limit_price=7800.00)
symbol string |
The symbol to buy or sell. |
value string or float or Decimal |
The desired value to buy or sell denoted in quoted currency. Negative values result in a sell order, while positive values result in a buy order. |
stop_price string or float or Decimal |
A price that when reached or crossed triggers an order. |
limit_price string or float or Decimal |
The least favourable price for an order to be filled. An order will be filled if the current price on the exchange is at or below (above) the limit price in case of a buy (sell) order. |
Returns an order.
e.g:
buy_order = order_iftouched_limit_value("BTCUSDT", 1000.0, 8050.00, 7800.00)
sell_order = order_iftouched_limit_value("BTCUSDT", -1000.0, 8050.00, 7800.00)
Trailing If-touched orders
A trailing if-touched market order is an If-touched Market Order with a dynamic stop price. In other words, the order reacts and changes depending on factors that you can customize.
The stop price is adjusted according to the parameter trailing_percent which indicates the maximum relative difference between the current market price and the stop_price. Target percent can take only values in [0.1].
In the following section all methods to send trailing if-touched market orders on Trality are explained. For convenience if-touched orders cannot only be sent with the specified amount but also in value of quoted currency.
NOTE: Note, that trailing_percent sets the maximum relative difference between current market price and stop price. If this difference is exceed the stop_price is adjusted to the price that is trailing_percent away from the current market price.
order_trailing_iftouched_amount
This will send a trailing if-touched market order in units of base currency.
Method:
order_trailing_iftouched_amount(symbol="BTCUSDT", amount=0.05, trailing_percent= 0.1, stop_price=8050.00)
symbol string |
The symbol to buy or sell. |
amount string or float or Decimal |
The desired amount to buy or sell denoted in base currency. Negative values result in a sell order, while positive values result in a buy order. |
trailing_percent string or float or Decimal |
This is the maximum relative distance bewteen market price and stop_price. Only values from [0.1] are accepted. |
stop_price string or float or Decimal |
The least favourable price for an order to be filled. An order will be filled if the current price on the exchange is at or below (above) the limit price in case of a buy (sell) order. |
Returns an order.
e.g:
buy_order = order_iftouched_limit_amount("BTCUSDT", 1.6,8050.00, 7800.00)
sell_order = order_iftouched_limit_amount("BTCUSDT", -1.6,8050.00, 7800.00)
order_trailing_iftouched_amount
This will send a trailing if-touched market order converting value in quoted currency to units of base currency.
Method
order_trailing_iftouched_value(symbol="BTCUSDT", value=1000.0, trailing_percent= 0.1, stop_price=8050.00)
symbol string |
The symbol to buy or sell. |
value string or float or Decimal |
The desired value to buy or sell denoted in quoted currency. Negative values result in a sell order, while positive values result in a buy order. |
trailing_percent string or float or Decimal |
This is the maximum relative distance bewteen market price and stop_price. Only values from [0.1] are accepted. |
stop_price string or float or Decimal |
A price that when reached or crossed triggers an order.
|
Returns an order.
e.g:
buy_order = order_trailing_iftouched_value("BTCUSDT", 1000.0, 0.1, 8050.00)
sell_order = order_trailing_iftouched_value("BTCUSDT", -1000.0, 0.1, 8050.00)
Margin trading
We offer the same order types for margin trading as well. Please find the full comprehensive documentation for our margin trading API here.
Market order:
# this order will buy BTC
buy_order = margin_order_market_amount(symbol = "BTCUSDT", amount = 0.01,
side_effect = OrderMarginSideEffect.AutoDetermine)
# this order will sell BTC
sell_order = margin_order_market_amount(symbol = "BTCUSDT", amount = -0.01,
side_effect = OrderMarginSideEffect.AutoDetermine)
Limit order:
# this order will buy BTC
buy_order = margin_order_limit_amount(symbol = "BTCUSDT", amount = 0.01, limit_price=22000,
side_effect = OrderMarginSideEffect.AutoDetermine)
# this order will sell BTC
sell_order = margin_order_limit_amount(symbol = "BTCUSDT", amount = -0.01, limit_price=22000,
side_effect = OrderMarginSideEffect.AutoDetermine)