Пример #1
0
# -*- coding: utf-8 -*-

from hummingbot.client.config.config_var import ConfigVar
from hummingbot.client.config.config_methods import using_exchange

CENTRALIZED = True

EXAMPLE_PAIR = 'BTC-USDC'

DEFAULT_FEES = [0.15, 0.25]

KEYS = {
    'beaxy_api_key':
    ConfigVar(key='beaxy_api_key',
              prompt='Enter your Beaxy API key >>> ',
              required_if=using_exchange('beaxy'),
              is_secure=True,
              is_connect_key=True),
    'beaxy_secret_key':
    ConfigVar(key='beaxy_secret_key',
              prompt='Enter your Beaxy secret key >>> ',
              required_if=using_exchange('beaxy'),
              is_secure=True,
              is_connect_key=True),
}
Пример #2
0

def get_next_funding_timestamp(current_timestamp: float) -> float:
    # On ByBit Perpetuals, funding occurs every 8 hours at 00:00UTC, 08:00UTC and 16:00UTC.
    # Reference: https://help.bybit.com/hc/en-us/articles/360039261134-Funding-fee-calculation
    int_ts = int(current_timestamp)
    eight_hours = 8 * 60 * 60
    mod = int_ts % eight_hours
    return float(int_ts - mod + eight_hours)


KEYS = {
    "bybit_perpetual_api_key":
    ConfigVar(key="bybit_perpetual_api_key",
              prompt="Enter your Bybit Perpetual API key >>> ",
              required_if=using_exchange("bybit_perpetual"),
              is_secure=True,
              is_connect_key=True),
    "bybit_perpetual_secret_key":
    ConfigVar(key="bybit_perpetual_secret_key",
              prompt="Enter your Bybit Perpetual secret key >>> ",
              required_if=using_exchange("bybit_perpetual"),
              is_secure=True,
              is_connect_key=True),
}

OTHER_DOMAINS = ["bybit_perpetual_testnet"]
OTHER_DOMAINS_PARAMETER = {
    "bybit_perpetual_testnet": "bybit_perpetual_testnet"
}
OTHER_DOMAINS_EXAMPLE_PAIR = {"bybit_perpetual_testnet": "BTC-USDT"}
Пример #3
0

def convert_to_exchange_trading_pair(hb_trading_pair: str) -> str:
    return hb_trading_pair.replace("-", "")


def convert_from_exchange_trading_pair(trading_pair: str) -> str:
    base, quote = split_trading_pair(trading_pair)
    return f"{base}-{quote}"


KEYS = {
    "eterbase_api_key":
    ConfigVar(key="eterbase_api_key",
              prompt="Enter your Eterbase API key >>> ",
              required_if=using_exchange("eterbase"),
              is_secure=True,
              is_connect_key=True),
    "eterbase_secret_key":
    ConfigVar(key="eterbase_secret_key",
              prompt="Enter your Eterbase secret key >>> ",
              required_if=using_exchange("eterbase"),
              is_secure=True,
              is_connect_key=True),
    "eterbase_account":
    ConfigVar(key="eterbase_account",
              prompt="Enter your Eterbase account >>> ",
              required_if=using_exchange("eterbase"),
              is_secure=True,
              is_connect_key=True),
}
Пример #4
0

def convert_from_exchange_trading_pair(
        exchange_trading_pair: str) -> Optional[str]:
    if split_trading_pair(exchange_trading_pair) is None:
        return None
    # Altmarkets uses lowercase (btcusdt)
    base_asset, quote_asset = split_trading_pair(exchange_trading_pair)
    return f"{base_asset.upper()}-{quote_asset.upper()}"


def convert_to_exchange_trading_pair(am_trading_pair: str) -> str:
    # Altmarkets uses lowercase (btcusdt)
    return am_trading_pair.replace("-", "").lower()


