Exchange v0.2.3 Exchange.Validations View Source

Validations for Data Structures for the Exchange

Link to this section Summary

Functions

Function that validates the parameters of an order taking into account the type of the Exchange.Order.

Link to this section Functions

Link to this function

cast_order(order_params)

View Source

Specs

cast_order(map()) :: {:ok, Exchange.Order.order()} | {:error, String.t()}

Function that validates the parameters of an order taking into account the type of the Exchange.Order.

Different validations are made:

  • price is positive
  • side one of [:buy, :sell]
  • size is positive
  • exp_time is a date in future

Parameters

  • order_params: Map that represents the parameters on an Exchange.Order.