Skip to content

Clients

The two HTTP clients. Both expose every Public and Private endpoint as a method and return the models documented under Models. Constructor arguments, rate_limit and the close/context-manager protocol come from the underlying engine and are listed inline below.

Client

Client(
    api_key: str = "",
    api_secret: str = "",
    *,
    timeout: float | Timeout | None = DEFAULT_TIMEOUT,
    base_url: str = BASE_URL,
    retry: RetryPolicy | None = None,
    rate_limits: RateLimits | None = None,
    headers: dict[str, str] | None = None,
    transport: BaseTransport | None = None,
    http_client: Client | None = None,
)

Bases: PublicAPI, PrivateAPI

bitFlyer Lightning API client.

Exposes every Public and Private HTTP endpoint as a method. The constructor arguments are listed below; the key and secret are only needed for Private endpoints.

Prefer the context manager, or call close() yourself, so the connection pool does not outlive its use::

with Client() as client:
    print(client.get_ticker(ProductCode.FX_BTC_JPY).ltp)

with Client(api_key, api_secret) as client:
    ack = client.send_child_order(
        ProductCode.BTC_JPY, ChildOrderType.LIMIT, Side.BUY, 0.001, price=5_000_000
    )
    client.cancel_child_order(
        ProductCode.BTC_JPY, child_order_acceptance_id=ack.child_order_acceptance_id
    )

Instances are safe to share between threads: the underlying httpx.Client is thread-safe and the rate limiter is locked.

For streaming market data and order events see RealtimeClient, and for asyncio see AsyncClient.

rate_limit property

rate_limit: RateLimitState | None

bitFlyer's rate limit counters as of the most recent response.

None until the first request completes, or if the server stopped sending the X-RateLimit-* headers.

close

close() -> None

Close the underlying connection pool, unless it was passed in.

get_permissions

get_permissions() -> list[str]

List the endpoints this API key is allowed to call.

Wraps GET /v1/me/getpermissions.

get_balance

get_balance() -> list[Balance]

Fetch balances for every currency.

Wraps GET /v1/me/getbalance.

get_collateral

get_collateral() -> Collateral

Fetch margin status for the account.

Wraps GET /v1/me/getcollateral.

get_collateral_accounts

get_collateral_accounts() -> list[CollateralAccount]

Fetch collateral held per currency.

Wraps GET /v1/me/getcollateralaccounts.

get_addresses

get_addresses() -> list[Address]

List your crypto deposit addresses.

Wraps GET /v1/me/getaddresses.

get_coin_ins

get_coin_ins(
    count: int | None = None,
    before: int | None = None,
    after: int | None = None,
) -> list[CoinIn]

List incoming crypto transfers.

Wraps GET /v1/me/getcoinins.

get_coin_outs

get_coin_outs(
    count: int | None = None,
    before: int | None = None,
    after: int | None = None,
) -> list[CoinOut]

List outgoing crypto transfers.

Wraps GET /v1/me/getcoinouts.

get_bank_accounts

get_bank_accounts() -> list[BankAccount]

List your registered bank accounts.

Wraps GET /v1/me/getbankaccounts.

get_deposits

get_deposits(
    count: int | None = None,
    before: int | None = None,
    after: int | None = None,
) -> list[Deposit]

List cash deposits.

Wraps GET /v1/me/getdeposits.

withdraw

withdraw(
    currency_code: str,
    bank_account_id: int,
    amount: int,
    code: str | None = None,
) -> WithdrawResponse

Withdraw cash to a registered bank account.

Wraps POST /v1/me/withdraw. This moves real money and cannot be undone. It is never retried automatically, whatever RetryPolicy says, because a timed-out withdrawal may still have been accepted.

Parameters:

Name Type Description Default
currency_code str

Currency to withdraw, e.g. "JPY".

required
bank_account_id int

id of the destination, from get_bank_accounts().

required
amount int

Amount to withdraw.

required
code str | None

Two-factor confirmation code, if your account requires one.

None

get_withdrawals