KEYS = {
    "altmarkets_api_key":
    ConfigVar(key="altmarkets_api_key",
              prompt="Enter your Altmarkets API key >>> ",
              required_if=using_exchange("altmarkets"),
              is_secure=True,
              is_connect_key=True),
    "altmarkets_secret_key":
    ConfigVar(key="altmarkets_secret_key",
              prompt="Enter your Altmarkets secret key >>> ",
              required_if=using_exchange("altmarkets"),
              is_secure=True,
              is_connect_key=True),
}
Пример #5
0
def is_exchange_information_valid(exchange_info: Dict[str, Any]) -> bool:
    """
    Verifies if a trading pair is enabled to operate with based on its exchange information
    :param exchange_info: the exchange information for a trading pair
    :return: True if the trading pair is enabled, False otherwise
    """
    return exchange_info.get(
        "status", None) == "TRADING" and "SPOT" in exchange_info.get(
            "permissions", list())


KEYS = {
    "binance_api_key":
    ConfigVar(key="binance_api_key",
              prompt="Enter your Binance API key >>> ",
              required_if=using_exchange("binance"),
              is_secure=True,
              is_connect_key=True),
    "binance_api_secret":
    ConfigVar(key="binance_api_secret",
              prompt="Enter your Binance API secret >>> ",
              required_if=using_exchange("binance"),
              is_secure=True,
              is_connect_key=True),
}

OTHER_DOMAINS = ["binance_us"]
OTHER_DOMAINS_PARAMETER = {"binance_us": "us"}
OTHER_DOMAINS_EXAMPLE_PAIR = {"binance_us": "BTC-USDT"}
OTHER_DOMAINS_DEFAULT_FEES = {"binance_us": [0.1, 0.1]}
OTHER_DOMAINS_KEYS = {
Пример #6
0
    exchange_trading_pair = f"{base}{delimiter}{quote}"
    return exchange_trading_pair


def is_dark_pool(trading_pair_details: Dict[str, Any]):
    '''
    Want to filter out dark pool trading pairs from the list of trading pairs
    For more info, please check
    https://support.kraken.com/hc/en-us/articles/360001391906-Introducing-the-Kraken-Dark-Pool
    '''
    if trading_pair_details.get('altname'):
        return trading_pair_details.get('altname').endswith('.d')
    return False


KEYS = {
    "kraken_api_key":
    ConfigVar(key="kraken_api_key",
              prompt="Enter your Kraken API key >>> ",
              required_if=using_exchange("kraken"),
              is_secure=True,
              is_connect_key=True),
    "kraken_secret_key":
    ConfigVar(key="kraken_secret_key",
              prompt="Enter your Kraken secret key >>> ",
              required_if=using_exchange("kraken"),
              is_secure=True,
              is_connect_key=True),
}
Пример #7
0
                f"Error fetching data from {url}. HTTP status is {http_status}. "
                f"Retrying in {time_sleep:.0f}s.")
            await asyncio.sleep(time_sleep)
            return await api_call_with_retries(method=method,
                                               endpoint=endpoint,
                                               params=params,
                                               shared_client=shared_client,
                                               try_count=try_count)
        else:
            raise HitbtcAPIError({
                "error": parsed_response,
                "status": http_status
            })
    return parsed_response


KEYS = {
    "hitbtc_api_key":
    ConfigVar(key="hitbtc_api_key",
              prompt=f"Enter your {Constants.EXCHANGE_NAME} API key >>> ",
              required_if=using_exchange("hitbtc"),
              is_secure=True,
              is_connect_key=True),
    "hitbtc_secret_key":
    ConfigVar(key="hitbtc_secret_key",
              prompt=f"Enter your {Constants.EXCHANGE_NAME} secret key >>> ",
              required_if=using_exchange("hitbtc"),
              is_secure=True,
              is_connect_key=True),
}
Пример #8
0
CENTRALIZED = True

EXAMPLE_PAIR = "TWINS-BTC"

DEFAULT_FEES = [0.1, 0.1]


def convert_from_exchange_trading_pair(
        exchange_trading_pair: str) -> Optional[str]:
    return exchange_trading_pair.replace("_", "-")


