Liking cljdoc? Tell your friends :D

bortexz.bybit.derivatives


requestclj

(request {:keys [http-client base-endpoint auth http-opts] :as _client}
         {:keys [method uri auth? params] :as args})

HTTP Request using client and args:

  • method :get, :post, ...
  • uri i.e /derivatives/v3/public/tickers
  • params map of parameters
  • auth? if request should use authentication

Returns the body of the response, json parsed, when status is 200. On exceptional HTTP codes or client exceptions, throws ExceptionInfo containing key :cognitect.anomalies/category, as well as args used, plus status and body if exception due to exceptional http code. Short circuits an auth? request with :cognitect.anomalies/forbidden when auth? is true but api-key or api-secret are not specified on the client.

HTTP Request using client and args:
- `method` :get, :post, ...
- `uri` i.e `/derivatives/v3/public/tickers`
- `params` map of parameters
- `auth?` if request should use authentication

Returns the body of the response, json parsed, when status is 200. On exceptional HTTP codes or client exceptions,
throws ExceptionInfo containing key `:cognitect.anomalies/category`, as well as `args` used, plus
`status` and `body` if exception due to exceptional http code. Short circuits an auth? request with 
:cognitect.anomalies/forbidden when auth? is true but api-key or api-secret are not specified on the client.
sourceraw docstring

rest-clientclj

(rest-client {:keys [auth http-opts environment] :as _client})

Creates a rest client. See request.

opts:

  • auth mandatory to use auth? requests. map of:

    • api-key
    • api-secret
    • recv-window (optional) defaults to 3 seconds.
  • environment e/o #{:testnet :bybit :bytick}

  • http-opts map of:

    • connect-timeout defaults to 10 secs
    • response-timeout
Creates a rest client. See [[request]].

opts:
- `auth` mandatory to use auth? requests. 
  map of:
  - `api-key` 
  - `api-secret`
  - `recv-window` (optional) defaults to 3 seconds.

- `environment` e/o #{:testnet :bybit :bytick}

- `http-opts` map of:
  - `connect-timeout` defaults to 10 secs
  - `response-timeout`
sourceraw docstring

websocket-clientclj

(websocket-client {:keys [auth environment channel errors-ch pub-opts ws-opts
                          reconnector-opts]})

Creates a websocket client.

opts:

  • auth only required when using an authenticated endpoint. Map of:

    • api-key
    • api-secret
    • expire-millis (optional) defaults to 3secs.
  • channel either of: #{:usdt-contract :usdc-contract :usdc-option :inverse-contract :contract-account :unified-account}

  • environment either of: #{:mainnet :testnet}

  • pub-opts (optional) options related to the internal pub used to dispatch messages. map of:

    • data-buf (optional) buffer for data source ch
    • topic-buf-fn (optional) buf-fn to use when creating internal pub. Defaults to (constantly 32)
  • errors-ch (optional) channel that contains request errors, for troubleshoting subscriptions.

  • ws-opts (optional) websocket connection options used in the resocket/reconnector. map of (all optional):

    • input-buf
    • output-buf
    • ping-interval 20 secs by default
    • ping-timeout
    • connect-timeout
    • close-timeout
    • ex-handler
  • reconnector-opts (optional) options for resocket/reconnector. map of:

    • retry-ms-fn
    • on-error-retry-fn?

Returns a websocket client that implements a/Pub protocol, and handles reconnections automatically through resocket/reconnector. You can subscribe to topics as if it were a core.async pub, and the client will internally handle subscriptions. i.e (a/sub ws-client 'orderbook.50.BTCUSDT' (a/chan) close?)

Creates a websocket client.

opts:

- `auth` only required when using an authenticated endpoint. Map of:
  - `api-key`
  - `api-secret`
  - `expire-millis` (optional) defaults to 3secs.

- `channel` either of:
  #{:usdt-contract 
    :usdc-contract 
    :usdc-option 
    :inverse-contract
    :contract-account 
    :unified-account}

- `environment` either of: 
  #{:mainnet :testnet}

- `pub-opts` (optional) options related to the internal pub used to dispatch messages. map of:
  - `data-buf` (optional) buffer for data source ch
  - `topic-buf-fn` (optional) buf-fn to use when creating internal pub. Defaults to `(constantly 32)`

- `errors-ch` (optional) channel that contains request errors, for troubleshoting subscriptions.

- `ws-opts` (optional) websocket connection options used in the resocket/reconnector. 
  map of (all optional):
  - `input-buf`
  - `output-buf`
  - `ping-interval` 20 secs by default
  - `ping-timeout`
  - `connect-timeout`
  - `close-timeout`
  - `ex-handler`

- reconnector-opts (optional) options for resocket/reconnector. map of:
  - `retry-ms-fn`
  - `on-error-retry-fn?`

Returns a websocket client that implements a/Pub protocol, and handles reconnections automatically through 
resocket/reconnector. You can subscribe to topics as if it were a core.async pub, and the client will internally
handle subscriptions. i.e `(a/sub ws-client 'orderbook.50.BTCUSDT' (a/chan) close?)`
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close