get_withdrawals(
    count: int | None = None,
    before: int | None = None,
    after: int | None = None,
    message_id: str | None = None,
) -> list[Withdrawal]

List cash withdrawals.

Wraps GET /v1/me/getwithdrawals.

Parameters:

Name Type Description Default
count int | None

Maximum records to return.

None
before int | None

Return only records with a lower id.

None
after int | None

Return only records with a higher id.

None
message_id str | None

Narrow to the withdrawal started by this message_id.

None

send_child_order

send_child_order(
    product_code: str,
    child_order_type: str,
    side: str,
    size: float,
    price: float | None = None,
    minute_to_expire: int | None = None,
    time_in_force: str = TimeInForce.GTC,
) -> ChildOrderResponse

Place an order.

Wraps POST /v1/me/sendchildorder. A successful call means the order was accepted, not filled; see ChildOrderResponse.

Parameters:

Name Type Description Default
product_code str

Market to trade.

required
child_order_type str

LIMIT or MARKET. See ChildOrderType.

required
side str

BUY or SELL. See Side.

required
size float

Order quantity in the base asset.

required
price float | None

Limit price. Required for LIMIT, ignored for MARKET.

None
minute_to_expire int | None

Minutes until the order expires. Defaults to bitFlyer's own default of 43200, i.e. 30 days.

None
time_in_force str

GTC, IOC or FOK. See TimeInForce.

GTC

cancel_child_order

cancel_child_order(
    product_code: str = ProductCode.BTC_JPY,
    child_order_id: str | None = None,
    child_order_acceptance_id: str | None = None,
) -> None

Cancel one order.

Wraps POST /v1/me/cancelchildorder, which answers with an empty body on success. Pass exactly one of the two identifiers.

Parameters:

Name Type Description Default
product_code str

Market the order is on.

BTC_JPY
child_order_id str | None

Exchange-assigned order id.

None
child_order_acceptance_id str | None

Acceptance id returned by send_child_order().

None

send_parent_order

send_parent_order(
    parameters: Sequence[
        ParentOrderParameter | dict[str, Any]
    ],
    order_method: str = OrderMethod.SIMPLE,
    minute_to_expire: int | None = None,
    time_in_force: str = TimeInForce.GTC,
) -> ParentOrderResponse

Place a conditional or multi-leg order.

Wraps POST /v1/me/sendparentorder.

Parameters:

Name Type Description Default
parameters Sequence[ParentOrderParameter | dict[str, Any]]

The legs, as ParentOrderParameter instances or plain dicts. SIMPLE and IFD take one and two legs respectively; OCO takes two and IFDOCO three.

required
order_method str

SIMPLE, IFD, OCO or IFDOCO. See OrderMethod.

SIMPLE
minute_to_expire int | None

Minutes until the order expires. Defaults to bitFlyer's own default of 43200, i.e. 30 days.

None
time_in_force str

GTC, IOC or FOK. See TimeInForce.

GTC

cancel_parent_order

cancel_parent_order(
    product_code: str = ProductCode.BTC_JPY,
    parent_order_id: str | None = None,
    parent_order_acceptance_id: str | None = None,
) -> None

Cancel one parent order.

Wraps POST /v1/me/cancelparentorder, which answers with an empty body on success. Pass exactly one of the two identifiers.

cancel_all_child_orders

cancel_all_child_orders(
    product_code: str = ProductCode.BTC_JPY,
) -> None

Cancel every open order on one market.

Wraps POST /v1/me/cancelallchildorders, which answers with an empty body on success.

get_child_orders

get_child_orders(
    product_code: str = ProductCode.BTC_JPY,
    count: int | None = None,
    before: int | None = None,
    after: int | None = None,
    child_order_state: str | None = None,
    child_order_id: str | None = None,
    child_order_acceptance_id: str | None = None,
    parent_order_id: str | None = None,
) -> list[ChildOrder]

List your orders.

Wraps GET /v1/me/getchildorders.

Parameters:

Name Type Description Default
product_code str

Market to query.

BTC_JPY
count int | None

Maximum records to return.

None
before int | None