def convert_to_exchange_trading_pair(hb_trading_pair: str) -> str:
    return hb_trading_pair.replace("-", "_")


KEYS = {
    "newcapital_api_key":
    ConfigVar(key="newcapital_api_key",
              prompt="Enter your New Capital API key >>> ",
              required_if=using_exchange("newcapital"),
              is_secure=True,
              is_connect_key=True),
    "newcapital_api_secret":
    ConfigVar(key="newcapital_api_secret",
              prompt="Enter your New Capital API secret >>> ",
              required_if=using_exchange("newcapital"),
              is_secure=True,
              is_connect_key=True),
}
Пример #9
0
        elif key == "remove":
            for price in orders:
                order_row = OrderBookRow(price, float(0), update_id)
                asks.append(order_row)
        else:  # key == "update" or key == "add":
            for order in orders:
                order_row = OrderBookRow(order["p"], order["q"], update_id)
                asks.append(order_row)

    return bids, asks


def convert_to_epoch_timestamp(timestamp: str) -> int:
    return int(dateutil.parser.parse(timestamp).timestamp() * 1e3)


KEYS = {
    "k2_api_key":
    ConfigVar(key="k2_api_key",
              prompt="Enter your K2 API key >>> ",
              required_if=using_exchange("k2"),
              is_secure=True,
              is_connect_key=True),
    "k2_secret_key":
    ConfigVar(key="k2_secret_key",
              prompt="Enter your K2 secret key >>> ",
              required_if=using_exchange("k2"),
              is_secure=True,
              is_connect_key=True),
}
Пример #10
0
def num_to_increment(num):
    return Decimal(10) ** -num


CENTRALIZED = True

EXAMPLE_PAIR = 'BTC-USDT'

DEFAULT_FEES = [0.2, 0.2]

KEYS = {
    "mexc_api_key":
        ConfigVar(key="mexc_api_key",
                  prompt="Enter your MEXC API key >>> ",
                  required_if=using_exchange("mexc"),
                  is_secure=True,
                  is_connect_key=True),
    "mexc_secret_key":
        ConfigVar(key="mexc_secret_key",
                  prompt="Enter your MEXC secret key >>> ",
                  required_if=using_exchange("mexc"),
                  is_secure=True,
                  is_connect_key=True),
}

