Get Cash Flow
The API is used to obtain capital inflow/outflow direction, capital type, capital amount, occurrence time, associated stock code and capital flow description information.
SDK Links
Python |
Rust |
Go |
Node.js |
Request
HTTP Method | GET |
HTTP URL | /v1/asset/cashflow |
Parameters
Content-Type: application/json; charset=utf-8
Name | Type | Required | Description |
---|---|---|---|
start_time | string | YES | start time timestamp, in seconds , E.g:1650037563 |
end_time | string | YES | end time timestamp, in seconds , E.g:1650747581 |
business_type | string | NO | Balance type Option: 1 - cash 2 - stock3 - fund |
symbol | string | NO | Target code, E.g:AAPL.US |
page | string | NO | start page Default value: 1 Data validation rules: Ranges: >=1 |
size | string | NO | page size Default value: 50 Data validation rules: 1~10000 |
Request Example
# Get Cash Flow
# https://open.longportapp.com/docs/trade/asset/cashflow
from datetime import datetime
from longport.openapi import TradeContext, Config
config = Config.from_env()
ctx = TradeContext(config)
resp = ctx.cash_flow(
start_at = datetime(2022, 5, 9),
end_at = datetime(2022, 5, 12),
)
print(resp)
Response
Response Headers
- Content-Type: application/json
Response Example
{
"code": 0,
"data": {
"list": [
{
"transaction_flow_name": "BuyContract-Stocks",
"direction": 1,
"balance": "-248.60",
"currency": "USD",
"business_time": "1621507957",
"symbol": "AAPL.US",
"description": "AAPL"
},
{
"transaction_flow_name": "BuyContract-Stocks",
"direction": 1,
"balance": "-125.16",
"currency": "USD",
"business_time": "1621504824",
"symbol": "AAPL.US",
"description": "AAPL"
}
]
}
}
Response Status
Status | Description | Schema |
---|---|---|
200 | Success | cashflow_rsp |
400 | Internal Error | None |
Schemas
cashflow_rsp
Name | Type | Required | Description |
---|---|---|---|
list | object[] | false | Cash flow info |
∟ transaction_flow_name | string | true | Cash flow name |
∟ direction | string | true | outflow direction Option: 1 - outflow 2 - inflow |
∟ business_type | string | true | Funding Category Option: 1 - cash 2 - stock 3 - fund |
∟ balance | string | true | Cash amount |
∟ currency | string | true | Cash Currency |
∟ business_time | string | true | business time |
∟ symbol | string | false | associated Stock code information |
∟ description | string | false | Cash flow description |