Return only orders with a lower id.

None
after int | None

Return only orders with a higher id.

None
child_order_state str | None

Filter by state, e.g. "ACTIVE" for open orders. See ChildOrderState.

None
child_order_id str | None

Narrow to one order by exchange id.

None
child_order_acceptance_id str | None

Narrow to one order by acceptance id.

None
parent_order_id str | None

Narrow to the children of one parent order.

None

get_parent_orders

get_parent_orders(
    product_code: str = ProductCode.BTC_JPY,
    count: int | None = None,
    before: int | None = None,
    after: int | None = None,
    parent_order_state: str | None = None,
) -> list[ParentOrder]

List your parent orders.

Wraps GET /v1/me/getparentorders. The rows summarise each parent order; call get_parent_order() for its legs.

Parameters:

Name Type Description Default
product_code str

Market to query.

BTC_JPY
count int | None

Maximum records to return.

None
before int | None

Return only orders with a lower id.

None
after int | None

Return only orders with a higher id.

None
parent_order_state str | None

Filter by state. See ParentOrderState.

None

get_parent_order

get_parent_order(
    parent_order_id: str | None = None,
    parent_order_acceptance_id: str | None = None,
) -> ParentOrderDetail

Fetch one parent order together with its legs.

Wraps GET /v1/me/getparentorder. Pass exactly one of the two identifiers.

get_my_executions

get_my_executions(
    product_code: str = ProductCode.BTC_JPY,
    count: int | None = None,
    before: int | None = None,
    after: int | None = None,
    child_order_id: str | None = None,
    child_order_acceptance_id: str | None = None,
) -> list[MyExecution]

List your fills.

Wraps GET /v1/me/getexecutions. Named get_my_executions to keep it distinct from the public get_executions().

Parameters:

Name Type Description Default
product_code str

Market to query.

BTC_JPY
count int | None

Maximum records to return.

None
before int | None

Return only fills with a lower id.

None
after int | None

Return only fills with a higher id.

None
child_order_id str | None

Narrow to the fills of one order.

None
child_order_acceptance_id str | None

Narrow to the fills of one order by acceptance id.

None

get_balance_history

get_balance_history(
    currency_code: str = "JPY",
    count: int | None = None,
    before: int | None = None,
    after: int | None = None,
) -> list[BalanceHistory]

List balance ledger entries for one currency.

Wraps GET /v1/me/getbalancehistory.

get_positions

get_positions(
    product_code: str = ProductCode.FX_BTC_JPY,
) -> list[Position]

List open leveraged positions.

Wraps GET /v1/me/getpositions. Positions come back individually rather than netted.

Parameters:

Name Type Description Default
product_code str

Leveraged market to query.

FX_BTC_JPY

get_collateral_history

get_collateral_history(
    count: int | None = None,
    before: int | None = None,
    after: int | None = None,
) -> list[CollateralHistory]

List changes to your collateral.

Wraps GET /v1/me/getcollateralhistory.

get_trading_commission

get_trading_commission(
    product_code: str = ProductCode.BTC_JPY,
) -> TradingCommission

Fetch your commission rate for one market.

Wraps GET /v1/me/gettradingcommission.

get_markets

get_markets() -> list[Market]

List the available markets.

Wraps GET /v1/getmarkets.

get_board

get_board(product_code: str = ProductCode.BTC_JPY) -> Board

Fetch the order book.

Wraps GET /v1/getboard.

Parameters:

Name Type Description Default
product_code str

Market to query.

BTC_JPY

get_ticker

get_ticker(
    product_code: str = ProductCode.BTC_JPY,
) -> Ticker

Fetch the ticker.

Wraps GET /v1/getticker.

Parameters:

Name Type Description Default
product_code str

Market to query.

BTC_JPY

get_executions

get_executions(
    product_code: str = ProductCode.BTC_JPY,
    count: int | None = None,
    before: int | None = None,
    after: int | None = None,
) -> list[Execution]

List recent public trades, newest first.

Wraps GET /v1/getexecutions.

Parameters:

Name Type Description Default
product_code str

