Models¶
Every endpoint returns Pydantic models rather than raw dictionaries, so fields
are validated, timestamps arrive as datetime, and your editor can complete
them. All of them are importable from the package root:
Fields such as product_code, side and child_order_state are typed str
rather than as enums on purpose — bitFlyer adds products and state values without
warning, and a closed enum would reject a valid response. See
Enums for the known values.
Public API¶
public
¶
Response models for the Public API.
String fields such as product_code, state and side are typed str
rather than as enums so that a product or state bitFlyer adds after this release
still parses. See pylightningfx.enums for the known values.
Market
¶
Bases: BaseModel
A tradable market.
BoardEntry
¶
Board
¶
Bases: BaseModel
A snapshot of the order book.
The order of bids and asks is not guaranteed, so sort before
treating the first element as the best price::
best_bid = max(board.bids, key=lambda e: e.price)
Ticker
¶
Bases: BaseModel
Best bid and ask, last traded price, and rolling volume.
volume
instance-attribute
¶
24-hour volume across every market of the underlying asset.
volume_by_product
instance-attribute
¶
24-hour volume for this product_code alone.
preopen_end
class-attribute
instance-attribute
¶
When the pre-open auction ends. Undocumented by bitFlyer; usually None.
circuit_break_end
class-attribute
instance-attribute
¶
When the circuit breaker lifts. Undocumented by bitFlyer; usually None.
Execution
¶
Health
¶
Bases: BaseModel
Exchange health for one market.
FundingRate
¶
FundingRateHistory
¶
CorporateLeverage
¶
Bases: BaseModel
Maximum leverage for corporate accounts, current and upcoming.
Private API¶
private
¶
Request and response models for the Private API.
String fields such as product_code, side and child_order_state are
typed str rather than as enums so that a value bitFlyer adds after this
release still parses. See pylightningfx.enums for the known values.
Balance
¶
Collateral
¶
CollateralAccount
¶
Address
¶
CoinIn
¶
Bases: BaseModel
An incoming crypto transfer.
CoinOut
¶
Bases: BaseModel
An outgoing crypto transfer.
BankAccount
¶
Bases: BaseModel
A registered bank account, usable as a withdrawal destination.
Deposit
¶
Withdrawal
¶
Bases: BaseModel
A cash withdrawal.
WithdrawResponse
¶
Bases: BaseModel
Acknowledgement of a withdrawal request.
message_id
instance-attribute
¶
Pass as message_id to get_withdrawals to follow up on this request.
ChildOrderResponse
¶
Bases: BaseModel
Acknowledgement of an order submission.
The exchange has accepted the order, not necessarily filled or even placed
it. Poll get_child_orders with the acceptance id, or subscribe to
child_order_events on the Realtime API, to learn what happened.
ParentOrderResponse
¶
Bases: BaseModel
Acknowledgement of a parent order submission.
ChildOrder
¶
Bases: BaseModel
One of your orders.
ParentOrder
¶
Bases: BaseModel
One of your parent (conditional) orders, as listed.
ParentOrderParameter
¶
Bases: BaseModel
One leg of a parent order.
Serves as both the input to send_parent_order and an element of
parameters. Fields that only
apply to certain
condition types default to None and are left out of the request body::
client.send_parent_order(
[
ParentOrderParameter(
product_code=ProductCode.FX_BTC_JPY,
condition_type=ConditionType.STOP,
side=Side.SELL,
size=0.01,
trigger_price=9_000_000,
)
]
)
ParentOrderDetail
¶
Bases: BaseModel
A parent order together with its legs.
MyExecution
¶
Bases: BaseModel
One of your fills.
BalanceHistory
¶
Bases: BaseModel
One entry from the balance ledger.
Position
¶
Bases: BaseModel
An open leveraged position.
bitFlyer reports positions individually rather than netted, so a single market can hold several entries on the same side.
sfd
instance-attribute
¶
Swap For Difference charge, applied when FX_BTC_JPY diverges from BTC_JPY.
CollateralHistory
¶
Bases: BaseModel
One change to the collateral balance.
Realtime API¶
The public streaming channels reuse the models above. Only the private order event channels have models of their own.
realtime
¶
Models for the private Realtime API channels.
The public channels reuse the Public API models: lightning_board* delivers a
Board, lightning_ticker_* a
Ticker, and lightning_executions_* a list of
Execution.
Most fields below are optional because bitFlyer sends a different subset per
event_type; each one documents when it is present.
ChildOrderEvent
¶
Bases: BaseModel
One lifecycle event for one of your orders.
Delivered on the child_order_events channel. Watch event_type to
decide which optional fields to read; see
ChildOrderEventType.
event_type
instance-attribute
¶
ORDER, ORDER_FAILED, CANCEL, CANCEL_FAILED, EXECUTION
or EXPIRE.
child_order_type
class-attribute
instance-attribute
¶
ORDER only.
expire_date
class-attribute
instance-attribute
¶
ORDER and EXECUTION.
reason
class-attribute
instance-attribute
¶
ORDER_FAILED only: why the exchange rejected the order.
price
class-attribute
instance-attribute
¶
ORDER, EXECUTION, CANCEL and EXPIRE.
size
class-attribute
instance-attribute
¶
ORDER, EXECUTION, CANCEL and EXPIRE.
sfd
class-attribute
instance-attribute
¶
EXECUTION only: the Swap For Difference charge.
outstanding_size
class-attribute
instance-attribute
¶
EXECUTION only: how much of the order is still unfilled.
ParentOrderEvent
¶
Bases: BaseModel
One lifecycle event for one of your parent orders.
Delivered on the parent_order_events channel. See
ParentOrderEventType for the event_type
values,
which differ from the child order set: parent orders report TRIGGER and
COMPLETE instead of CANCEL_FAILED and EXECUTION.
event_type
instance-attribute
¶
ORDER, ORDER_FAILED, CANCEL, TRIGGER, COMPLETE or
EXPIRE.
parent_order_type
class-attribute
instance-attribute
¶
ORDER only, e.g. STOP or IFD.
child_order_type
class-attribute
instance-attribute
¶
TRIGGER only: the order type of the child that fired.
parameter_index
class-attribute
instance-attribute
¶
TRIGGER and COMPLETE: which leg, 1-based.
child_order_acceptance_id
class-attribute
instance-attribute
¶
TRIGGER and COMPLETE: links to the resulting child order.
expire_date
class-attribute
instance-attribute
¶
ORDER and TRIGGER.