ws_status = {
    1: 'NEW',
    2: 'FILLED',
    3: 'PARTIALLY_FILLED',
    4: 'CANCELED',
Пример #11
0
EXAMPLE_PAIR = "ETH-USD"

# BitFinex list Tether(USDT) as 'UST'
EXCHANGE_TO_HB_CONVERSION = {"UST": "USDT"}
HB_TO_EXCHANGE_CONVERSION = {
    v: k
    for k, v in EXCHANGE_TO_HB_CONVERSION.items()
}

DEFAULT_FEES = [0.1, 0.2]

KEYS = {
    "bitfinex_api_key":
    ConfigVar(key="bitfinex_api_key",
              prompt="Enter your Bitfinex API key >>> ",
              required_if=using_exchange("bitfinex"),
              is_secure=True,
              is_connect_key=True),
    "bitfinex_secret_key":
    ConfigVar(key="bitfinex_secret_key",
              prompt="Enter your Bitfinex secret key >>> ",
              required_if=using_exchange("bitfinex"),
              is_secure=True,
              is_connect_key=True),
}


# deeply merge two dictionaries
def merge_dicts(source: Dict, destination: Dict) -> Dict:
    for key, value in source.items():
        if isinstance(value, dict):
Пример #12
0
    if asset in ASSET_TO_NAME_MAPPING:
        asset = ASSET_TO_NAME_MAPPING[asset]
    return asset


def convert_asset_to_exchange(asset: str) -> str:
    if asset in NAME_TO_ASSET_MAPPING:
        asset = NAME_TO_ASSET_MAPPING[asset]
    return asset


KEYS = {
    "kucoin_api_key":
    ConfigVar(key="kucoin_api_key",
              prompt="Enter your KuCoin API key >>> ",
              required_if=using_exchange("kucoin"),
              is_secure=True,
              is_connect_key=True),
    "kucoin_secret_key":
    ConfigVar(key="kucoin_secret_key",
              prompt="Enter your KuCoin secret key >>> ",
              required_if=using_exchange("kucoin"),
              is_secure=True,
              is_connect_key=True),
    "kucoin_passphrase":
    ConfigVar(key="kucoin_passphrase",
              prompt="Enter your KuCoin passphrase >>> ",
              required_if=using_exchange("kucoin"),
              is_secure=True,
              is_connect_key=True),
}
Пример #13
0
from hummingbot.client.config.config_var import ConfigVar
from hummingbot.client.config.config_methods import using_exchange

CENTRALIZED = True

EXAMPLE_PAIR = "ETH-USDC"

DEFAULT_FEES = [0.5, 0.5]

KEYS = {
    "coinbase_pro_api_key":
    ConfigVar(key="coinbase_pro_api_key",
              prompt="Enter your Coinbase API key >>> ",
              required_if=using_exchange("coinbase_pro"),
              is_secure=True,
              is_connect_key=True),
    "coinbase_pro_secret_key":
    ConfigVar(key="coinbase_pro_secret_key",
              prompt="Enter your Coinbase secret key >>> ",
              required_if=using_exchange("coinbase_pro"),
              is_secure=True,
              is_connect_key=True),
    "coinbase_pro_passphrase":
    ConfigVar(key="coinbase_pro_passphrase",
              prompt="Enter your Coinbase passphrase >>> ",
              required_if=using_exchange("coinbase_pro"),
              is_secure=True,
              is_connect_key=True),
}
Пример #14
0
from hummingbot.client.config.config_var import ConfigVar
from hummingbot.client.config.config_methods import using_exchange

CENTRALIZED = True

EXAMPLE_PAIR = "VITE-BTC.000"

DEFAULT_FEES = [0.25, 0.25]

KEYS = {
    "vitex_vite_address":
    ConfigVar(key="vitex_vite_address",
              prompt="Enter your Vite address >>> ",
              type_str="str",
              required_if=using_exchange("vitex"),
              is_secure=True,
              is_connect_key=True),
    "vitex_api_key":
    ConfigVar(key="vitex_api_key",
              prompt="Enter your ViteX API key >>> ",
              required_if=using_exchange("vitex"),
              is_secure=True,
              is_connect_key=True),
    "vitex_secret_key":
    ConfigVar(key="vitex_secret_key",
              prompt="Enter your ViteX API secret >>> ",
              required_if=using_exchange("vitex"),
              is_secure=True,
              is_connect_key=True)
}
Пример #15
0
                                               params=params,
                                               shared_client=shared_client,
                                               try_count=try_count)
        else:
            raise CoinzoomAPIError({
                "error": parsed_response,
                "status": http_status
            })
    return parsed_response


