History APIs
Order history
Request
Endpoint: Rest API
Method:
GET /indexer/v1/perp/order-history
Params:
[...]
curl --location 'https://testnet-api.foundation.network/indexer/v1/perp/order-history?account=0xb0477aa910d2a70647782afb91ba3477b8963a2e000000010000000000010000&page=1&take=10&endTime=1736096399999&startTime=1735405200000&status=filled%2Ccanceled%2Cconditionally_canceled' \
--data ''
const raw = "";
const requestOptions = {
method: "GET",
body: raw,
redirect: "follow"
};
fetch("https://testnet-api.foundation.network/indexer/v1/perp/order-history?account=0xb0477aa910d2a70647782afb91ba3477b8963a2e000000010000000000010000&page=1&take=10&endTime=1736096399999&startTime=1735405200000&status=filled,canceled,conditionally_canceled", requestOptions)
.then((response) => response.text())
.then((result) => console.log(result))
.catch((error) => console.error(error));
import requests
url = "https://testnet-api.foundation.network/indexer/v1/perp/order-history?account=0xb0477aa910d2a70647782afb91ba3477b8963a2e000000010000000000010000&page=1&take=3&endTime=1736096399999&startTime=1735405200000&status=filled,canceled,conditionally_canceled"
payload = ""
headers = {}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = reqwest::Client::builder()
.build()?;
let data = "";
let request = client.request(reqwest::Method::GET, "https://testnet-api.foundation.network/indexer/v1/perp/order-history?account=0xb0477aa910d2a70647782afb91ba3477b8963a2e000000010000000000010000&page=1&take=3&endTime=1736096399999&startTime=1735405200000&status=filled,canceled,conditionally_canceled")
.body(data);
let response = request.send().await?;
let body = response.text().await?;
println!("{}", body);
Ok(())
}
Response
{
"data": [
{
"time": 1736050094458,
"marketId": 2,
"ticker": "CRYPTO_ETH_PERP",
"tickSize": "0.01000000",
"stepSize": "0.01000000",
"isBuyer": false,
"price": "3640.15",
"amount": "5.13",
"filledAmount": "5.13",
"status": "filled",
"expiration": {
"timeInForce": "default",
"reduceOnly": false,
"selfTradeBehavior": "cancel_provide",
"expiresAt": null,
"isMarketOrder": false
},
"triggerCondition": null,
"averagePrice": "3640.15",
"context": null
},
{
"time": 1736049919292,
"marketId": 2,
"ticker": "CRYPTO_ETH_PERP",
"tickSize": "0.01000000",
"stepSize": "0.01000000",
"isBuyer": false,
"price": "3639.13",
"amount": "4.77",
"filledAmount": "4.77",
"status": "filled",
"expiration": {
"timeInForce": "default",
"reduceOnly": false,
"selfTradeBehavior": "cancel_provide",
"expiresAt": null,
"isMarketOrder": false
},
"triggerCondition": null,
"averagePrice": "3639.17610062893081761006",
"context": null
},
{
"time": 1736049855749,
"marketId": 2,
"ticker": "CRYPTO_ETH_PERP",
"tickSize": "0.01000000",
"stepSize": "0.01000000",
"isBuyer": false,
"price": "3632.28",
"amount": "3.16",
"filledAmount": "0",
"status": "conditionally_canceled",
"expiration": {
"timeInForce": "fill_or_kill",
"reduceOnly": false,
"selfTradeBehavior": "cancel_provide",
"expiresAt": null,
"isMarketOrder": true
},
"triggerCondition": null,
"context": null
}
],
"canNextPage": true
}// Some code
Trade history
Request
Endpoint: Rest API
Method:
GET /indexer/v1/perp/trade-history
Params:
[...]
curl --location 'https://testnet-api.foundation.network/indexer/v1/perp/trade-history?account=0xb0477aa910d2a70647782afb91ba3477b8963a2e000000010000000000010000&startTime=1735405200000&endTime=1736096399999&page=1&take=10' \
--data ''
const raw = "";
const requestOptions = {
method: "GET",
body: raw,
redirect: "follow"
};
fetch("https://testnet-api.foundation.network/indexer/v1/perp/trade-history?account=0xb0477aa910d2a70647782afb91ba3477b8963a2e000000010000000000010000&startTime=1735405200000&endTime=1736096399999&page=1&take=3", requestOptions)
.then((response) => response.text())
.then((result) => console.log(result))
.catch((error) => console.error(error));
import requests
url = "https://testnet-api.foundation.network/indexer/v1/perp/trade-history?account=0xb0477aa910d2a70647782afb91ba3477b8963a2e000000010000000000010000&startTime=1735405200000&endTime=1736096399999&page=1&take=3"
payload = ""
headers = {}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = reqwest::Client::builder()
.build()?;
let data = "";
let request = client.request(reqwest::Method::GET, "https://testnet-api.foundation.network/indexer/v1/perp/trade-history?account=0xb0477aa910d2a70647782afb91ba3477b8963a2e000000010000000000010000&startTime=1735405200000&endTime=1736096399999&page=1&take=3")
.body(data);
let response = request.send().await?;
let body = response.text().await?;
println!("{}", body);
Ok(())
}
Response
{
"data": [
{
"time": 1736050094458,
"isBuyer": false,
"price": "3640.15",
"amount": "0.16",
"tradingFee": "0.0582424",
"isMaker": true,
"marketId": 2,
"ticker": "CRYPTO_ETH_PERP",
"tickSize": "0.01000000",
"stepSize": "0.01000000"
},
{
"time": 1736050048279,
"isBuyer": false,
"price": "3640.15",
"amount": "0.19",
"tradingFee": "0.06916285",
"isMaker": true,
"marketId": 2,
"ticker": "CRYPTO_ETH_PERP",
"tickSize": "0.01000000",
"stepSize": "0.01000000"
},
{
"time": 1736050047184,
"isBuyer": false,
"price": "3640.15",
"amount": "0.15",
"tradingFee": "0.05460225",
"isMaker": true,
"marketId": 2,
"ticker": "CRYPTO_ETH_PERP",
"tickSize": "0.01000000",
"stepSize": "0.01000000"
}
],
"canNextPage": true
}
Balance history
Request
Endpoint:
Rest API
Method:
GET /indexer/v1/account/balance-change-history
Params:
[...]
curl --location 'https://testnet-api.foundation.network/indexer/v1/account/balance-change-history?account=0xb0477aa910d2a70647782afb91ba3477b8963a2e000000010000000000010000&page=1&take=10&startTime=1735405200000&endTime=1736096399999' \
--data ''
const raw = "";
const requestOptions = {
method: "GET",
body: raw,
redirect: "follow"
};
fetch("https://testnet-api.foundation.network/indexer/v1/account/balance-change-history?account=0xb0477aa910d2a70647782afb91ba3477b8963a2e000000010000000000010000&page=1&take=10&startTime=1735405200000&endTime=1736096399999", requestOptions)
.then((response) => response.text())
.then((result) => console.log(result))
.catch((error) => console.error(error));
import requests
url = "https://testnet-api.foundation.network/indexer/v1/account/balance-change-history?account=0xb0477aa910d2a70647782afb91ba3477b8963a2e000000010000000000010000&page=1&take=3&startTime=1735405200000&endTime=1736096399999"
payload = ""
headers = {}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = reqwest::Client::builder()
.build()?;
let data = "";
let request = client.request(reqwest::Method::GET, "https://testnet-api.foundation.network/indexer/v1/account/balance-change-history?account=0xb0477aa910d2a70647782afb91ba3477b8963a2e000000010000000000010000&page=1&take=3&startTime=1735405200000&endTime=1736096399999")
.body(data);
let response = request.send().await?;
let body = response.text().await?;
println!("{}", body);
Ok(())
}
Response
{
"data": [
{
"eventId": "2538079",
"account": "0xb0477aa910d2a70647782afb91ba3477b8963a2e000000010000000000010000",
"amount": "-0.0582424",
"actionType": 3,
"marketId": 2,
"createdAt": "2025-01-05T04:08:14.458Z",
"ticker": "CRYPTO_ETH_PERP"
},
{
"eventId": "2537817",
"account": "0xb0477aa910d2a70647782afb91ba3477b8963a2e000000010000000000010000",
"amount": "-0.06916285",
"actionType": 3,
"marketId": 2,
"createdAt": "2025-01-05T04:07:28.279Z",
"ticker": "CRYPTO_ETH_PERP"
},
{
"eventId": "2537801",
"account": "0xb0477aa910d2a70647782afb91ba3477b8963a2e000000010000000000010000",
"amount": "-0.05460225",
"actionType": 3,
"marketId": 2,
"createdAt": "2025-01-05T04:07:27.184Z",
"ticker": "CRYPTO_ETH_PERP"
}
],
"canNextPage": true
}
Deposit history
Request
Endpoint:
Rest API
Method:
GET /asset/v1/deposit-histories
Params:
[...]
curl --location 'https://testnet-api.foundation.network/asset/v1/deposit-histories?page=1&take=10&subaccount=0xb0477aa910d2a70647782afb91ba3477b8963a2e000000010000000000010000' \
--data ''
const raw = "";
const requestOptions = {
method: "GET",
body: raw,
redirect: "follow"
};
fetch("https://testnet-api.foundation.network/asset/v1/deposit-histories?page=1&take=10&subaccount=0xb0477aa910d2a70647782afb91ba3477b8963a2e000000010000000000010000", requestOptions)
.then((response) => response.text())
.then((result) => console.log(result))
.catch((error) => console.error(error));
import requests
url = "https://testnet-api.foundation.network/asset/v1/deposit-histories?page=1&take=10&subaccount=0xb0477aa910d2a70647782afb91ba3477b8963a2e000000010000000000010000"
payload = ""
headers = {}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = reqwest::Client::builder()
.build()?;
let data = "";
let request = client.request(reqwest::Method::GET, "https://testnet-api.foundation.network/asset/v1/deposit-histories?page=1&take=10&subaccount=0xb0477aa910d2a70647782afb91ba3477b8963a2e000000010000000000010000")
.body(data);
let response = request.send().await?;
let body = response.text().await?;
println!("{}", body);
Ok(())
}
Response
{
"page": 1,
"total_pages": 1,
"data": [
{
"id": 10,
"subaccount": "0xb0477aa910d2a70647782afb91ba3477b8963a2e000000010000000000010000",
"asset_id": 1001,
"amount": "10000.00000000",
"created_at": 1736013908,
"approved": true,
"chain_id": 11155420,
"nonce": 3,
"engine": 1,
"tx_endpoint": 8,
"wallet": null,
"is_refund": false
}
]
}
Withdraw history
Request
Endpoint: Rest API
Method:
GET /asset/v1/withdraw-histories
Params:
[...]
curl --location 'https://testnet-api.foundation.network/asset/v1/withdraw-histories?page=1&take=10&subaccount=0xb0477aa910d2a70647782afb91ba3477b8963a2e000000010000000000010000&start_time=1735405200&end_time=1736096399' \
--data ''
const raw = "";
const requestOptions = {
method: "GET",
body: raw,
redirect: "follow"
};
fetch("https://testnet-api.foundation.network/asset/v1/withdraw-histories?page=1&take=10&subaccount=0xb0477aa910d2a70647782afb91ba3477b8963a2e000000010000000000010000&start_time=1735405200&end_time=1736096399", requestOptions)
.then((response) => response.text())
.then((result) => console.log(result))
.catch((error) => console.error(error));
import requests
url = "https://testnet-api.foundation.network/asset/v1/withdraw-histories?page=1&take=10&subaccount=0xb0477aa910d2a70647782afb91ba3477b8963a2e000000010000000000010000&start_time=1735405200&end_time=1736096399"
payload = ""
headers = {}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = reqwest::Client::builder()
.build()?;
let data = "";
let request = client.request(reqwest::Method::GET, "https://testnet-api.foundation.network/asset/v1/withdraw-histories?page=1&take=10&subaccount=0xb0477aa910d2a70647782afb91ba3477b8963a2e000000010000000000010000&start_time=1735405200&end_time=1736096399")
.body(data);
let response = request.send().await?;
let body = response.text().await?;
println!("{}", body);
Ok(())
}
Response
{
"page": 1,
"total_pages": 1,
"data": [
{
"id": 4,
"subaccount": "0xb0477aa910d2a70647782afb91ba3477b8963a2e000000010000000000010000",
"asset_id": 1001,
"amount": "10000000000",
"timestamp": 1735971947,
"status": 1,
"chain_id": 11155420,
"user_signature": "0x832312ac085302a606f77ab3ae154cd81ef129474b1f00c3796ff2f8651d97202eb7df2693b5fcf8abe67111b41be9df55d57540e1619d4696a587642c8d50ea1c",
"seq_signature": "0x720ac9a4fcb130618a66d4b99f612836b4944e1be0d603e759d65542c31bf6f333f06f50dbb38bf7094fab8ffb0dea5b36b959d61d1c25afd5b98bed652fbcda1b",
"am_signature": "0x9cd7cd95e07a17864b3a923068a677102b3c1ae6cd323f19decaf27245990b6633f4a43c2743248eddfb2e38c78d2448c7335c47e6e47cc7107cd1d59dd298d21c",
"nonce": 4,
"base_fees": "100000000",
"fee_rate": "100000",
"cap_min": "100000000",
"cap_max": "1000000000",
"decay_start": 10,
"decay_end": 30,
"added_fee": "0",
"extra": "0x2a4bdbc173f170d1810e29f812f33a5f49005c1100aa37dc",
"endpoint": "0x8f105f458d98c3168a0ebcbb2a4ded4fdbb7854b",
"wallet": "0xB0477aA910d2A70647782AFB91ba3477b8963a2E"
},
{
"id": 3,
"subaccount": "0xb0477aa910d2a70647782afb91ba3477b8963a2e000000010000000000010000",
"asset_id": 1001,
"amount": "20000000000",
"timestamp": 1735971928,
"status": 1,
"chain_id": 11155420,
"user_signature": "0xc206dbefd0f498ed417db04adbae6efa38608299d9b93eb0857a643d533b56e71b3078274490e09d786d41d0821e9c3e29ebb07545cb13fac71901e21ad778ec1c",
"seq_signature": "0x6e7b193251c5aeab1552e1166f45f439ae5a4b8344fa8bac3ad33d32535f7fa3266d920a361a216136d834428b6e4c399aa46acb81a7cdc81f7b78441152aa001c",
"am_signature": "0xbd914cb517c0fec12e121df076c16b1f95d46aa72df766149ce6030ecea14cd5357e0a0953c6aeba7bfaffd2fbf66e76eeb67fcd3a8a77a9066781680ca959b01b",
"nonce": 3,
"base_fees": "100000000",
"fee_rate": "100000",
"cap_min": "100000000",
"cap_max": "1000000000",
"decay_start": 10,
"decay_end": 30,
"added_fee": "0",
"extra": "0x2a4bdbc173f170d1810e29f812f33a5f49005c1100aa37dc",
"endpoint": "0x8f105f458d98c3168a0ebcbb2a4ded4fdbb7854b",
"wallet": "0xB0477aA910d2A70647782AFB91ba3477b8963a2E"
}
]
}
Transfer history
Request
Endpoint: Rest API
Method:
GET /asset/v1/transfer-histories
Params:
[...]
curl --location 'https://testnet-api.foundation.network/asset/v1/transfer-histories?page=1&take=10&account=0xB0477aA910d2A70647782AFB91ba3477b8963a2E&start_time=1735405200&end_time=1736096399' \
--data ''
const raw = "";
const requestOptions = {
method: "GET",
body: raw,
redirect: "follow"
};
fetch("https://testnet-api.foundation.network/asset/v1/transfer-histories?page=1&take=10&account=0xB0477aA910d2A70647782AFB91ba3477b8963a2E&start_time=1735405200&end_time=1736096399", requestOptions)
.then((response) => response.text())
.then((result) => console.log(result))
.catch((error) => console.error(error));
import requests
url = "https://testnet-api.foundation.network/asset/v1/transfer-histories?page=1&take=10&account=0xB0477aA910d2A70647782AFB91ba3477b8963a2E&start_time=1735405200&end_time=1736096399"
payload = ""
headers = {}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = reqwest::Client::builder()
.build()?;
let data = "";
let request = client.request(reqwest::Method::GET, "https://testnet-api.foundation.network/asset/v1/transfer-histories?page=1&take=10&account=0xB0477aA910d2A70647782AFB91ba3477b8963a2E&start_time=1735405200&end_time=1736096399")
.body(data);
let response = request.send().await?;
let body = response.text().await?;
println!("{}", body);
Ok(())
}
Response
{
"page": 1,
"total_pages": 1,
"data": [
{
"withdraw_id": 2,
"from_account": "0xb0477aa910d2a70647782afb91ba3477b8963a2e000000010000000000010001",
"to_account": "0xb0477aa910d2a70647782afb91ba3477b8963a2e000000010000000000010000",
"asset_id": 1001,
"amount": "5000",
"created_at": 1735970097,
"status": 3,
"user_signature": "0x8eeddcfca00a7587fa5f8c96e49f042e8639f10e13b2404f914d1ad4c1f8e37110dea37f68a9ced2dbb64b0d7f0096d42b91e2095b018a550b981956a26c26f71c",
"seq_signature": "0x2eb979f2341c54b739e50449152f1bc5bd449fef87e2492728e7380fa17bb3354893cac829a87f3704ce0687ca14d2bfac0abd7f9c0e599e5d2fc2bd65f37ba81b",
"am_signature": "0xf7a04f6ff6438ded84ae3e47308abc10b8bf07c98d334d9365935b575cd8f578412355f80348e88a53932bd189185bd64a52aac7c9216c5be96c4772c9ab3e721c",
"nonce": 2,
"extra": "0x000000000000000000000000000000000000000000000001",
"tx_endpoint": 40
},
{
"withdraw_id": 1,
"from_account": "0xb0477aa910d2a70647782afb91ba3477b8963a2e000000010000000000010001",
"to_account": "0xb0477aa910d2a70647782afb91ba3477b8963a2e000000010000000000010000",
"asset_id": 1001,
"amount": "500",
"created_at": 1735970086,
"status": 3,
"user_signature": "0xaf3811fa6cfb916edd80526d3ae7f7664d6f9e65f1811d9a4b1fbcc4ba3b09360bdf225f3045953fde15ac13b1259c02999007330ae3006601fabb6a737514831b",
"seq_signature": "0x610e88f21a153df2559e4174f68a782341a214ce97b9a38239e879427b4424a00ab5e35e6bef37bacb60fa9d0ecbcbffb69f16a3218cd412cd0507b93a0e7f6c1c",
"am_signature": "0x8b12bf2e92f20e1ba73bb2046f836c9de0f8f7158d084e278e9b57357f357b017baedc0d7bc1f85f4206ed8eaea013a7780f3da806c11031b42087baf95080cb1c",
"nonce": 1,
"extra": "0x000000000000000000000000000000000000000000000001",
"tx_endpoint": 39
}
]
}
Last updated