Skip to Content

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.

Request

HTTP MethodGET
HTTP URL/v1/asset/cashflow

Parameters

Content-Type: application/json; charset=utf-8

NameTypeRequiredDescription
start_timestringYESstart time timestamp, in seconds, E.g:1650037563
end_timestringYESend time timestamp, in seconds, E.g:1650747581
business_typestringNOBalance type

Option:
1 - cash
2 - stock
3 - fund
symbolstringNOTarget code, E.g:AAPL.US
pagestringNOstart page

Default value: 1
Data validation rules:
Ranges: >=1
sizestringNOpage size

Default value: 50
Data validation rules: 1~10000

Request Example

python
# 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

json
{
  "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

StatusDescriptionSchema
200Successcashflow_rsp
400Internal ErrorNone

Schemas

cashflow_rsp

NameTypeRequiredDescription
listobject[]falseCash flow info
∟ transaction_flow_namestringtrueCash flow name
∟ directionstringtrueoutflow direction

Option:
1 - outflow
2 - inflow
∟ business_typestringtrueFunding Category

Option:
1 - cash
2 - stock
3 - fund
∟ balancestringtrueCash amount
∟ currencystringtrueCash Currency
∟ business_timestringtruebusiness time
∟ symbolstringfalseassociated Stock code information
∟ descriptionstringfalseCash flow description