Market to query.

BTC_JPY
count int | None

Maximum records to return.

None
before int | None

Return only trades with a lower id.

None
after int | None

Return only trades with a higher id.

None

get_board_state

get_board_state(
    product_code: str = ProductCode.BTC_JPY,
) -> BoardState

Fetch the order book state.

Wraps GET /v1/getboardstate. Use this rather than get_health() to decide whether orders are being accepted right now.

Parameters:

Name Type Description Default
product_code str

Market to query.

BTC_JPY

get_health

get_health(
    product_code: str = ProductCode.BTC_JPY,
) -> Health

Fetch exchange health.

Wraps GET /v1/gethealth.

Parameters:

Name Type Description Default
product_code str

Market to query.

BTC_JPY

get_funding_rate

get_funding_rate(
    product_code: str = ProductCode.FX_BTC_JPY,
) -> FundingRate

Fetch the current funding rate.

Wraps GET /v1/getfundingrate. Only perpetual markets have one.

Parameters:

Name Type Description Default
product_code str

Perpetual market to query.

FX_BTC_JPY

get_funding_rate_history

get_funding_rate_history(
    product_code: str = ProductCode.FX_BTC_JPY,
    count: int | None = None,
    from_: str | None = None,
    to: str | None = None,
) -> list[FundingRateHistory]

List settled funding rates.

Wraps GET /v1/getfundingratehistory.

Parameters:

Name Type Description Default
product_code str

Perpetual market to query.

FX_BTC_JPY
count int | None

Maximum records to return.

None
from_ str | None

Inclusive start date, YYYY-MM-DD. Sent as from, which is a Python keyword, hence the trailing underscore.

None
to str | None

Inclusive end date, YYYY-MM-DD.

None

get_corporate_leverage

get_corporate_leverage() -> CorporateLeverage

Fetch the maximum leverage available to corporate accounts.

Wraps GET /v1/getcorporateleverage.

get_chats

get_chats(from_date: str | None = None) -> list[Chat]

List recent chat room messages.

Wraps GET /v1/getchats.

Parameters:

Name Type Description Default
from_date str | None

ISO 8601 timestamp; only messages after it are returned. Defaults to the last five days.

None

AsyncClient

AsyncClient(
    api_key: str = "",
    api_secret: str = "",
    *,
    timeout: float | Timeout | None = DEFAULT_TIMEOUT,
    base_url: str = BASE_URL,
    retry: RetryPolicy | None = None,
    rate_limits: RateLimits | None = None,
    headers: dict[str, str] | None = None,
    transport: AsyncBaseTransport | None = None,
    http_client: AsyncClient | None = None,
)

Bases: AsyncPublicAPI, AsyncPrivateAPI

Asyncio bitFlyer Lightning API client.

The same surface as Client, with every endpoint as a coroutine. Constructor arguments are listed below.

Use it as an async context manager, or await aclose()::

async with AsyncClient() as client:
    board, ticker = await asyncio.gather(
        client.get_board(ProductCode.FX_BTC_JPY),
        client.get_ticker(ProductCode.FX_BTC_JPY),
    )

Concurrent calls on one instance share the connection pool and the client-side rate limiter, so fanning out with asyncio.gather() will be throttled as one budget rather than overrunning it.

For streaming market data and order events see AsyncRealtimeClient.

rate_limit property

rate_limit: RateLimitState | None

bitFlyer's rate limit counters as of the most recent response.

None until the first request completes, or if the server stopped sending the X-RateLimit-* headers.

aclose async

aclose() -> None

Close the underlying connection pool, unless it was passed in.

get_permissions async

get_permissions() -> list[str]

List the endpoints this API key is allowed to call.

Wraps GET /v1/me/getpermissions.

get_balance async

get_balance() -> list[Balance]

Fetch balances for every currency.

Wraps GET /v1/me/getbalance.

get_collateral async

get_collateral() -> Collateral

Fetch margin status for the account.

Wraps GET /v1/me/getcollateral.

get_collateral_accounts async

get_collateral_accounts() -> list[CollateralAccount]

