Create a TWAP or VWAP order
curl --request POST \
--url https://developers.fundingperpetuals.com/v1/twap-orders \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"account_id": "<string>",
"market_id": "<string>",
"size": 123,
"expected_price": 123,
"leverage": 123,
"duration_minutes": 722,
"strategy": "twap",
"slice_interval_seconds": 21615,
"randomize": false,
"reduce_only": false,
"trigger_price": 123,
"max_price": 123,
"min_price": 123
}
'import requests
url = "https://developers.fundingperpetuals.com/v1/twap-orders"
payload = {
"account_id": "<string>",
"market_id": "<string>",
"size": 123,
"expected_price": 123,
"leverage": 123,
"duration_minutes": 722,
"strategy": "twap",
"slice_interval_seconds": 21615,
"randomize": False,
"reduce_only": False,
"trigger_price": 123,
"max_price": 123,
"min_price": 123
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
account_id: '<string>',
market_id: '<string>',
size: 123,
expected_price: 123,
leverage: 123,
duration_minutes: 722,
strategy: 'twap',
slice_interval_seconds: 21615,
randomize: false,
reduce_only: false,
trigger_price: 123,
max_price: 123,
min_price: 123
})
};
fetch('https://developers.fundingperpetuals.com/v1/twap-orders', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://developers.fundingperpetuals.com/v1/twap-orders",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'account_id' => '<string>',
'market_id' => '<string>',
'size' => 123,
'expected_price' => 123,
'leverage' => 123,
'duration_minutes' => 722,
'strategy' => 'twap',
'slice_interval_seconds' => 21615,
'randomize' => false,
'reduce_only' => false,
'trigger_price' => 123,
'max_price' => 123,
'min_price' => 123
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Idempotency-Key: <idempotency-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://developers.fundingperpetuals.com/v1/twap-orders"
payload := strings.NewReader("{\n \"account_id\": \"<string>\",\n \"market_id\": \"<string>\",\n \"size\": 123,\n \"expected_price\": 123,\n \"leverage\": 123,\n \"duration_minutes\": 722,\n \"strategy\": \"twap\",\n \"slice_interval_seconds\": 21615,\n \"randomize\": false,\n \"reduce_only\": false,\n \"trigger_price\": 123,\n \"max_price\": 123,\n \"min_price\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://developers.fundingperpetuals.com/v1/twap-orders")
.header("Idempotency-Key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"account_id\": \"<string>\",\n \"market_id\": \"<string>\",\n \"size\": 123,\n \"expected_price\": 123,\n \"leverage\": 123,\n \"duration_minutes\": 722,\n \"strategy\": \"twap\",\n \"slice_interval_seconds\": 21615,\n \"randomize\": false,\n \"reduce_only\": false,\n \"trigger_price\": 123,\n \"max_price\": 123,\n \"min_price\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://developers.fundingperpetuals.com/v1/twap-orders")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"account_id\": \"<string>\",\n \"market_id\": \"<string>\",\n \"size\": 123,\n \"expected_price\": 123,\n \"leverage\": 123,\n \"duration_minutes\": 722,\n \"strategy\": \"twap\",\n \"slice_interval_seconds\": 21615,\n \"randomize\": false,\n \"reduce_only\": false,\n \"trigger_price\": 123,\n \"max_price\": 123,\n \"min_price\": 123\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "<string>",
"account_id": "<string>",
"market_id": "<string>",
"total_size": 123,
"filled_size": 123,
"leverage": 123,
"reduce_only": true,
"duration_minutes": 123,
"slice_interval_seconds": 123,
"status": "<string>",
"started_at": 123,
"end_at": 123,
"provider": "<string>",
"symbol": "<string>",
"coin": "<string>",
"size_decimals": 123,
"average_price": 123,
"slice_count": 123,
"slices_attempted": 123,
"randomize": true,
"trigger_price": 123,
"max_price": 123,
"min_price": 123,
"current_child_order_id": "<string>",
"activated_at": 123,
"next_run_at": 123,
"canceled_at": 123,
"completed_at": 123,
"completion_reason": "<string>"
}
}{
"data": {
"id": "<string>",
"account_id": "<string>",
"market_id": "<string>",
"total_size": 123,
"filled_size": 123,
"leverage": 123,
"reduce_only": true,
"duration_minutes": 123,
"slice_interval_seconds": 123,
"status": "<string>",
"started_at": 123,
"end_at": 123,
"provider": "<string>",
"symbol": "<string>",
"coin": "<string>",
"size_decimals": 123,
"average_price": 123,
"slice_count": 123,
"slices_attempted": 123,
"randomize": true,
"trigger_price": 123,
"max_price": 123,
"min_price": 123,
"current_child_order_id": "<string>",
"activated_at": 123,
"next_run_at": 123,
"canceled_at": 123,
"completed_at": 123,
"completion_reason": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"order_id": "<string>",
"rule_id": "<string>",
"details": {}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
}Strategy Orders
Create a TWAP or VWAP order
POST
/
v1
/
twap-orders
Create a TWAP or VWAP order
curl --request POST \
--url https://developers.fundingperpetuals.com/v1/twap-orders \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"account_id": "<string>",
"market_id": "<string>",
"size": 123,
"expected_price": 123,
"leverage": 123,
"duration_minutes": 722,
"strategy": "twap",
"slice_interval_seconds": 21615,
"randomize": false,
"reduce_only": false,
"trigger_price": 123,
"max_price": 123,
"min_price": 123
}
'import requests
url = "https://developers.fundingperpetuals.com/v1/twap-orders"
payload = {
"account_id": "<string>",
"market_id": "<string>",
"size": 123,
"expected_price": 123,
"leverage": 123,
"duration_minutes": 722,
"strategy": "twap",
"slice_interval_seconds": 21615,
"randomize": False,
"reduce_only": False,
"trigger_price": 123,
"max_price": 123,
"min_price": 123
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
account_id: '<string>',
market_id: '<string>',
size: 123,
expected_price: 123,
leverage: 123,
duration_minutes: 722,
strategy: 'twap',
slice_interval_seconds: 21615,
randomize: false,
reduce_only: false,
trigger_price: 123,
max_price: 123,
min_price: 123
})
};
fetch('https://developers.fundingperpetuals.com/v1/twap-orders', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://developers.fundingperpetuals.com/v1/twap-orders",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'account_id' => '<string>',
'market_id' => '<string>',
'size' => 123,
'expected_price' => 123,
'leverage' => 123,
'duration_minutes' => 722,
'strategy' => 'twap',
'slice_interval_seconds' => 21615,
'randomize' => false,
'reduce_only' => false,
'trigger_price' => 123,
'max_price' => 123,
'min_price' => 123
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Idempotency-Key: <idempotency-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://developers.fundingperpetuals.com/v1/twap-orders"
payload := strings.NewReader("{\n \"account_id\": \"<string>\",\n \"market_id\": \"<string>\",\n \"size\": 123,\n \"expected_price\": 123,\n \"leverage\": 123,\n \"duration_minutes\": 722,\n \"strategy\": \"twap\",\n \"slice_interval_seconds\": 21615,\n \"randomize\": false,\n \"reduce_only\": false,\n \"trigger_price\": 123,\n \"max_price\": 123,\n \"min_price\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://developers.fundingperpetuals.com/v1/twap-orders")
.header("Idempotency-Key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"account_id\": \"<string>\",\n \"market_id\": \"<string>\",\n \"size\": 123,\n \"expected_price\": 123,\n \"leverage\": 123,\n \"duration_minutes\": 722,\n \"strategy\": \"twap\",\n \"slice_interval_seconds\": 21615,\n \"randomize\": false,\n \"reduce_only\": false,\n \"trigger_price\": 123,\n \"max_price\": 123,\n \"min_price\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://developers.fundingperpetuals.com/v1/twap-orders")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"account_id\": \"<string>\",\n \"market_id\": \"<string>\",\n \"size\": 123,\n \"expected_price\": 123,\n \"leverage\": 123,\n \"duration_minutes\": 722,\n \"strategy\": \"twap\",\n \"slice_interval_seconds\": 21615,\n \"randomize\": false,\n \"reduce_only\": false,\n \"trigger_price\": 123,\n \"max_price\": 123,\n \"min_price\": 123\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "<string>",
"account_id": "<string>",
"market_id": "<string>",
"total_size": 123,
"filled_size": 123,
"leverage": 123,
"reduce_only": true,
"duration_minutes": 123,
"slice_interval_seconds": 123,
"status": "<string>",
"started_at": 123,
"end_at": 123,
"provider": "<string>",
"symbol": "<string>",
"coin": "<string>",
"size_decimals": 123,
"average_price": 123,
"slice_count": 123,
"slices_attempted": 123,
"randomize": true,
"trigger_price": 123,
"max_price": 123,
"min_price": 123,
"current_child_order_id": "<string>",
"activated_at": 123,
"next_run_at": 123,
"canceled_at": 123,
"completed_at": 123,
"completion_reason": "<string>"
}
}{
"data": {
"id": "<string>",
"account_id": "<string>",
"market_id": "<string>",
"total_size": 123,
"filled_size": 123,
"leverage": 123,
"reduce_only": true,
"duration_minutes": 123,
"slice_interval_seconds": 123,
"status": "<string>",
"started_at": 123,
"end_at": 123,
"provider": "<string>",
"symbol": "<string>",
"coin": "<string>",
"size_decimals": 123,
"average_price": 123,
"slice_count": 123,
"slices_attempted": 123,
"randomize": true,
"trigger_price": 123,
"max_price": 123,
"min_price": 123,
"current_child_order_id": "<string>",
"activated_at": 123,
"next_run_at": 123,
"canceled_at": 123,
"completed_at": 123,
"completion_reason": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"order_id": "<string>",
"rule_id": "<string>",
"details": {}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
}Authorizations
API key beginning with fp_live_.
Headers
Unique printable key for this intended order. Reuse it only for an identical retry.
Required string length:
1 - 128Body
application/json
Available options:
buy, sell Available options:
cross, isolated Required range:
5 <= x <= 1440Available options:
twap, vwap At most half the selected duration, with a global 12-hour ceiling.
Required range:
30 <= x <= 43200Response
Idempotent replay.
Show child attributes
Show child attributes
⌘I