How to use the technical.exchange._create_exchange function in technical

To help you get started, we’ve selected a few technical examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github freqtrade / technical / technical / history / __init__.py View on Github external
:param ccxt_api: our cxxt object or the name of an exchange
    :param force: should we fetch all data and ignored previous persisted onces
    :param till_date: until when do we want to load data (default is now)
    :param from_date: when do we want to start loading data (default is epoch 0)
    :params days: if specified we will calculates the from data based on days

    :return: a dataframe of all the related data, be aware that this can contain a lot of memory!
    """

    if days:
        print("ignoring from data and fetching {}".format(days))
        from_date = (datetime.datetime.today() - datetime.timedelta(days=days)).timestamp()

    # generate exchange
    from technical.exchange import _create_exchange, historical_data
    ccxt_api = _create_exchange(ccxt_api)

    pair = pair.upper().split("/")
    stake = pair[1]
    asset = pair[0]

    # get newest data from the internal store for this pair

    latest_time = OHLCV.session.query(func.max(OHLCV.timestamp)).filter(
        OHLCV.exchange == ccxt_api.name,
        OHLCV.pair == "{}/{}".format(asset.upper(), stake.upper()),
        OHLCV.interval == interval
    ).one()[0]

    if force:
        print("forcing database refresh and downloading all data!")
        latest_time = None