VWAP execution price for a size over a client-supplied order book (0 if unfillable)
const url = 'https://data.predictefy.com/api/example/getExecutionPrice';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"args":[{"bids":[{"price":0.61,"size":250}],"asks":[{"price":0.63,"size":180}]},"buy",100],"credentials":{}}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://data.predictefy.com/api/example/getExecutionPrice \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "args": [ { "bids": [ { "price": 0.61, "size": 250 } ], "asks": [ { "price": 0.63, "size": 180 } ] }, "buy", 100 ], "credentials": {} }'Stateless calculator: the volume-weighted average price to fill size on side over the order book supplied in the body. Returns data: 0 when the size cannot be fully filled. Does NOT fetch — the client passes the book (from fetchOrderBook).
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Request Bodyrequired
Section titled “Request Bodyrequired”object
Positional tuple [orderBook, side, size].
Example
[ { "bids": [ { "price": 0.61, "size": 250 } ], "asks": [ { "price": 0.63, "size": 180 } ] }, "buy", 100]Accepted for backward compatibility but IGNORED (a pure calc needs no keys).
object
Responses
Section titled “Responses”The VWAP execution price (0 if the size cannot be fully filled).
object
VWAP price 0..1, or 0 if unfillable.
Examplegenerated
{ "success": true, "data": 1}Enveloped error.
object
object
Always present on errors; quote this id when reporting a failed request.
Present only when a venue error is attributed to a specific exchange.
Example
{ "success": false, "error": { "code": "VALIDATION_ERROR" }}Enveloped error.
object
object
Always present on errors; quote this id when reporting a failed request.
Present only when a venue error is attributed to a specific exchange.
Example
{ "success": false, "error": { "code": "VALIDATION_ERROR" }}Enveloped error.
object
object
Always present on errors; quote this id when reporting a failed request.
Present only when a venue error is attributed to a specific exchange.
Example
{ "success": false, "error": { "code": "VALIDATION_ERROR" }}Enveloped error.
object
object
Always present on errors; quote this id when reporting a failed request.
Present only when a venue error is attributed to a specific exchange.
Example
{ "success": false, "error": { "code": "VALIDATION_ERROR" }}Enveloped error.
object
object
Always present on errors; quote this id when reporting a failed request.
Present only when a venue error is attributed to a specific exchange.
Example
{ "success": false, "error": { "code": "VALIDATION_ERROR" }}Enveloped error.
object
object
Always present on errors; quote this id when reporting a failed request.
Present only when a venue error is attributed to a specific exchange.
Example
{ "success": false, "error": { "code": "VALIDATION_ERROR" }}Enveloped error.
object
object
Always present on errors; quote this id when reporting a failed request.
Present only when a venue error is attributed to a specific exchange.
Example
{ "success": false, "error": { "code": "VALIDATION_ERROR" }}