Skip to main content

Upbit

Struct Upbit 

Source
pub struct Upbit { /* private fields */ }
Expand description

An Upbit client over injected transports.

Implementations§

Source§

impl Upbit

Source

pub fn with_http( http: Box<dyn HttpTransport>, options: &ExchangeOptions, ) -> Upbit

Build a public Upbit client.

Source

pub fn with_credentials( http: Box<dyn HttpTransport>, options: &ExchangeOptions, credentials: Credentials, ) -> Upbit

Build an authenticated Upbit client.

Source

pub fn with_clock(self, now_ms: Box<dyn Fn() -> i64 + Send + Sync>) -> Upbit

Override the timestamp/nonce source (deterministic signing in tests).

Source

pub fn with_ws(self, ws: Box<dyn WsTransport>) -> Upbit

Attach a WebSocket transport.

Source

pub fn wire_symbol(symbol: &Symbol) -> String

The Upbit wire market for a canonical Symbol (BTC/USDT -> USDT-BTC, quote first).

Source

pub fn ticker(&self, symbol: &Symbol) -> Result<Ticker, Error>

A ticker for symbol. Upbit’s ticker has no separate bid/ask, so both mirror the last trade price.

§Errors

Returns an Error if the request fails or the symbol is unknown.

Source

pub fn klines( &self, symbol: &Symbol, interval: &str, limit: u32, ) -> Result<Vec<Candle>, Error>

Up to limit candles for symbol at interval (unified). Upbit returns newest-first; the result is chronological.

§Errors

Returns an Error if the request fails or a row cannot be parsed.

Source

pub fn order_book( &self, symbol: &Symbol, _depth: u32, ) -> Result<OrderBookSnapshot, Error>

A depth snapshot of symbol.

§Errors

Returns an Error if the request fails or the response cannot be parsed.

Source

pub fn subscribe_trades(&mut self, symbol: &Symbol) -> Result<(), Error>

Subscribe to the public trade stream for symbol.

§Errors

Returns Error::NotConnected if no WebSocket transport is configured.

Source

pub fn subscribe_book(&mut self, symbol: &Symbol) -> Result<(), Error>

Subscribe to the order-book stream for symbol.

§Errors

See subscribe_trades.

Source

pub fn subscribe_ticker(&mut self, symbol: &Symbol) -> Result<(), Error>

Subscribe to the ticker stream for symbol.

§Errors

See subscribe_trades.

Source

pub fn poll_events(&mut self) -> Vec<Event>

Drain all stream events available since the last call. Non-blocking.

Source

pub fn place_order(&self, request: &OrderRequest) -> Result<Order, Error>

Place an order.

§Errors

Returns an Error if the order is invalid, credentials are missing, or the venue rejects it.

Source

pub fn cancel_order( &self, _symbol: &Symbol, order_id: &str, ) -> Result<(), Error>

Cancel an open order by venue id.

§Errors

Returns an Error if credentials are missing or the venue rejects it.

Source

pub fn query_order( &self, symbol: &Symbol, order_id: &str, ) -> Result<Order, Error>

Query a single order by venue id.

§Errors

Returns an Error if credentials are missing or the order is unknown.

Source

pub fn open_orders(&self, symbol: Option<&Symbol>) -> Result<Vec<Order>, Error>

Open orders, optionally filtered to one symbol.

§Errors

Returns an Error if credentials are missing or the request fails.

Source

pub fn balances(&self) -> Result<Vec<Balance>, Error>

Account balances.

§Errors

Returns an Error if credentials are missing or the request fails.

Trait Implementations§

Source§

impl Debug for Upbit

Hand-written: the client holds Box<dyn HttpTransport>, Box<dyn WsTransport> and a Box<dyn Fn() -> i64> clock, none of which a derive can reach. The transports are shown by whether a connection is open rather than by value, and the credentials only by whether they are set – printing them would put secret material into every log line that formats a client.

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Exchange for Upbit

Source§

fn name(&self) -> &'static str

The venue’s lowercase identifier (e.g. "binance").
Source§

impl Execution for Upbit

Source§

fn place_order(&mut self, request: &OrderRequest) -> Result<Order, Error>

Place an order and return it as accepted by the venue. Read more
Source§

fn cancel_order(&mut self, symbol: &Symbol, order_id: &str) -> Result<(), Error>

Cancel an open order by venue id. Read more
Source§

fn query_order( &mut self, symbol: &Symbol, order_id: &str, ) -> Result<Order, Error>

Query a single order by venue id. Read more
Source§

fn open_orders(&mut self, symbol: Option<&Symbol>) -> Result<Vec<Order>, Error>

All open orders, optionally filtered to one symbol. Read more
Source§

fn balances(&mut self) -> Result<Vec<Balance>, Error>

Current account balances. Read more
Source§

impl MarketData for Upbit

Source§

fn ticker(&mut self, symbol: &Symbol) -> Result<Ticker, Error>

A point-in-time ticker for symbol. Read more
Source§

fn klines( &mut self, symbol: &Symbol, interval: &str, limit: u32, ) -> Result<Vec<Candle>, Error>

Up to limit historical candles for symbol at the given interval (e.g. "1m", "1h"). Returns wickra_core::Candles so the result feeds the indicator core directly. Read more
Source§

fn order_book( &mut self, symbol: &Symbol, depth: u32, ) -> Result<OrderBookSnapshot, Error>

A depth snapshot of symbol up to depth levels per side. Read more
Source§

fn subscribe_trades(&mut self, symbol: &Symbol) -> Result<(), Error>

Subscribe to the public trade stream for symbol. Read more
Source§

fn subscribe_book(&mut self, symbol: &Symbol) -> Result<(), Error>

Subscribe to the order-book stream for symbol. Read more
Source§

fn subscribe_ticker(&mut self, symbol: &Symbol) -> Result<(), Error>

Subscribe to the ticker stream for symbol. Read more
Source§

fn poll_events(&mut self) -> Vec<Event>

Drain all events buffered since the last call. Non-blocking: returns an empty vector when nothing is pending.

Auto Trait Implementations§

§

impl !Freeze for Upbit

§

impl !RefUnwindSafe for Upbit

§

impl !Sync for Upbit

§

impl !UnwindSafe for Upbit

§

impl Send for Upbit

§

impl Unpin for Upbit

§

impl UnsafeUnpin for Upbit

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more