Flows#
GET https://api.pro.anboto.xyz/api/v2/portfolio/flows
The flows the daily PnL subtracts, deduplicated and signed: net_flow_usd is a flow's contribution to net_flows (positive in, negative out; 0 with counted_in_pnl: false for transfers within one account and for unknown directions). When the asset could not be priced, usd_value and net_flow_usd are null (counted_in_pnl: false; transfers within one account stay 0) and the flow is counted in totals.unpriced_count. The window is half-open, [startMs, endMs): a flow at exactly endMs is not returned, so the next window starts at to_ms. Oldest first; pass next_cursor back as cursor for the next page; totals always cover the whole window. ApiKeyAuth required.
Query params#
accounts stringComma-separated accounts:
binance = every account on Binance (main and subaccounts), binance: = the main account only, binance:Sub1 = that subaccount. Omit for every account of the team. At most 20 items. Unlike /api/v2/trading/*, a missing subaccount means all accounts. Sign the raw value, e.g. accounts=binance:,bybit:Sub1.startMs integerStart, ms since epoch (inclusive). Defaults to 30 days before endMs. Must be before endMs
endMs integerEnd, ms since epoch (exclusive: a flow at exactly endMs is not returned). Defaults to now; at most 4102444800000 (2100-01-01). The window spans at most 366 days
types stringComma-separated flow types: deposit, withdrawal, internal_transfer. Default all
external booleantrue: only flows that cross the team's boundary (deposits, withdrawals); false: only transfers inside the team. Default both
limit integerFlows per page, 1 to 500 (default 500)
cursor stringnext_cursor of the previous pageHeaders#
| Header | ||
|---|---|---|
X-API-KEY |
string | required |
X-TIMESTAMP |
int64 ms | required |
X-SIGN |
string | required |
X-RECV-WINDOW |
int, default 5000 |
Responses#
| 200 | The flows |
| 400 | Invalid parameter, |
| 401 | Unauthorized: missing or unknown API key |
| 429 | Rate limit exceeded, retry later |
| 503 | The portfolio service is unavailable, |
Response fields — PortfolioFlowsResponse#
from_ms integer requiredStart of the window, ms since epoch (inclusive)
to_ms integer requiredEnd of the window, ms since epoch (exclusive): a flow at exactly to_ms is not in this window. Pass it as startMs to read the next window
Flows of this page, oldest first
flows[].id string requiredStable identifier of the flow
flows[].time integer requiredEvent time, ms since epoch
flows[].exchange string requiredflows[].subaccount string required"" is the main account
flows[].type enum requireddeposit, withdrawal, internal_transferflows[].direction enum requiredDirection for this account —
in, out, internal, unknownflows[].external boolean requiredTrue for flows that cross the team's boundary (deposits and withdrawals)
flows[].asset string requiredflows[].qty number requiredAbsolute amount of the asset, with every stored decimal digit
flows[].usd_value number requiredUSD value at the event time; null when the asset could not be priced
flows[].net_flow_usd number requiredSigned contribution to the total-scope net_flows of the daily PnL (positive in, negative out). 0 for transfers within one account (whatever the price) and for unknown directions. null when the asset could not be priced: the flow is then not in the USD totals and is counted in totals.unpriced_count. counted_in_pnl is false whenever net_flow_usd is 0 for those reasons or null
flows[].counted_in_pnl boolean requiredWhether the flow moves net_flows of the daily PnL: true when net_flow_usd is not null and direction is in or out
flows[].source string requiredExchange history the flow was read from, e.g. binance_deposit, binance_sub_transfer
Sums of net_flow_usd over the whole window and selection
totals.deposits_usd number requiredSum of deposits (≥ 0)
totals.withdrawals_usd number requiredSum of withdrawals, signed (≤ 0)
totals.net_external_usd number requireddeposits_usd + withdrawals_usd
totals.net_internal_usd number requiredNet of internal transfers counted in PnL (non-zero when the selection is part of the team)
totals.unpriced_count integer requiredFlows whose net_flow_usd is null (unpriced); they are not in the USD sums
next_cursor string requiredPass as
cursor to read the next page; null on the last pagecurl -X GET "$BASE/api/v2/portfolio/flows?accounts=string" \
-H "X-API-KEY: $API_KEY" -H "X-TIMESTAMP: $ts" \
-H "X-SIGN: $sign"
params = {"accounts": ..., "startMs": ..., "endMs": ..., "types": ..., "external": ..., "limit": ..., "cursor": ...}
r = requests.get(f"{BASE}/api/v2/portfolio/flows",
params=params
headers=signed_headers_query(params))
print(r.json())
let resp = client
.get(format!("{BASE}/api/v2/portfolio/flows?accounts=string"))
.headers(signed_headers_query(¶ms))
.send()?;
println!("{}", resp.text()?);
req, _ := http.NewRequest("GET", BASE+"/api/v2/portfolio/flows?accounts=string", nil)
for k, v := range signedHeadersQuery(req.URL.Query()) {
req.Header.Set(k, v)
}
resp, err := http.DefaultClient.Do(req)
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
io.Copy(os.Stdout, resp.Body)
HttpResponse<String> resp = client.send(
signedGet("/api/v2/portfolio/flows?accounts=string"),
HttpResponse.BodyHandlers.ofString());
const res = await fetch(`${BASE}/api/v2/portfolio/flows?accounts=string`, {
method: "GET",
headers: signedHeadersQuery(params),
});
const data: PortfolioFlowsResponse = await res.json();
val request = signedGet("/api/v2/portfolio/flows?accounts=string")
val response = client.send(request, HttpResponse.BodyHandlers.ofString())
println(response.body())
cpr::Response r = cpr::Get(
cpr::Url{BASE + "/api/v2/portfolio/flows?accounts=string"},
signedHeadersQuery(params));
std::cout << r.text << std::endl;
const res = await fetch(`${BASE}/api/v2/portfolio/flows?accounts=string`, {
method: "GET",
headers: signedHeadersQuery(params),
});
console.log(await res.json());
Response 200
{
"from_ms": 0,
"to_ms": 0,
"flows": [
{
"id": "string",
"time": 0,
"exchange": "string",
"subaccount": "string",
"type": "deposit",
"direction": "in",
"external": true,
"asset": "string",
"qty": 0.0,
"usd_value": 0.0,
"net_flow_usd": 0.0,
"counted_in_pnl": true,
"source": "string"
}
],
"totals": {
"deposits_usd": 0.0,
"withdrawals_usd": 0.0,
"net_external_usd": 0.0,
"net_internal_usd": 0.0,
"unpriced_count": 0
},
"next_cursor": "string"
}