KEYS = {
    "coinzoom_api_key":
    ConfigVar(key="coinzoom_api_key",
              prompt=f"Enter your {Constants.EXCHANGE_NAME} API key >>> ",
              required_if=using_exchange("coinzoom"),
              is_secure=True,
              is_connect_key=True),
    "coinzoom_secret_key":
    ConfigVar(key="coinzoom_secret_key",
              prompt=f"Enter your {Constants.EXCHANGE_NAME} secret key >>> ",
              required_if=using_exchange("coinzoom"),
              is_secure=True,
              is_connect_key=True),
    "coinzoom_username":
    ConfigVar(
        key="coinzoom_username",
        prompt=f"Enter your {Constants.EXCHANGE_NAME} ZoomMe username >>> ",
        required_if=using_exchange("coinzoom"),
        is_secure=True,
        is_connect_key=True),
Пример #16
0
    if shared_client is None:
        await http_client.close()
    if request_errors or parsed_response is None:
        if try_count < CONSTANTS.API_MAX_RETRIES:
            try_count += 1
            time_sleep = retry_sleep_time(try_count)
            print(f"Error fetching data from {url}. HTTP status is {http_status}. "
                  f"Retrying in {time_sleep:.0f}s.")
            await asyncio.sleep(time_sleep)
            return await api_call_with_retries(method=method, endpoint=endpoint, params=params,
                                               shared_client=shared_client, try_count=try_count)
        else:
            raise GateIoAPIError({"label": "HTTP_ERROR", "message": parsed_response, "status": http_status})
    return parsed_response


KEYS = {
    "gate_io_api_key":
        ConfigVar(key="gate_io_api_key",
                  prompt=f"Enter your {CONSTANTS.EXCHANGE_NAME} API key >>> ",
                  required_if=using_exchange("gate_io"),
                  is_secure=True,
                  is_connect_key=True),
    "gate_io_secret_key":
        ConfigVar(key="gate_io_secret_key",
                  prompt=f"Enter your {CONSTANTS.EXCHANGE_NAME} secret key >>> ",
                  required_if=using_exchange("gate_io"),
                  is_secure=True,
                  is_connect_key=True),
}
Пример #17
0
def convert_from_exchange_trading_pair(exchange_trading_pair: str) -> Optional[str]:
    if split_trading_pair(exchange_trading_pair) is None:
        return None
    # Dexfin does not split BASEQUOTE (BTCUSDT)
    base_asset, quote_asset = split_trading_pair(exchange_trading_pair)
    return f"{base_asset}-{quote_asset}".upper()


def convert_to_exchange_trading_pair(hb_trading_pair: str) -> str:
    # Dexfin does not split BASEQUOTE (BTCUSDT)
    if isinstance(hb_trading_pair, list):
        return hb_trading_pair[0].replace("-", "").lower()
    return hb_trading_pair.replace("-", "").lower()


KEYS = {
    "dexfin_api_key":
        ConfigVar(key="dexfin_api_key",
                  prompt="Enter your Dexfin API key >>> ",
                  required_if=using_exchange("dexfin"),
                  is_secure=True,
                  is_connect_key=True),
    "dexfin_secret_key":
        ConfigVar(key="dexfin_secret_key",
                  prompt="Enter your Dexfin secret key >>> ",
                  required_if=using_exchange("dexfin"),
                  is_secure=True,
                  is_connect_key=True),
}
Пример #18
0

def get_new_client_order_id(is_buy: bool, trading_pair: str) -> str:
    side = "B" if is_buy else "S"
    return f"{HBOT_BROKER_ID}{side}-{trading_pair}-{get_tracking_nonce()}"


def get_api_reason(code: str) -> str:
    return CONSTANTS.API_REASONS.get(int(code), code)


def get_rest_url(path_url: str,
                 api_version: str = CONSTANTS.API_VERSION) -> str:
    return f"{CONSTANTS.REST_URL}{api_version}{path_url}"


KEYS = {
    "crypto_com_api_key":
    ConfigVar(key="crypto_com_api_key",
              prompt="Enter your Crypto.com API key >>> ",
              required_if=using_exchange("crypto_com"),
              is_secure=True,
              is_connect_key=True),
    "crypto_com_secret_key":
    ConfigVar(key="crypto_com_secret_key",
              prompt="Enter your Crypto.com secret key >>> ",
              required_if=using_exchange("crypto_com"),
              is_secure=True,
              is_connect_key=True),
}
Пример #19
0
from hummingbot.core.data_type.trade_fee import TradeFeeSchema

DEFAULT_FEES = TradeFeeSchema(
    maker_percent_fee_decimal=Decimal("0.0008"),
    taker_percent_fee_decimal=Decimal("0.0001"),
)

CENTRALIZED = True

EXAMPLE_PAIR = "BTC-USDT"

KEYS = {
    "okex_api_key":
        ConfigVar(key="okex_api_key",
                  prompt="Enter your OKEx API key >>> ",
                  required_if=using_exchange("okex"),
                  is_secure=True,
                  is_connect_key=True),
    "okex_secret_key":
        ConfigVar(key="okex_secret_key",
                  prompt="Enter your OKEx secret key >>> ",
                  required_if=using_exchange("okex"),
                  is_secure=True,
                  is_connect_key=True),
    "okex_passphrase":
        ConfigVar(key="okex_passphrase",
                  prompt="Enter your OKEx passphrase key >>> ",
                  required_if=using_exchange("okex"),
                  is_secure=True,
                  is_connect_key=True),
}
Пример #20
0
from hummingbot.client.config.config_var import ConfigVar
from hummingbot.client.config.config_methods import using_exchange

CENTRALIZED = True

EXAMPLE_PAIR = "ETH-USD"

DEFAULT_FEES = [0.1, 0.1]


KEYS = {
    "liquid_api_key":
        ConfigVar(key="liquid_api_key",
                  prompt="Enter your Liquid API key >>> ",
                  required_if=using_exchange("liquid"),
                  is_secure=True,
                  is_connect_key=True),
    "liquid_secret_key":
        ConfigVar(key="liquid_secret_key",
                  prompt="Enter your Liquid secret key >>> ",
                  required_if=using_exchange("liquid"),
                  is_secure=True,
                  is_connect_key=True),
}
Пример #21
0
from hummingbot.client.config.config_methods import using_exchange

CENTRALIZED = True

EXAMPLE_PAIR = "LRC-ETH"

DEFAULT_FEES = [0.0, 0.2]

LOOPRING_ROOT_API = "https://api.loopring.io"
LOOPRING_WS_KEY_PATH = "/v2/ws/key"

KEYS = {
    "loopring_accountid":
    ConfigVar(key="loopring_accountid",
              prompt="Enter your Loopring account id >>> ",
              required_if=using_exchange("loopring"),
              is_secure=True,
              is_connect_key=True),
    "loopring_exchangeid":
    ConfigVar(key="loopring_exchangeid",
              prompt="Enter the Loopring exchange id >>> ",
              required_if=using_exchange("loopring"),
              is_secure=True,
              is_connect_key=True),
    "loopring_private_key":
    ConfigVar(key="loopring_private_key",
              prompt="Enter your Loopring private key >>> ",
              required_if=using_exchange("loopring"),
              is_secure=True,
              is_connect_key=True),
    "loopring_api_key":
Пример #22
0
    return hb_trading_pair.replace("-", "_").lower()


def convert_to_ws_trading_pair(hb_trading_pair: str) -> str:
    return hb_trading_pair.replace("-", "_")


def get_new_client_order_id(is_buy: bool, trading_pair: str) -> str:
    side = "B" if is_buy else "S"
    return f"{HBOT_BROKER_ID}{side}-{trading_pair}-{get_tracking_nonce()}"


def get_api_reason(code: str) -> str:
    return Constants.API_REASONS.get(int(code), code)


KEYS = {
    "digifinex_api_key":
    ConfigVar(key="digifinex_api_key",
              prompt="Enter your Digifinex API key >>> ",
              required_if=using_exchange("digifinex"),
              is_secure=True,
              is_connect_key=True),
    "digifinex_secret_key":
    ConfigVar(key="digifinex_secret_key",
              prompt="Enter your Digifinex secret key >>> ",
              required_if=using_exchange("digifinex"),
              is_secure=True,
              is_connect_key=True),
}
Пример #23
0
    for entry in data:
        order_row = OrderBookRow(float(entry["price"]),
                                 float(entry["quantity"]), update_id)
        if entry["side"] == "buy":
            bids.append(order_row)
        elif entry["side"] == "sell":
            asks.append(order_row)

    return bids, asks


KEYS = {
    "probit_api_key":
    ConfigVar(key="probit_api_key",
              prompt="Enter your ProBit Client ID >>> ",
              required_if=using_exchange("probit"),
              is_secure=True,
              is_connect_key=True),
    "probit_secret_key":
    ConfigVar(key="probit_secret_key",
              prompt="Enter your ProBit secret key >>> ",
              required_if=using_exchange("probit"),
              is_secure=True,
              is_connect_key=True),
}

OTHER_DOMAINS = ["probit_kr"]
OTHER_DOMAINS_PARAMETER = {"probit_kr": "kr"}
OTHER_DOMAINS_EXAMPLE_PAIR = {"probit_kr": "BTC-USDT"}
OTHER_DOMAINS_DEFAULT_FEES = {"probit_kr": [0.2, 0.2]}
OTHER_DOMAINS_KEYS = {
Пример #24
0
        return None


def convert_from_exchange_trading_pair(exchange_trading_pair: str) -> Optional[str]:
    if split_trading_pair(exchange_trading_pair) is None:
        return None
    base_asset, quote_asset = split_trading_pair(exchange_trading_pair)
    return f"{base_asset}-{quote_asset}"


def convert_to_exchange_trading_pair(hb_trading_pair: str) -> str:
    # Binance does not split BASEQUOTE (BTCUSDT)
    return hb_trading_pair.replace("-", "_")


KEYS = {
    "btcturk_api_key":
        ConfigVar(key="btcturk_api_key",
                  prompt="Enter your BTCTurk API key >>> ",
                  required_if=using_exchange("btcturk"),
                  is_secure=True,
                  is_connect_key=True),
    "btcturk_api_secret":
        ConfigVar(key="btcturk_api_secret",
                  prompt="Enter your BTCTurk API secret >>> ",
                  required_if=using_exchange("btcturk"),
                  is_secure=True,
                  is_connect_key=True),
}

Пример #25
0
        exchange_trading_pair: str) -> Optional[str]:
    if split_trading_pair(exchange_trading_pair) is None:
        return None
    base_asset, quote_asset = split_trading_pair(exchange_trading_pair)
    return f"{base_asset}-{quote_asset}"


def convert_to_exchange_trading_pair(hb_trading_pair: str) -> str:
    return hb_trading_pair.replace("-", "")


KEYS = {
    "binance_perpetual_api_key":
    ConfigVar(key="binance_perpetual_api_key",
              prompt="Enter your Binance Perpetual API key >>> ",
              required_if=using_exchange("binance_perpetual"),
              is_secure=True,
              is_connect_key=True),
    "binance_perpetual_api_secret":
    ConfigVar(key="binance_perpetual_api_secret",
              prompt="Enter your Binance Perpetual API secret >>> ",
              required_if=using_exchange("binance_perpetual"),
              is_secure=True,
              is_connect_key=True),
}

OTHER_DOMAINS = ["binance_perpetual_testnet"]
OTHER_DOMAINS_PARAMETER = {
    "binance_perpetual_testnet": "binance_perpetual_testnet"
}
OTHER_DOMAINS_EXAMPLE_PAIR = {"binance_perpetual_testnet": "BTC-USDT"}
Пример #26
0
from decimal import Decimal

from hummingbot.client.config.config_var import ConfigVar
from hummingbot.client.config.config_methods import using_exchange
from hummingbot.core.data_type.trade_fee import TradeFeeSchema

CENTRALIZED = True

EXAMPLE_PAIR = "ZRX-ETH"

DEFAULT_FEES = TradeFeeSchema(
    maker_percent_fee_decimal=Decimal("0.0035"),
    taker_percent_fee_decimal=Decimal("0.0035"),
)

KEYS = {
    "bittrex_api_key":
    ConfigVar(key="bittrex_api_key",
              prompt="Enter your Bittrex API key >>> ",
              required_if=using_exchange("bittrex"),
              is_secure=True,
              is_connect_key=True),
    "bittrex_secret_key":
    ConfigVar(key="bittrex_secret_key",
              prompt="Enter your Bittrex secret key >>> ",
              required_if=using_exchange("bittrex"),
              is_secure=True,
              is_connect_key=True),
}
Пример #27
0
    """
    Generates the exchange order id based on user uid and client order id.
    :param user_uid: user uid,
    :param client_order_id: client order id used for local order tracking
    :return: order id of length 32
    """
    time = get_ms_timestamp()
    return [derive_order_id(userUid, client_order_id, time), time]


def gen_client_order_id(is_buy: bool, trading_pair: str) -> str:
    side = "B" if is_buy else "S"
    base, quote = trading_pair.split("-")
    return f"{HBOT_BROKER_ID}-{side}{base[:3]}{quote[:3]}{get_tracking_nonce()}"


KEYS = {
    "ascend_ex_api_key":
    ConfigVar(key="ascend_ex_api_key",
              prompt="Enter your AscendEx API key >>> ",
              required_if=using_exchange("ascend_ex"),
              is_secure=True,
              is_connect_key=True),
    "ascend_ex_secret_key":
    ConfigVar(key="ascend_ex_secret_key",
              prompt="Enter your AscendEx secret key >>> ",
              required_if=using_exchange("ascend_ex"),
              is_secure=True,
              is_connect_key=True),
}
Пример #28
0
def gen_exchange_order_id(userUid: str) -> Tuple[str, int]:
    """
    Generate an order id
    :param user_uid: user uid
    :return: order id of length 32
    """
    time = get_ms_timestamp()
    return [derive_order_id(userUid, uuid32(), time), time]


def gen_client_order_id(is_buy: bool, trading_pair: str) -> str:
    side = "B" if is_buy else "S"
    return f"{HBOT_BROKER_ID}{side}-{trading_pair}-{get_tracking_nonce()}"


KEYS = {
    "bitmax_api_key":
    ConfigVar(key="bitmax_api_key",
              prompt="Enter your Bitmax API key >>> ",
              required_if=using_exchange("bitmax"),
              is_secure=True,
              is_connect_key=True),
    "bitmax_secret_key":
    ConfigVar(key="bitmax_secret_key",
              prompt="Enter your Bitmax secret key >>> ",
              required_if=using_exchange("bitmax"),
              is_secure=True,
              is_connect_key=True),
}
Пример #29
0
def get_new_client_order_id(trade_type: TradeType, trading_pair: str) -> str:
    side = ""
    if trade_type is TradeType.BUY:
        side = "buy"
    if trade_type is TradeType.SELL:
        side = "sell"
    tracking_nonce = get_tracking_nonce()
    return f"{BROKER_ID}-{side}-{trading_pair}-{tracking_nonce}"


def build_api_factory() -> WebAssistantsFactory:
    api_factory = WebAssistantsFactory(
        ws_post_processors=[HuobiWSPostProcessor()])
    return api_factory


KEYS = {
    "huobi_api_key":
    ConfigVar(key="huobi_api_key",
              prompt="Enter your Huobi API key >>> ",
              required_if=using_exchange("huobi"),
              is_secure=True,
              is_connect_key=True),
    "huobi_secret_key":
    ConfigVar(key="huobi_secret_key",
              prompt="Enter your Huobi secret key >>> ",
              required_if=using_exchange("huobi"),
              is_secure=True,
              is_connect_key=True),
}
Пример #30
0
from hummingbot.client.config.config_var import ConfigVar
from hummingbot.client.config.config_methods import using_exchange

CENTRALIZED = True

EXAMPLE_PAIR = "ETH-USD"

DEFAULT_FEES = [0.1, 0.1]

KEYS = {
    "litebit_pro_api_key":
    ConfigVar(key="litebit_pro_api_key",
              prompt="Enter your LitebitPro API key >>> ",
              required_if=using_exchange("litebit_pro"),
              is_secure=True,
              is_connect_key=True),
    "litebit_pro_secret_key":
    ConfigVar(key="litebit_pro_secret_key",
              prompt="Enter your LitebitPro secret key >>> ",
              required_if=using_exchange("litebit_pro"),
              is_secure=True,
              is_connect_key=True),
}