#[non_exhaustive]pub enum Environment {
Mainnet,
MainnetBytick,
Testnet,
Demo,
Turkey,
Kazakhstan,
Georgia,
Indonesia,
Custom {
api: &'static str,
stream: &'static str,
},
}Expand description
A Bybit deployment: where to send REST requests and open WebSocket streams.
Region-specific sites have their own domains; use the variant of the site
your account is registered on. Sites whose WebSocket domain Bybit does not
document (UAE, EEA) or that did not resolve when this list was made
(Japan, Hong Kong) are not listed: use Environment::Custom.
See https://bybit-exchange.github.io/docs/v5/guide and https://bybit-exchange.github.io/docs/v5/ws/connect.
use bybit::{Category, Environment};
let env = Environment::Demo;
assert_eq!(env.api_url(), "https://api-demo.bybit.com");
// Demo trading has private streams only; public data comes from mainnet.
assert_eq!(
env.public_stream_url(Category::Linear),
"wss://stream.bybit.com/v5/public/linear"
);
assert_eq!(env.private_stream_url(), "wss://stream-demo.bybit.com/v5/private");Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Mainnet
api.bybit.com, stream.bybit.com.
MainnetBytick
Alternative mainnet REST domain api.bytick.com (streams on
stream.bybit.com).
Testnet
api-testnet.bybit.com, stream-testnet.bybit.com.
Demo
Demo trading: api-demo.bybit.com; private streams on
stream-demo.bybit.com, public data from mainnet stream.bybit.com.
Turkey
Accounts registered on bybit.tr.
Kazakhstan
Accounts registered on bybit.kz.
Georgia
Accounts registered on bybitgeorgia.ge.
Indonesia
Accounts registered on bybit.id.
Custom
Any other deployment, e.g. api: "https://api.bybit.ae".
Both values are base URLs without a trailing slash.
Implementations§
Source§impl Environment
impl Environment
Sourcepub fn public_stream_url(&self, category: Category) -> String
pub fn public_stream_url(&self, category: Category) -> String
URL of the public stream of category, e.g.
wss://stream.bybit.com/v5/public/linear.
Sourcepub fn private_stream_url(&self) -> String
pub fn private_stream_url(&self) -> String
URL of the private stream (orders, positions, executions, wallet),
e.g. wss://stream.bybit.com/v5/private.
Sourcepub fn trade_stream_url(&self) -> Option<String>
pub fn trade_stream_url(&self) -> Option<String>
URL of the order entry stream (/v5/trade), or None where Bybit
does not offer it: demo trading, and sites without a documented
order entry stream (Georgia, Indonesia).
Trait Implementations§
Source§impl Clone for Environment
impl Clone for Environment
impl Copy for Environment
Source§impl Debug for Environment
impl Debug for Environment
impl Eq for Environment
Source§impl Hash for Environment
impl Hash for Environment
Source§impl PartialEq for Environment
impl PartialEq for Environment
impl StructuralPartialEq for Environment
Auto Trait Implementations§
impl Freeze for Environment
impl RefUnwindSafe for Environment
impl Send for Environment
impl Sync for Environment
impl Unpin for Environment
impl UnsafeUnpin for Environment
impl UnwindSafe for Environment
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.