Fetch collateral held per currency.

Wraps GET /v1/me/getcollateralaccounts.

get_addresses async

get_addresses() -> list[Address]

List your crypto deposit addresses.

Wraps GET /v1/me/getaddresses.

get_coin_ins async

get_coin_ins(
    count: int | None = None,
    before: int | None = None,
    after: int | None = None,
) -> list[CoinIn]

List incoming crypto transfers.

Wraps GET /v1/me/getcoinins.

get_coin_outs async

get_coin_outs(
    count: int | None = None,
    before: int | None = None,
    after: int | None = None,
) -> list[CoinOut]

List outgoing crypto transfers.

Wraps GET /v1/me/getcoinouts.

get_bank_accounts async

get_bank_accounts() -> list[BankAccount]

List your registered bank accounts.

Wraps GET /v1/me/getbankaccounts.

get_deposits async

get_deposits(
    count: int | None = None,
    before: int | None = None,
    after: int | None = None,
) -> list[Deposit]

List cash deposits.

Wraps GET /v1/me/getdeposits.

withdraw async

withdraw(
    currency_code: str,
    bank_account_id: int,
    amount: int,
    code: str | None = None,
) -> WithdrawResponse

Withdraw cash to a registered bank account.

Wraps POST /v1/me/withdraw. This moves real money and cannot be undone. It is never retried automatically, whatever RetryPolicy says, because a timed-out withdrawal may still have been accepted.

Parameters:

Name Type Description Default
currency_code str

Currency to withdraw, e.g. "JPY".

required
bank_account_id int

id of the destination, from get_bank_accounts().

required
amount int

Amount to withdraw.

required
code str | None

Two-factor confirmation code, if your account requires one.

None

get_withdrawals async

get_withdrawals(
    count: int | None = None,
    before: int | None = None,
    after: int | None = None,
    message_id: str | None = None,
) -> list[Withdrawal]

List cash withdrawals.

Wraps GET /v1/me/getwithdrawals.

Parameters:

Name Type Description Default
count int | None

Maximum records to return.

None
before int | None

Return only records with a lower id.

None
after int | None

Return only records with a higher id.

None
message_id str | None

Narrow to the withdrawal started by this message_id.

None

send_child_order async

send_child_order(
    product_code: str,
    child_order_type: str,
    side: str,
    size: float,
    price: float | None = None,
    minute_to_expire: int | None = None,
    time_in_force: str = TimeInForce.GTC,
) -> ChildOrderResponse

Place an order.

Wraps POST /v1/me/sendchildorder. A successful call means the order was accepted, not filled; see ChildOrderResponse.

Parameters:

Name Type Description Default
product_code str

Market to trade.

required
child_order_type str

LIMIT or MARKET. See ChildOrderType.

required
side str

BUY or SELL. See Side.

required
size float

Order quantity in the base asset.

required
price float | None

Limit price. Required for LIMIT, ignored for MARKET.

None
minute_to_expire int | None

Minutes until the order expires. Defaults to bitFlyer's own default of 43200, i.e. 30 days.

None
time_in_force str

GTC, IOC or FOK. See TimeInForce.

GTC

cancel_child_order async

cancel_child_order(
    product_code: str = ProductCode.BTC_JPY,
    child_order_id: str | None = None,
    child_order_acceptance_id: str | None = None,
) -> None

Cancel one order.

Wraps POST /v1/me/cancelchildorder, which answers with an empty body on success. Pass exactly one of the two identifiers.

Parameters:

Name Type Description Default
product_code str

Market the order is on.

BTC_JPY
child_order_id str | None

Exchange-assigned order id.

None
child_order_acceptance_id str | None

Acceptance id returned by send_child_order().

None

send_parent_order async

send_parent_order(
    parameters: Sequence[
        ParentOrderParameter | dict[str, Any]
    ],
    order_method: str = OrderMethod.SIMPLE,
    minute_to_expire: int | None = None,
    time_in_force: str = TimeInForce.GTC,
) -> ParentOrderResponse

Place a conditional or multi-leg order.

