Add Stocks and FX to a default Freqtrade

This revision is from 2024/12/12 03:26. You can Restore it.

To make a custom exchange.

config.json

{

"max_open_trades": 100,

"stake_currency": "USDT",

"stake_amount": 1000,

"dry_run": true,

"dry_run_wallet": 100000,

"cache": "none", //avoid lookahead bias

"enable_protections": false, //avoid lookahead bias

"exit_pricing":{

"price_side": "other"

},

"entry_pricing": {

"price_side": "other"

},

"exchange": {

"name": "custard_tart",

"key": "",

"secret": "",

"pair_whitelist": ["TSLA/USDT"],

"pair_blacklist": []

},

"pairlists": [

{

"method": "StaticPairList",

"pairs": ["TSLA/USDT"]

}

]

}

Run...

freqtrade backtesting -c user_data/config.json -s SMA --timerange=20240101-20240201

and

freqtrade download-data --exchange custard_tart

and

freqtrade download-data --config user_data/config.json --timeframes 1m --timerange 20240101-

  • freqtrade - ERROR - Exchange "custard_tart" is not known to the ccxt library and therefore not available for the bot.

There are 3 places to edit.

Step 1: Create a Custom Exchange Class

Create a new file custom_exchange.py in the freqtrade/exchange directory. In this file, define a class custardtart.py.

freqtrade/exchange/custardtart.py

from freqtrade.exchange import Exchange

class Custardtart(Exchange):

def __init__(self, config, validate=True, exchange_config=None, load_leverage_tiers=False):

@property

def name(self):

return "custardtart"

Register it with freqtrade/exchange/__init__.py

from freqtrade.exchange.custardtart import Custardtart

Add it to /freqtrade/exchange/common.py

SUPPORTED_EXCHANGES = [

"custardtart",

]

  

📝 📜 ⏱️ ⬆️