コード例 #1
0
def test_from_config(default_conf, mocker, caplog) -> None:
    conf1 = deepcopy(default_conf)
    conf2 = deepcopy(default_conf)
    del conf1['exchange']['key']
    del conf1['exchange']['secret']
    del conf2['exchange']['name']
    conf2['exchange']['pair_whitelist'] += ['NANO/BTC']
    conf2['fiat_display_currency'] = "EUR"
    config_files = [conf1, conf2]
    mocker.patch('freqtrade.configuration.configuration.create_datadir',
                 lambda c, x: x)

    configsmock = MagicMock(side_effect=config_files)
    mocker.patch('freqtrade.configuration.configuration.load_config_file',
                 configsmock)

    validated_conf = Configuration.from_files(
        ['test_conf.json', 'test2_conf.json'])

    exchange_conf = default_conf['exchange']
    assert validated_conf['exchange']['name'] == exchange_conf['name']
    assert validated_conf['exchange']['key'] == exchange_conf['key']
    assert validated_conf['exchange']['secret'] == exchange_conf['secret']
    assert validated_conf['exchange']['pair_whitelist'] != conf1['exchange'][
        'pair_whitelist']
    assert validated_conf['exchange']['pair_whitelist'] == conf2['exchange'][
        'pair_whitelist']
    assert validated_conf['fiat_display_currency'] == "EUR"
    assert 'internals' in validated_conf
    assert log_has('Validating configuration ...', caplog)
    assert isinstance(validated_conf['user_data_dir'], Path)
コード例 #2
0
def test_print_config(default_conf, mocker, caplog) -> None:
    conf1 = deepcopy(default_conf)
    # Delete non-json elements from default_conf
    del conf1['user_data_dir']
    config_files = [conf1]

    configsmock = MagicMock(side_effect=config_files)
    mocker.patch('freqtrade.configuration.configuration.create_datadir', lambda c, x: x)
    mocker.patch('freqtrade.configuration.configuration.load_config_file', configsmock)

    validated_conf = Configuration.from_files(['test_conf.json'])

    assert isinstance(validated_conf['user_data_dir'], Path)
    assert "user_data_dir" in validated_conf
    assert "original_config" in validated_conf
    assert isinstance(json.dumps(validated_conf['original_config']), str)
コード例 #3
0
from pathlib import Path
from freqtrade.configuration import Configuration
from freqtrade.data.history import load_pair_history
from freqtrade.resolvers import ExchangeResolver
from freqtrade.plugins.pairlistmanager import PairListManager
import pandas as pd
from datetime import datetime, timedelta
import argparse
from dateutil.relativedelta import *
import json
import os

STAKE_CURRENCY = 'BUSD'

config = Configuration.from_files([])
config["dataformat_ohlcv"] = "hdf5"
config["timeframe"] = "1d"
config['exchange']['name'] = "binance"
config['stake_currency'] = STAKE_CURRENCY
config['exchange']['pair_whitelist'] = [
    f'.*/{STAKE_CURRENCY}',
]
config['exchange']['pair_blacklist'] = [
    '^(.*USD|USDC|AUD|BRZ|CAD|CHF|EUR|GBP|HKD|SGD|TRY|ZAR|TUSD)/.*', 'PAX/.*',
    'DAI/.*', 'PAXG/.*', ".*UP/USDT", ".*DOWN/USDT", ".*BEAR/USDT",
    ".*BULL/USDT"
]
config['pairlists'] = [
    {
        "method": "StaticPairList",
    },
コード例 #4
0
from pathlib import Path
from freqtrade.configuration import Configuration

import numpy as np
import datetime
import pickle

from functools import partial

import neat
import visualize
from neat.parallel import ParallelEvaluator

# Initialize empty configuration object
fconfig = Configuration.from_files(['config_rl.json'])

# Define some constants
fconfig["ticker_interval"] = "5m"
# Name of the strategy class
fconfig["strategy"] = "IndicatorforRLFull"
# Location of the data
data_location = Path(fconfig['user_data_dir'], 'data', 'binance')
# Pair to analyze - Only use one pair here

from gym_env.trading_env import TradingEnv
# from stable_baselines.deepq.policies import MlpPolicy, LnMlpPolicy

fconfig['fee'] = 0.0015
fconfig['timerange'] = '20170101-20200401'
# fconfig['pair_whitelist'] = ["BTC/USDT"]
fconfig['simulate_length'] = 60 * 24 * 30 // 5