Wraps POST /v1/me/sendparentorder.

Parameters:

Name Type Description Default
parameters Sequence[ParentOrderParameter | dict[str, Any]]

The legs, as ParentOrderParameter instances or plain dicts. SIMPLE and IFD take one and two legs respectively; OCO takes two and IFDOCO three.

required
order_method str

SIMPLE, IFD, OCO or IFDOCO. See OrderMethod.

SIMPLE
minute_to_expire int | None

Minutes until the order expires. Defaults to bitFlyer's own default of 43200, i.e. 30 days.

None
time_in_force str

GTC, IOC or FOK. See TimeInForce.

GTC

cancel_parent_order async

cancel_parent_order(
    product_code: str = ProductCode.BTC_JPY,
    parent_order_id: str | None = None,
    parent_order_acceptance_id: str | None = None,
) -> None

Cancel one parent order.

Wraps POST /v1/me/cancelparentorder, which answers with an empty body on success. Pass exactly one of the two identifiers.

cancel_all_child_orders async

cancel_all_child_orders(
    product_code: str = ProductCode.BTC_JPY,
) -> None

Cancel every open order on one market.

Wraps POST /v1/me/cancelallchildorders, which answers with an empty body on success.

get_child_orders async

get_child_orders(
    product_code: str = ProductCode.BTC_JPY,
    count: int | None = None,
    before: int | None = None,
    after: int | None = None,
    child_order_state: str | None = None,
    child_order_id: str | None = None,
    child_order_acceptance_id: str | None = None,
    parent_order_id: str | None = None,
) -> list[ChildOrder]

List your orders.

Wraps GET /v1/me/getchildorders.

Parameters:

Name Type Description Default
product_code str

Market to query.

BTC_JPY
count int | None

Maximum records to return.

None
before int | None

Return only orders with a lower id.

None
after int | None

Return only orders with a higher id.

None
child_order_state str | None

Filter by state, e.g. "ACTIVE" for open orders. See ChildOrderState.

None
child_order_id str | None

Narrow to one order by exchange id.

None
child_order_acceptance_id str | None

Narrow to one order by acceptance id.

None
parent_order_id str | None

Narrow to the children of one parent order.

None

get_parent_orders async

get_parent_orders(
    product_code: str = ProductCode.BTC_JPY,
    count: int | None = None,
    before: int | None = None,
    after: int | None = None,
    parent_order_state: str | None = None,
) -> list[ParentOrder]

List your parent orders.

Wraps GET /v1/me/getparentorders. The rows summarise each parent order; call get_parent_order() for its legs.

Parameters:

Name Type Description Default
product_code str

Market to query.

BTC_JPY
count int | None

Maximum records to return.

None
before int | None

Return only orders with a lower id.

None
after int | None

Return only orders with a higher id.

None
parent_order_state str | None

Filter by state. See ParentOrderState.

None

get_parent_order async

get_parent_order(
    parent_order_id: str | None = None,
    parent_order_acceptance_id: str | None = None,
) -> ParentOrderDetail

Fetch one parent order together with its legs.

Wraps GET /v1/me/getparentorder. Pass exactly one of the two identifiers.

get_my_executions async

get_my_executions(
    product_code: str = ProductCode.BTC_JPY,
    count: int | None = None,
    before: int | None = None,
    after: int | None = None,
    child_order_id: str | None = None,
    child_order_acceptance_id: str | None = None,
) -> list[MyExecution]

List your fills.

Wraps GET /v1/me/getexecutions. Named get_my_executions to keep it distinct from the public get_executions().

Parameters:

Name Type Description Default
product_code str

Market to query.

BTC_JPY
count int | None

Maximum records to return.

None
before int | None

Return only fills with a lower id.

None
after int | None

Return only fills with a higher id.

None
child_order_id str | None

Narrow to the fills of one order.

None
child_order_acceptance_id str | None

Narrow to the fills of one order by acceptance id.

None

get_balance_history async

get_balance_history(
    currency_code: str = "JPY",
    count: int | None = None,
    before: int | None = None,
    after: int | None = None,
) -> list[BalanceHistory]

