Bybit
Config
class BybitDataClientConfig
Bases: LiveDataClientConfig
Configuration for BybitDataClient
instances.
- Parameters:
- api_key (str , optional) – The Bybit API public key.
If
None
then will source the BYBIT_API_KEY or BYBIT_TESTNET_API_KEY environment variables. - api_secret (str , optional) – The Bybit API public key.
If
None
then will source the BYBIT_API_SECRET or BYBIT_TESTNET_API_SECRET environment variables. - product_types (list [BybitProductType ] , optional) – The Bybit product type for the client. If not specified then will use all products.
- demo (bool , default False) – If the client is connecting to the Bybit demo API.
- testnet (bool , default False) – If the client is connecting to the Bybit testnet API.
- update_instruments_interval_mins (PositiveInt or None , default 60) – The interval (minutes) between reloading instruments from the venue.
- recv_window_ms (PositiveInt , default 5000) – The receive window (milliseconds) for Bybit HTTP requests.
- api_key (str , optional) – The Bybit API public key.
If
api_key : str | None
api_secret : str | None
product_types : list[BybitProductType] | None
base_url_http : str | None
demo : bool
testnet : bool
update_instruments_interval_mins : PositiveInt | None
recv_window_ms : PositiveInt
dict() → dict[str, Any]
Return a dictionary representation of the configuration.
- Return type: dict[str, Any]
classmethod fully_qualified_name() → str
Return the fully qualified name for the NautilusConfig class.
- Return type: str
handle_revised_bars : bool
property id : str
Return the hashed identifier for the configuration.
- Return type: str
instrument_provider : InstrumentProviderConfig
json() → bytes
Return serialized JSON encoded bytes.
- Return type: bytes
json_primitives() → dict[str, Any]
Return a dictionary representation of the configuration with JSON primitive types as values.
- Return type: dict[str, Any]
classmethod parse(raw: bytes | str) → Any
Return a decoded object of the given cls.
- Parameters:
- cls (type) – The type to decode to.
- raw (bytes or str) – The raw bytes or JSON string to decode.
- Return type: Any
routing : RoutingConfig
validate() → bool
Return whether the configuration can be represented as valid JSON.
- Return type: bool
class BybitExecClientConfig
Bases: LiveExecClientConfig
Configuration for BybitExecutionClient
instances.
- Parameters:
- api_key (str , optional) – The Bybit API public key.
If
None
then will source the BYBIT_API_KEY or BYBIT_TESTNET_API_KEY environment variables. - api_secret (str , optional) – The Bybit API public key.
If
None
then will source the BYBIT_API_KEY or BYBIT_TESTNET_API_KEY environment variables. - product_types (list [BybitProductType ] , optional) – The Bybit product type for the client. If None then will default to ‘SPOT’, you also cannot mix ‘SPOT’ with any other product type for execution, and it will use a CASH account type, vs MARGIN for the other derivative products.
- base_url_ws_private (str , optional) – The base URL for the private WebSocket client.
- base_url_ws_trade (str , optional) – The base URL for the trade WebSocket client.
- demo (bool , default False) – If the client is connecting to the Bybit demo API.
- testnet (bool , default False) – If the client is connecting to the Bybit testnet API.
- use_gtd (bool , default False) – If False, then GTD time in force will be remapped to GTC (this is useful if managing GTD orders locally).
- use_ws_execution_fast (bool , default False) – If use fast execution stream.
- use_ws_trade_api (bool , default False) – If the client is using websocket to send order requests.
- use_http_batch_api (bool , default False) – If the client is using http api to send batch order requests. Effective only when use_ws_trade_api is set to True.
- max_retries (PositiveInt , optional) – The maximum number of times a submit, cancel or modify order request will be retried.
- retry_delay (PositiveFloat , optional) – The delay (seconds) between retries. Short delays with frequent retries may result in account bans.
- recv_window_ms (PositiveInt , default 5000) – The receive window (milliseconds) for Bybit HTTP requests.
- ws_trade_timeout_secs (float , default 5.0) – The timeout for trade websocket messages.
- api_key (str , optional) – The Bybit API public key.
If
WARNING
A short retry_delay with frequent retries may result in account bans.