createNewOrder method
Create a new order
Create an order. You can place two types of orders: limit and market. Orders can only be placed if your account has sufficient funds. Once an order is placed, your account funds will be put on hold for the duration of the order. How much and which funds are put on hold depends on the order type and parameters specified.
https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_postorders
Implementation
Future<Order> createNewOrder({
String? profileId,
OrderEnum? type,
required SideEnum side,
required String productId,
StpEnum? stp,
StopEnum? stop,
double? stopPrice,
double? price,
double? size,
double? funds,
TimeInForceEnum? timeInForce,
CancelAfterEnum? cancelAfter,
bool? postOnly,
String? clientOid,
}) async {
var response = await _ordersRestClient.createNewOrder(
profileId: profileId,
type: type,
side: side,
productId: productId,
stp: stp,
stop: stop,
stopPrice: stopPrice,
price: price,
size: size,
funds: funds,
timeInForce: timeInForce,
cancelAfter: cancelAfter,
postOnly: postOnly,
clientOid: clientOid,
);
if (response.statusCode != 200) throw response;
return Order.fromJson(json.decode(response.body));
}