TradePatio uses cookies to provide necessary site functionality and improve your experience. By using our website, you agree to our privacy policy.

Constants

Constants

EX_ID
map[string - ex_name]:number - ex_id

Allows you to get an exchange ID using its name.

exID = EX_ID[exName]

 

 

EX_NAME
map[number - ex_id]:string - ex_name

Allows you to get the name of the exchange using its ID.

exName = EX_NAME[exID]

 

 

TRADE_ORDER_TYPE
{
delayed,
gtc,
fok
}

Indicates the order type in the trade bot.

  • delayed - a pending order. The bot waits for the market price to reach the specified value and creates a FOK policy order on the exchange.
  • gtc - create a GTC (Good Till Cancel) policy order on the exchange.
  • fok - create a FOK (Fill Or Kill) policy order on the exchange.
create_trade_order(exID, pairName, true, 0.156, 15, TRADE_ORDER_TYPE.fok)

 

 

ORDER_STATUS
{
skip,
work,
done,
close
}

Indicates order status.

  • skip - to ignore the order's status.
  • work - the order is in the process of execution.
  • done - the order is executed.
  • close - the order is closed.
orders = get_orders_by_pair_source(exID, pair_source , ORDER_STATUS.skip)

 

 

PAIR_SUBSCRIBE_TYPE
{
ask_less_or_equal_then,
ask_greater_or_equal_then,
bid_less_or_equal_then,
bid_greater_or_equal_then
}

Indicates the type of market (pair) subscription.

  • ask_less_or_equal_then - when the smallest ask in the DOM is less than or equal to the specified value.
  • ask_greater_or_equal_then - when the smallest ask in the DOM is greater than or equal to the specified value.
  • bid_less_or_equal_then - when the highest bid in the DOM is less than or equal to the specified value.
  • bid_greater_or_equal_then - when the highest bid in the DOM is greater than or equal to the specified value.
group = subject.market(PAIR_SUBSCRIBE_TYPE.ask_less_or_equal_then, EX_ID[exName], pair, price, function)

 

 

ORDER_TYPE_EVENT
{
order_update,
order_remove,
order_add,
order_done
}

Indicates the type of event that triggered a subscription to trade and trailing bots.

  • order_update - the order's parameters have been changed.
  • order_remove - the order was removed from the bot.
  • order_add - a new order has been added.
  • order_done - the order was executed.
isTradeOrderUpdate = function (tradeOrder, eventType)
ifeventType == ORDER_TYPE_EVENT.order_done then
console.log('Order done: ',tradeOrder.id)
end
end

subject.trade(isTradeOrderUpdate)