ccxt.exchange_compatible
Documentation for eth_defi.ccxt.exchange_compatible Python module.
CCXT-compatible adapter base for DEXes and perp DEXes.
Classes
CCXT Exchange class compatible adapter for DEX. |
- class ExchangeCompatible
Bases:
ccxt.base.exchange.ExchangeCCXT Exchange class compatible adapter for DEX.
- __init__(config={})
- Parameters
config (ccxt.base.types.ConstructorArgs) –
- assign_default_deposit_withdraw_fees(fee, currency=None)
- @ignore
Takes a depositWithdrawFee structure and assigns the default values for withdraw and deposit :param dict fee: A deposit withdraw fee structure :param dict currency: A currency structure, the response from self.currency() :returns dict: A deposit withdraw fee structure
- static base58_to_binary(s)
encodes a base58 string to as a big endian integer
- calculate_fee(symbol, type, side, amount, price, takerOrMaker='taker', params={})
calculates the presumptive fee that would be charged for an order :param str symbol: unified market symbol :param str type: ‘market’ or ‘limit’ :param str side: ‘buy’ or ‘sell’ :param float amount: how much you want to trade, in units of the base currency on most exchanges, or number of contracts :param float price: the price for the order to be filled at, in units of the quote currency :param str takerOrMaker: ‘taker’ or ‘maker’ :param dict params: :returns dict: contains the rate, the percentage multiplied to the order amount to obtain the fee amount, and cost, the total value of the fee in units of the quote currency, for the order
- cancel_order_with_client_order_id(clientOrderId, symbol=None, params={})
create a market order by providing the symbol, side and cost :param str clientOrderId: client order Id :param str symbol: unified symbol of the market to create an order in :param dict [params]: extra parameters specific to the exchange API endpoint :returns dict: an order structure <https://docs.ccxt.com/?id=order-structure>
- cancel_orders_with_client_order_ids(clientOrderIds, symbol=None, params={})
create a market order by providing the symbol, side and cost :param str[] clientOrderIds: client order Ids :param str symbol: unified symbol of the market to create an order in :param dict [params]: extra parameters specific to the exchange API endpoint :returns dict: an order structure <https://docs.ccxt.com/?id=order-structure>
- check_required_argument(methodName, argument, argumentName, options=[])
- @ignore
- param str methodName
the name of the method that the argument is being checked for
- param str argument
the argument’s actual value provided
- param str argumentName
the name of the argument being checked(for logging purposes)
- param str[] options
a list of options that the argument can be
- returns None
- Parameters
methodName (str) –
- check_required_credentials(error=True)
- @ignore
- param boolean error
raise an error that a credential is required if True
- returns boolean
True if all required credentials have been set, otherwise False or an error is thrown is param error=true
- check_required_margin_argument(methodName, symbol, marginMode)
- @ignore
- param str symbol
unified symbol of the market
- param str methodName
name of the method that requires a symbol
- param str marginMode
is either ‘isolated’ or ‘cross’
- convert_type_to_account(account)
@ignore Must add accountsByType to self.options to use self method
- param str account
key for account name in self.options[‘accountsByType’]
- returns
the exchange specific account name or the isolated margin id for transfers
- create_market_buy_order_with_cost(symbol, cost, params={})
create a market buy order by providing the symbol and cost :param str symbol: unified symbol of the market to create an order in :param float cost: how much you want to trade in units of the quote currency :param dict [params]: extra parameters specific to the exchange API endpoint :returns dict: an order structure <https://docs.ccxt.com/?id=order-structure>
- create_market_order_with_cost(symbol, side, cost, params={})
create a market order by providing the symbol, side and cost :param str symbol: unified symbol of the market to create an order in :param str side: ‘buy’ or ‘sell’ :param float cost: how much you want to trade in units of the quote currency :param dict [params]: extra parameters specific to the exchange API endpoint :returns dict: an order structure <https://docs.ccxt.com/?id=order-structure>
- create_market_order_with_cost_ws(symbol, side, cost, params={})
create a market order by providing the symbol, side and cost :param str symbol: unified symbol of the market to create an order in :param str side: ‘buy’ or ‘sell’ :param float cost: how much you want to trade in units of the quote currency :param dict [params]: extra parameters specific to the exchange API endpoint :returns dict: an order structure <https://docs.ccxt.com/?id=order-structure>
- create_market_sell_order_with_cost(symbol, cost, params={})
create a market sell order by providing the symbol and cost :param str symbol: unified symbol of the market to create an order in :param float cost: how much you want to trade in units of the quote currency :param dict [params]: extra parameters specific to the exchange API endpoint :returns dict: an order structure <https://docs.ccxt.com/?id=order-structure>
- create_order_with_take_profit_and_stop_loss(symbol, type, side, amount, price=None, takeProfit=None, stopLoss=None, params={})
create an order with a stop loss or take profit attached(type 3) :param str symbol: unified symbol of the market to create an order in :param str type: ‘market’ or ‘limit’ :param str side: ‘buy’ or ‘sell’ :param float amount: how much you want to trade in units of the base currency or the number of contracts :param float [price]: the price to fulfill the order, in units of the quote currency, ignored in market orders :param float [takeProfit]: the take profit price, in units of the quote currency :param float [stopLoss]: the stop loss price, in units of the quote currency :param dict [params]: extra parameters specific to the exchange API endpoint :param str [params.takeProfitType]: not available on all exchanges ‘limit’ or ‘market’ :param str [params.stopLossType]: not available on all exchanges ‘limit’ or ‘market’ :param str [params.takeProfitPriceType]: not available on all exchanges ‘last’, ‘mark’ or ‘index’ :param str [params.stopLossPriceType]: not available on all exchanges ‘last’, ‘mark’ or ‘index’ :param float [params.takeProfitLimitPrice]: not available on all exchanges limit price for a limit take profit order :param float [params.stopLossLimitPrice]: not available on all exchanges stop loss for a limit stop loss order :param float [params.takeProfitAmount]: not available on all exchanges the amount for a take profit :param float [params.stopLossAmount]: not available on all exchanges the amount for a stop loss :returns dict: an order structure <https://docs.ccxt.com/?id=order-structure>
- create_order_with_take_profit_and_stop_loss_ws(symbol, type, side, amount, price=None, takeProfit=None, stopLoss=None, params={})
create an order with a stop loss or take profit attached(type 3) :param str symbol: unified symbol of the market to create an order in :param str type: ‘market’ or ‘limit’ :param str side: ‘buy’ or ‘sell’ :param float amount: how much you want to trade in units of the base currency or the number of contracts :param float [price]: the price to fulfill the order, in units of the quote currency, ignored in market orders :param float [takeProfit]: the take profit price, in units of the quote currency :param float [stopLoss]: the stop loss price, in units of the quote currency :param dict [params]: extra parameters specific to the exchange API endpoint :param str [params.takeProfitType]: not available on all exchanges ‘limit’ or ‘market’ :param str [params.stopLossType]: not available on all exchanges ‘limit’ or ‘market’ :param str [params.takeProfitPriceType]: not available on all exchanges ‘last’, ‘mark’ or ‘index’ :param str [params.stopLossPriceType]: not available on all exchanges ‘last’, ‘mark’ or ‘index’ :param float [params.takeProfitLimitPrice]: not available on all exchanges limit price for a limit take profit order :param float [params.stopLossLimitPrice]: not available on all exchanges stop loss for a limit stop loss order :param float [params.takeProfitAmount]: not available on all exchanges the amount for a take profit :param float [params.stopLossAmount]: not available on all exchanges the amount for a stop loss :returns dict: an order structure <https://docs.ccxt.com/?id=order-structure>
- create_orders_ws(orders, params={})
create a list of trade orders :param Array orders: list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params :param dict [params]: extra parameters specific to the exchange API endpoint :returns dict: an order structure <https://docs.ccxt.com/?id=order-structure>
- Parameters
orders (List[ccxt.base.types.OrderRequest]) –
- create_stop_loss_order(symbol, type, side, amount, price=None, stopLossPrice=None, params={})
create a trigger stop loss order(type 2) :param str symbol: unified symbol of the market to create an order in :param str type: ‘market’ or ‘limit’ :param str side: ‘buy’ or ‘sell’ :param float amount: how much you want to trade in units of the base currency or the number of contracts :param float [price]: the price to fulfill the order, in units of the quote currency, ignored in market orders :param float stopLossPrice: the price to trigger the stop loss order, in units of the quote currency :param dict [params]: extra parameters specific to the exchange API endpoint :returns dict: an order structure <https://docs.ccxt.com/?id=order-structure>
- create_stop_loss_order_ws(symbol, type, side, amount, price=None, stopLossPrice=None, params={})
create a trigger stop loss order(type 2) :param str symbol: unified symbol of the market to create an order in :param str type: ‘market’ or ‘limit’ :param str side: ‘buy’ or ‘sell’ :param float amount: how much you want to trade in units of the base currency or the number of contracts :param float [price]: the price to fulfill the order, in units of the quote currency, ignored in market orders :param float stopLossPrice: the price to trigger the stop loss order, in units of the quote currency :param dict [params]: extra parameters specific to the exchange API endpoint :returns dict: an order structure <https://docs.ccxt.com/?id=order-structure>
- create_take_profit_order(symbol, type, side, amount, price=None, takeProfitPrice=None, params={})
create a trigger take profit order(type 2) :param str symbol: unified symbol of the market to create an order in :param str type: ‘market’ or ‘limit’ :param str side: ‘buy’ or ‘sell’ :param float amount: how much you want to trade in units of the base currency or the number of contracts :param float [price]: the price to fulfill the order, in units of the quote currency, ignored in market orders :param float takeProfitPrice: the price to trigger the take profit order, in units of the quote currency :param dict [params]: extra parameters specific to the exchange API endpoint :returns dict: an order structure <https://docs.ccxt.com/?id=order-structure>
- create_take_profit_order_ws(symbol, type, side, amount, price=None, takeProfitPrice=None, params={})
create a trigger take profit order(type 2) :param str symbol: unified symbol of the market to create an order in :param str type: ‘market’ or ‘limit’ :param str side: ‘buy’ or ‘sell’ :param float amount: how much you want to trade in units of the base currency or the number of contracts :param float [price]: the price to fulfill the order, in units of the quote currency, ignored in market orders :param float takeProfitPrice: the price to trigger the take profit order, in units of the quote currency :param dict [params]: extra parameters specific to the exchange API endpoint :returns dict: an order structure <https://docs.ccxt.com/?id=order-structure>
- create_trailing_amount_order(symbol, type, side, amount, price=None, trailingAmount=None, trailingTriggerPrice=None, params={})
create a trailing order by providing the symbol, type, side, amount, price and trailingAmount :param str symbol: unified symbol of the market to create an order in :param str type: ‘market’ or ‘limit’ :param str side: ‘buy’ or ‘sell’ :param float amount: how much you want to trade in units of the base currency, or number of contracts :param float [price]: the price for the order to be filled at, in units of the quote currency, ignored in market orders :param float trailingAmount: the quote amount to trail away from the current market price :param float [trailingTriggerPrice]: the price to activate a trailing order, default uses the price argument :param dict [params]: extra parameters specific to the exchange API endpoint :returns dict: an order structure <https://docs.ccxt.com/?id=order-structure>
- Parameters
- create_trailing_amount_order_ws(symbol, type, side, amount, price=None, trailingAmount=None, trailingTriggerPrice=None, params={})
create a trailing order by providing the symbol, type, side, amount, price and trailingAmount :param str symbol: unified symbol of the market to create an order in :param str type: ‘market’ or ‘limit’ :param str side: ‘buy’ or ‘sell’ :param float amount: how much you want to trade in units of the base currency, or number of contracts :param float [price]: the price for the order to be filled at, in units of the quote currency, ignored in market orders :param float trailingAmount: the quote amount to trail away from the current market price :param float [trailingTriggerPrice]: the price to activate a trailing order, default uses the price argument :param dict [params]: extra parameters specific to the exchange API endpoint :returns dict: an order structure <https://docs.ccxt.com/?id=order-structure>
- Parameters
- create_trailing_percent_order(symbol, type, side, amount, price=None, trailingPercent=None, trailingTriggerPrice=None, params={})
create a trailing order by providing the symbol, type, side, amount, price and trailingPercent :param str symbol: unified symbol of the market to create an order in :param str type: ‘market’ or ‘limit’ :param str side: ‘buy’ or ‘sell’ :param float amount: how much you want to trade in units of the base currency, or number of contracts :param float [price]: the price for the order to be filled at, in units of the quote currency, ignored in market orders :param float trailingPercent: the percent to trail away from the current market price :param float [trailingTriggerPrice]: the price to activate a trailing order, default uses the price argument :param dict [params]: extra parameters specific to the exchange API endpoint :returns dict: an order structure <https://docs.ccxt.com/?id=order-structure>
- Parameters
- create_trailing_percent_order_ws(symbol, type, side, amount, price=None, trailingPercent=None, trailingTriggerPrice=None, params={})
create a trailing order by providing the symbol, type, side, amount, price and trailingPercent :param str symbol: unified symbol of the market to create an order in :param str type: ‘market’ or ‘limit’ :param str side: ‘buy’ or ‘sell’ :param float amount: how much you want to trade in units of the base currency, or number of contracts :param float [price]: the price for the order to be filled at, in units of the quote currency, ignored in market orders :param float trailingPercent: the percent to trail away from the current market price :param float [trailingTriggerPrice]: the price to activate a trailing order, default uses the price argument :param dict [params]: extra parameters specific to the exchange API endpoint :returns dict: an order structure <https://docs.ccxt.com/?id=order-structure>
- Parameters
- create_trigger_order(symbol, type, side, amount, price=None, triggerPrice=None, params={})
create a trigger stop order(type 1) :param str symbol: unified symbol of the market to create an order in :param str type: ‘market’ or ‘limit’ :param str side: ‘buy’ or ‘sell’ :param float amount: how much you want to trade in units of the base currency or the number of contracts :param float [price]: the price to fulfill the order, in units of the quote currency, ignored in market orders :param float triggerPrice: the price to trigger the stop order, in units of the quote currency :param dict [params]: extra parameters specific to the exchange API endpoint :returns dict: an order structure <https://docs.ccxt.com/?id=order-structure>
- create_trigger_order_ws(symbol, type, side, amount, price=None, triggerPrice=None, params={})
create a trigger stop order(type 1) :param str symbol: unified symbol of the market to create an order in :param str type: ‘market’ or ‘limit’ :param str side: ‘buy’ or ‘sell’ :param float amount: how much you want to trade in units of the base currency or the number of contracts :param float [price]: the price to fulfill the order, in units of the quote currency, ignored in market orders :param float triggerPrice: the price to trigger the stop order, in units of the quote currency :param dict [params]: extra parameters specific to the exchange API endpoint :returns dict: an order structure <https://docs.ccxt.com/?id=order-structure>
- static ecdsa(request, secret, algorithm='p256', hash=None, fixed_length=False)
ECDSA signing with support for multiple algorithms and coincurve for SECP256K1. Args:
request: The message to sign secret: The private key (hex string or PEM format) algorithm: The elliptic curve algorithm (‘p192’, ‘p224’, ‘p256’, ‘p384’, ‘p521’, ‘secp256k1’) hash: The hash function to use (defaults to algorithm-specific hash) fixed_length: Whether to ensure fixed-length signatures (for deterministic signing) Note: coincurve produces non-deterministic signatures
- Returns:
dict: {‘r’: r_value, ‘s’: s_value, ‘v’: v_value}
- Note:
If coincurve is not available or fails for SECP256K1, the method automatically falls back to the standard ecdsa implementation.
- enable_demo_trading(enable)
enables or disables demo trading mode :param boolean [enable]: True if demo trading should be enabled, False otherwise
- Parameters
enable (bool) –
- feature_value(symbol, methodName=None, paramName=None, defaultValue=None)
self method is a very deterministic to help users to know what feature is supported by the exchange :param str [symbol]: unified symbol :param str [methodName]: view currently supported methods: https://docs.ccxt.com/#/README?id=features :param str [paramName]: unified param value, like: triggerPrice, `stopLoss.triggerPrice`(check docs for supported param names) :param dict [defaultValue]: return default value if no result found :returns dict: returns feature value
- feature_value_by_type(marketType, subType, methodName=None, paramName=None, defaultValue=None)
self method is a very deterministic to help users to know what feature is supported by the exchange :param str [marketType]: supported only: “spot”, “swap”, “future” :param str [subType]: supported only: “linear”, “inverse” :param str [methodName]: view currently supported methods: https://docs.ccxt.com/#/README?id=features :param str [paramName]: unified param value(check docs for supported param names) :param dict [defaultValue]: return default value if no result found :returns dict: returns feature value
- fetch(url, method='GET', headers=None, body=None)
Perform a HTTP request and return decoded JSON data
- fetch_deposits_withdrawals(code=None, since=None, limit=None, params={})
fetch history of deposits and withdrawals :param str [code]: unified currency code for the currency of the deposit/withdrawals, default is None :param int [since]: timestamp in ms of the earliest deposit/withdrawal, default is None :param int [limit]: max number of deposit/withdrawals to return, default is None :param dict [params]: extra parameters specific to the exchange API endpoint :returns dict: a list of transaction structures <https://docs.ccxt.com/?id=transaction-structure>
- fetch_index_ohlcv(symbol, timeframe='1m', since=None, limit=None, params={})
fetches historical index price candlestick data containing the open, high, low, and close price of a market :param str symbol: unified symbol of the market to fetch OHLCV data for :param str timeframe: the length of time each candle represents :param int [since]: timestamp in ms of the earliest candle to fetch :param int [limit]: the maximum amount of candles to fetch :param dict [params]: extra parameters specific to the exchange API endpoint
@returns {} A list of candles ordered, open, high, low, close, None
- fetch_margin_adjustment_history(symbol=None, type=None, since=None, limit=None, params={})
fetches the history of margin added or reduced from contract isolated positions :param str [symbol]: unified market symbol :param str [type]: “add” or “reduce” :param int [since]: timestamp in ms of the earliest change to fetch :param int [limit]: the maximum amount of changes to fetch :param dict params: extra parameters specific to the exchange api endpoint :returns dict[]: a list of margin structures <https://docs.ccxt.com/?id=margin-loan-structure>
- fetch_mark_ohlcv(symbol, timeframe='1m', since=None, limit=None, params={})
fetches historical mark price candlestick data containing the open, high, low, and close price of a market :param str symbol: unified symbol of the market to fetch OHLCV data for :param str timeframe: the length of time each candle represents :param int [since]: timestamp in ms of the earliest candle to fetch :param int [limit]: the maximum amount of candles to fetch :param dict [params]: extra parameters specific to the exchange API endpoint :returns float[][]: A list of candles ordered, open, high, low, close, None
- fetch_order_with_client_order_id(clientOrderId, symbol=None, params={})
create a market order by providing the symbol, side and cost :param str clientOrderId: client order Id :param str symbol: unified symbol of the market to create an order in :param dict [params]: extra parameters specific to the exchange API endpoint :returns dict: an order structure <https://docs.ccxt.com/?id=order-structure>
- fetch_orders_by_status_ws(status, symbol=None, since=None, limit=None, params={})
watches information on open orders with bid(buy) and ask(sell) prices, volumes and other data :param str symbol: unified symbol of the market to fetch the order book for :param int [limit]: the maximum amount of order book entries to return :param dict [params]: extra parameters specific to the exchange API endpoint :returns dict: A dictionary of order book structures <https://docs.ccxt.com/?id=order-book-structure> indexed by market symbols
- fetch_position_history(symbol, since=None, limit=None, params={})
fetches the history of margin added or reduced from contract isolated positions :param str [symbol]: unified market symbol :param int [since]: timestamp in ms of the position :param int [limit]: the maximum amount of candles to fetch, default=1000 :param dict params: extra parameters specific to the exchange api endpoint :returns dict[]: a list of position structures <https://docs.ccxt.com/?id=position-structure>
- fetch_positions_for_symbol(symbol, params={})
fetches all open positions for specific symbol, unlike fetchPositions(which is designed to work with multiple symbols) so self method might be preffered for one-market position, because of less rate-limit consumption and speed :param str symbol: unified market symbol :param dict params: extra parameters specific to the endpoint :returns dict[]: a list of position structure <https://docs.ccxt.com/?id=position-structure> with maximum 3 items - possible one position for “one-way” mode, and possible two positions(long & short) for “two-way”(a.k.a. hedge) mode
- Parameters
symbol (str) –
- fetch_positions_for_symbol_ws(symbol, params={})
fetches all open positions for specific symbol, unlike fetchPositions(which is designed to work with multiple symbols) so self method might be preffered for one-market position, because of less rate-limit consumption and speed :param str symbol: unified market symbol :param dict params: extra parameters specific to the endpoint :returns dict[]: a list of position structure <https://docs.ccxt.com/?id=position-structure> with maximum 3 items - possible one position for “one-way” mode, and possible two positions(long & short) for “two-way”(a.k.a. hedge) mode
- Parameters
symbol (str) –
- fetch_positions_history(symbols=None, since=None, limit=None, params={})
fetches the history of margin added or reduced from contract isolated positions :param str [symbol]: unified market symbol :param int [since]: timestamp in ms of the position :param int [limit]: the maximum amount of candles to fetch, default=1000 :param dict params: extra parameters specific to the exchange api endpoint :returns dict[]: a list of position structures <https://docs.ccxt.com/?id=position-structure>
fetches historical premium index price candlestick data containing the open, high, low, and close price of a market :param str symbol: unified symbol of the market to fetch OHLCV data for :param str timeframe: the length of time each candle represents :param int [since]: timestamp in ms of the earliest candle to fetch :param int [limit]: the maximum amount of candles to fetch :param dict [params]: extra parameters specific to the exchange API endpoint :returns float[][]: A list of candles ordered, open, high, low, close, None
- fetch_transactions(code=None, since=None, limit=None, params={})
- @deprecated
DEPRECATED use fetchDepositsWithdrawals instead :param str code: unified currency code for the currency of the deposit/withdrawals, default is None :param int [since]: timestamp in ms of the earliest deposit/withdrawal, default is None :param int [limit]: max number of deposit/withdrawals to return, default is None :param dict [params]: extra parameters specific to the exchange API endpoint :returns dict: a list of transaction structures <https://docs.ccxt.com/?id=transaction-structure>
- fetch_transfer(id, code=None, params={})
fetches a transfer :param str id: transfer id :param [str] code: unified currency code :param dict params: extra parameters specific to the exchange api endpoint :returns dict: a transfer structure <https://docs.ccxt.com/?id=transfer-structure>
- fetch_transfers(code=None, since=None, limit=None, params={})
fetches a transfer :param str id: transfer id :param int [since]: timestamp in ms of the earliest transfer to fetch :param int [limit]: the maximum amount of transfers to fetch :param dict params: extra parameters specific to the exchange api endpoint :returns dict: a transfer structure <https://docs.ccxt.com/?id=transfer-structure>
- filter_by_array_positions(objects, key, values=None, indexed=True)
- @ignore
Typed wrapper for filterByArray that returns a list of positions
- filter_by_array_tickers(objects, key, values=None, indexed=True)
- @ignore
Typed wrapper for filterByArray that returns a dictionary of tickers
- handle_margin_mode_and_params(methodName, params={}, defaultValue=None)
- @ignore
- param dict [params]
extra parameters specific to the exchange API endpoint
- returns Array
the marginMode in lowercase by params[“marginMode”], params[“defaultMarginMode”] self.options[“marginMode”] or self.options[“defaultMarginMode”]
- Parameters
methodName (str) –
- handle_market_type_and_params(methodName, market=None, params={}, defaultValue=None)
@ignore @param methodName the method calling handleMarketTypeAndParams
- param Market market
- param dict params
- param str [params.type]
type assigned by user
- param str [params.defaultType]
same.type
- param str [defaultValue]
assigned programatically in the method calling handleMarketTypeAndParams
- returns [str, dict]
the market type and params with type and defaultType omitted
- handle_post_only(isMarketOrder, exchangeSpecificPostOnlyOption, params={})
- @ignore
- param str type
Order type
- param boolean exchangeSpecificBoolean
exchange specific postOnly
- param dict [params]
exchange specific params
- returns Array
- handle_request_network(params, request, exchangeSpecificKey, currencyCode=None, isRequired=False)
- Parameters
- Returns dict[]
returns [request, params] where request is the modified request object and params is the modified params object
- handle_time_in_force(params={})
@ignore Must add timeInForce to self.options to use self method
- returns str
returns the exchange specific value for timeInForce
- handle_trigger_direction_and_params(params, exchangeSpecificKey=None, allowEmpty=False)
- @ignore
- returns [str, dict]
the trigger-direction value and omited params
- integer_precision_to_amount(precision)
- @ignore
handles positive & negative numbers too. parsePrecision() does not handle negative numbers, but self method handles :param str precision: The number of digits to the right of the decimal :returns str: a string number equal to 1e-precision
- is_post_only(isMarketOrder, exchangeSpecificParam, params={})
- @ignore
- param str type
Order type
- param boolean exchangeSpecificParam
exchange specific postOnly
- param dict [params]
exchange specific params
- returns boolean
True if a post only order, False otherwise
- Parameters
isMarketOrder (bool) –
- load_markets(reload=False, params={})
Loads and prepares the markets for trading.
- Args:
reload (bool): If True, the markets will be reloaded from the exchange. params (dict): Additional exchange-specific parameters for the request.
- Returns:
dict: A dictionary of markets.
- Raises:
Exception: If the markets cannot be loaded or prepared.
- Notes:
It ensures that the markets are only loaded once, even if called multiple times. If the markets are already loaded and reload is False or not provided, it returns the existing markets. If a reload is in progress, it waits for completion before returning. If an error occurs during loading or preparation, an exception is raised.
- network_code_to_id(networkCode, currencyCode=None)
- @ignore
tries to convert the provided networkCode(which is expected to be an unified network code) to a network id. In order to achieve self, derived class needs to have ‘options->networks’ defined. :param str networkCode: unified network code :param str currencyCode: unified currency code, but self argument is not required by default, unless there is an exchange(like huobi) that needs an override of the method to be able to pass currencyCode argument additionally :returns str|None: exchange-specific network id
- network_id_to_code(networkId=None, currencyCode=None)
- @ignore
tries to convert the provided exchange-specific networkId to an unified network Code. In order to achieve self, derived class needs to have “options[‘networksById’]” defined. :param str networkId: exchange specific network id/title, like: TRON, Trc-20, usdt-erc20, etc :param str|None currencyCode: unified currency code, but self argument is not required by default, unless there is an exchange(like huobi) that needs an override of the method to be able to pass currencyCode argument additionally :returns str|None: unified network code
- parse_deposit_withdraw_fees(response, codes=None, currencyIdKey=None)
- @ignore
- param object[]|dict response
unparsed response from the exchange
- param str[]|None codes
the unified currency codes to fetch transactions fees for, returns all currencies when None
- param str currencyIdKey
should only be None when response is a dictionary the object key that corresponds to the currency id
- returns dict
objects with withdraw and deposit fees, indexed by currency codes
- parse_incomes(incomes, market=None, since=None, limit=None)
- @ignore
parses funding fee info from exchange response :param dict[] incomes: each item describes once instance of currency being received or paid :param dict market: ccxt market :param int [since]: when defined, the response items are filtered to only include items after self timestamp :param int [limit]: limits the number of items in the response :returns dict[]: an array of funding history structures <https://docs.ccxt.com/?id=funding-history-structure>
- parse_liquidations(liquidations, market=None, since=None, limit=None)
- @ignore
parses liquidation info from the exchange response :param dict[] liquidations: each item describes an instance of a liquidation event :param dict market: ccxt market :param int [since]: when defined, the response items are filtered to only include items after self timestamp :param int [limit]: limits the number of items in the response :returns dict[]: an array of liquidation structures <https://docs.ccxt.com/?id=liquidation-structure>
- parse_precision(precision)
- @ignore
- param str precision
The number of digits to the right of the decimal
- returns str
a string number equal to 1e-precision
- Parameters
precision (str) –
- safe_bool(dictionary, key, defaultValue=None)
- @ignore
safely extract boolean value from dictionary or list :returns bool | None:
- safe_bool_2(dictionary, key1, key2, defaultValue=None)
- @ignore
safely extract boolean value from dictionary or list :returns bool | None:
- safe_bool_n(dictionaryOrList, keys, defaultValue=None)
- @ignore
safely extract boolean value from dictionary or list :returns bool | None:
- safe_dict(dictionary, key, defaultValue=None)
- @ignore
safely extract a dictionary from dictionary or list :returns dict | None:
- safe_dict_2(dictionary, key1, key2, defaultValue=None)
- @ignore
safely extract a dictionary from dictionary or list :returns dict | None:
- safe_dict_n(dictionaryOrList, keys, defaultValue=None)
- @ignore
safely extract a dictionary from dictionary or list :returns dict | None:
- static safe_either(method, dictionary, key1, key2, default_value=None)
A helper-wrapper for the safe_value_2() family.
- safe_list(dictionaryOrList, key, defaultValue=None)
- @ignore
safely extract an Array from dictionary or list :returns Array | None:
- safe_list_2(dictionaryOrList, key1, key2, defaultValue=None)
- @ignore
safely extract an Array from dictionary or list :returns Array | None:
- safe_list_n(dictionaryOrList, keys, defaultValue=None)
- @ignore
safely extract an Array from dictionary or list :returns Array | None:
- set_sandbox_mode(enabled)
set the sandbox mode for the exchange :param boolean enabled: True to enable sandbox mode, False to disable it
- Parameters
enabled (bool) –
- static truncate(num, precision=0)
Deprecated, use decimal_to_precision instead
- static truncate_to_string(num, precision=0)
Deprecated, todo: remove references from subclasses
- un_watch_bids_asks(symbols=None, params={})
unWatches best bid & ask for symbols :param str[] symbols: unified symbol of the market to fetch the ticker for :param dict [params]: extra parameters specific to the exchange API endpoint :returns dict: a ticker structure <https://docs.ccxt.com/?id=ticker-structure>
- un_watch_my_trades(symbol=None, params={})
unWatches information on multiple trades made by the user :param str symbol: unified market symbol of the market orders were made in :param dict [params]: extra parameters specific to the exchange API endpoint :returns dict[]: a list of order structures <https://docs.ccxt.com/?id=order-structure>
- un_watch_ohlcv(symbol, timeframe='1m', params={})
watches historical candlestick data containing the open, high, low, and close price, and the volume of a market :param str symbol: unified symbol of the market to fetch OHLCV data for :param str timeframe: the length of time each candle represents :param dict [params]: extra parameters specific to the exchange API endpoint :returns int[][]: A list of candles ordered, open, high, low, close, volume
- watch_mark_price(symbol, params={})
watches a mark price for a specific market :param str symbol: unified symbol of the market to fetch the ticker for :param dict [params]: extra parameters specific to the exchange API endpoint :returns dict: a ticker structure <https://docs.ccxt.com/?id=ticker-structure>
- Parameters
symbol (str) –
- watch_mark_prices(symbols=None, params={})
watches the mark price for all markets :param str[] symbols: unified symbol of the market to fetch the ticker for :param dict [params]: extra parameters specific to the exchange API endpoint :returns dict: a ticker structure <https://docs.ccxt.com/?id=ticker-structure>
- withdraw_ws(code, amount, address, tag=None, params={})
make a withdrawal :param str code: unified currency code :param float amount: the amount to withdraw :param str address: the address to withdraw to :param str tag: :param dict [params]: extra parameters specific to the bitvavo api endpoint :returns dict: a transaction structure <https://docs.ccxt.com/?id=transaction-structure>