List balance ledger entries for one currency.

Wraps GET /v1/me/getbalancehistory.

get_positions async

get_positions(
    product_code: str = ProductCode.FX_BTC_JPY,
) -> list[Position]

List open leveraged positions.

Wraps GET /v1/me/getpositions. Positions come back individually rather than netted.

Parameters:

Name Type Description Default
product_code str

Leveraged market to query.

FX_BTC_JPY

get_collateral_history async

get_collateral_history(
    count: int | None = None,
    before: int | None = None,
    after: int | None = None,
) -> list[CollateralHistory]

List changes to your collateral.

Wraps GET /v1/me/getcollateralhistory.

get_trading_commission async

get_trading_commission(
    product_code: str = ProductCode.BTC_JPY,
) -> TradingCommission

Fetch your commission rate for one market.

Wraps GET /v1/me/gettradingcommission.

get_markets async

get_markets() -> list[Market]

List the available markets.

Wraps GET /v1/getmarkets.

get_board async

get_board(product_code: str = ProductCode.BTC_JPY) -> Board

Fetch the order book.

Wraps GET /v1/getboard.

Parameters:

Name Type Description Default
product_code str

Market to query.

BTC_JPY

get_ticker async

get_ticker(
    product_code: str = ProductCode.BTC_JPY,
) -> Ticker

Fetch the ticker.

Wraps GET /v1/getticker.

Parameters:

Name Type Description Default
product_code str

Market to query.

BTC_JPY

get_executions async

get_executions(
    product_code: str = ProductCode.BTC_JPY,
    count: int | None = None,
    before: int | None = None,
    after: int | None = None,
) -> list[Execution]

List recent public trades, newest first.

Wraps GET /v1/getexecutions.

Parameters:

Name Type Description Default
product_code str

Market to query.

BTC_JPY
count int | None

Maximum records to return.

None
before int | None

Return only trades with a lower id.

None
after int | None

Return only trades with a higher id.

None

get_board_state async

get_board_state(
    product_code: str = ProductCode.BTC_JPY,
) -> BoardState

Fetch the order book state.

Wraps GET /v1/getboardstate. Use this rather than get_health() to decide whether orders are being accepted right now.

Parameters:

Name Type Description Default
product_code str

Market to query.

BTC_JPY

get_health async

get_health(
    product_code: str = ProductCode.BTC_JPY,
) -> Health

Fetch exchange health.

Wraps GET /v1/gethealth.

Parameters:

Name Type Description Default
product_code str

Market to query.

BTC_JPY

get_funding_rate async

get_funding_rate(
    product_code: str = ProductCode.FX_BTC_JPY,
) -> FundingRate

Fetch the current funding rate.

Wraps GET /v1/getfundingrate. Only perpetual markets have one.

Parameters:

Name Type Description Default
product_code str

Perpetual market to query.

FX_BTC_JPY

get_funding_rate_history async

get_funding_rate_history(
    product_code: str = ProductCode.FX_BTC_JPY,
    count: int | None = None,
    from_: str | None = None,
    to: str | None = None,
) -> list[FundingRateHistory]

List settled funding rates.

Wraps GET /v1/getfundingratehistory.

Parameters:

Name Type Description Default
product_code str

Perpetual market to query.

FX_BTC_JPY
count int | None

Maximum records to return.

None
from_ str | None

Inclusive start date, YYYY-MM-DD. Sent as from, which is a Python keyword, hence the trailing underscore.

None
to str | None

Inclusive end date, YYYY-MM-DD.

None

get_corporate_leverage async

get_corporate_leverage() -> CorporateLeverage

Fetch the maximum leverage available to corporate accounts.

Wraps GET /v1/getcorporateleverage.

get_chats async

get_chats(from_date: str | None = None) -> list[Chat]

List recent chat room messages.

Wraps GET /v1/getchats.

Parameters:

Name Type Description Default
from_date str | None

ISO 8601 timestamp; only messages after it are returned. Defaults to the last five days.

None