βš™οΈ Config#

Dynaconf#

https://img.shields.io/badge/βš™οΈdynaconf-005571?style=for-the-badge&logo=settings&logoColor=ffdd54

Dynaconf is a powerful and easy-to-use configuration management library for Python. Talky settings are based on Dynaconf. It supports TOML settings file, .env file or environment variable , and other types. Refer to dynaconf/dynaconf for more information.

Settings Structure#

Config will load:
  • talky default: talky_settings.toml

  • default from library if the library support it: default_settings.toml

  • user settings: settings.toml

  • user secrets: .secrets.toml

Your settings should be setup in settings.toml, .secrets.toml, .env or environment variable.

Settings.toml or .env can be located in /app/settings.toml or /app/.env for docker. If deployed locally, place your file in /tt/ folder.

1Password#

In case, you use 1Password to store your settings, you can use .secrets.toml to retrieve and store your settings from a notesPlain item. in order to use 1Password, you need to add the following to your .env file:

  • OP_SERVICE_ACCOUNT_TOKEN: your 1Password service account token

  • OP_VAULT: your 1Password vault

  • OP_ITEM: your 1Password item

  • OP_PATH: your one 1Password path (optional and default value /usr/bin/op)

The .secrets.toml will be located in /tt/.secrets.toml and be created by the OP client via op read op://vault/item/notesPlain > .secrets.toml

Talky Settings#

More than 100 settings customizable via settings.toml or .env. Most of them are predefined and you only need to update the credentials realted to your exchange and chat platform

  1########################################
  2###          DEFAULT SETTINGS        ###
  3########################################
  4
  5# Any of those settings can be changed.
  6# To overwrite a setting, create a 
  7# a file named settings.toml or load from 
  8# .env file or env vars.
  9# As an example, to change the port:
 10#
 11#   settings.toml
 12#   [default]
 13#    port = 8081
 14#
 15# or via .env 
 16# export TT_PORT=8081
 17# You can refer to 
 18# https://github.com/mraniki/tt/blob/main/examples/example_settings.toml
 19# for a settings.toml example
 20
 21########################################
 22###        DYNACONF SETTINGS         ###
 23########################################
 24
 25[default]
 26# Dynaconf settings verification
 27VALUE = "Production"
 28
 29########################################
 30###         PYTHON SETTINGS          ###
 31########################################
 32
 33# Log level to troubleshoot
 34# loglevel = "DEBUG"
 35loglevel = "DEBUG"
 36# Log level for third party libraries
 37thirdparty_lib_loglevel = "ERROR"
 38
 39# URL to verify the latest version
 40repo = "https://api.github.com/repos/mraniki/tt/releases/latest"
 41
 42# Enable/Disable Version Check
 43# at the start of the bot
 44version_check = true
 45
 46########################################
 47###         FASTAPI SETTINGS         ###
 48########################################
 49
 50# Uvicorn Server settings
 51
 52host = "0.0.0.0"
 53port = 8080
 54
 55# Experiemental, If set to true,
 56# provide a ui at http://host:port/
 57# refer to frontend documentation 
 58# for more details
 59
 60ui_enabled = false
 61
 62# url to a live tv stream
 63# displayed in the ui
 64live_tv_url = ""
 65
 66# Your webhook secret to send
 67# trade alert directly to your chat.
 68# If you use Trading view, the webhook
 69# to be set in the trading view notification
 70# will be https://0.0.0.0/webhook/123abc
 71# as per the above and below data
 72
 73webhook_secret = "123abc"
 74
 75# Forward the webhook data 
 76# to another endpoint like another bot
 77# or webhook service.
 78
 79# Forwarded  Enable/Disable
 80forwarder = false
 81# Forwarder URL
 82forwarder_url = ""
 83
 84########################################
 85###        APPRISE SETTINGS          ###
 86########################################
 87
 88# Refer to 
 89# https://github.com/caronc/apprise/wiki
 90# Apprise endpoint URL can be a URL 
 91# for the chat, a URL to an Apprise config
 92# or a URL to the Apprise API endpoint
 93# apprise_url = "tgram://BOTTOKEN/CHANNEL"
 94# apprise_url = "discord://token1/channel"
 95apprise_url = ""
 96
 97#Format of the apprise notification.
 98# apprise_format = "NotifyFormat.MARKDOWN"
 99apprise_format = "NotifyFormat.HTML"
100
101
102########################################
103###   COMMON BOT COMMAND SETTINGS    ###
104########################################
105
106bot_name = "Talky"
107# Bot Prefix 
108bot_prefix = "/"
109# Character to ignore
110bot_ignore = "ℹ️ ⚠️ πŸ“Š 🏦 πŸ“Ί ⬆️ πŸ’¬ βš–οΈ 🧠 πŸ¦„"
111# Words to identify
112bot_filter_in = ""
113# Command for help
114bot_command_help = "help"
115# Command for info
116bot_command_info = "info"
117# Command for user balance
118bot_command_bal = "bal"
119# Command for user position
120bot_command_pos = "pos"
121# Command for daily pnl
122bot_command_pnl = "pnl"
123# Command for instrument quote
124bot_command_quote = "q"
125# Command for switch trading on or off
126bot_command_trading = "trading"
127# Command to retrieve network info
128bot_command_network = "network"
129# Command to restart the bot
130bot_command_restart = "restart"
131# Command to get live tv link
132bot_command_tv = "live"
133# Command to get trading view trend
134bot_command_trend = "trend"
135# Command to get latest news
136bot_command_news = "news"
137# Command to scrape data
138bot_command_scraper = "scraper"
139# command for conversation
140bot_command_aichat = "ai"
141# command to toggle aimode
142bot_command_aimode = "aimode"
143# command to export conversation
144bot_command_aiexport = "export"
145# command for reset conversation
146bot_command_aiclear = "clear"
147# command for browse
148bot_command_browse_url = "browse"
149
150# Help Message
151helper_commands = """
152πŸ†˜ /help
153ℹ️ /info
154πŸ”€ /trading
155πŸ” /restart
156πŸ•ΈοΈ /network
157πŸ“Ί /live
158πŸ“° /news
159πŸ“Š /trend
160πŸ’¬ /ai
161➰ /aimode
162🧽 /clear
163β€πŸ’¨ /export
164βš–οΈ /q WBTC
165🏦 /bal
166🏦 /pos
167🎯 BUY WBTC
168🎯 buy BTCUSDT sl=200 tp=400 q=2%
169"""
170
171########################################
172###         TRADING SETTINGS         ###
173########################################
174
175# Enable/Disable Trading 
176# and Message to be displayed
177trading_enabled = true
178trading_status_message = "ℹ️Trading is "
179trading_status_enabled = "enabled"
180trading_status_disabled = "disabled"
181
182# Enable/Disable Trading Control
183# and Days of the week and Hours 
184# of the day when Trading is
185# allowed
186# and Message to be displayed
187trading_control = true
188trading_days_allowed = ["tue", "wed", "thu"]
189trading_hours_start = "08:00"
190trading_hours_end = "16:00"
191# trading_timezone = "timezone.utc"
192trading_blackout_dates = ["2024-01-01", "2024-01-15", "2024-02-19", "2024-05-27", 
193                          "2024-07-04", "2024-09-02", "2024-11-11", "2024-11-28", 
194                          "2024-12-25", "2024-12-31", "2024-11-25", "2024-11-26", 
195                          "2024-11-27", "2024-11-28", "2024-11-29", "2024-11-30", 
196                          "2024-12-01", "2024-12-02", "2024-12-03", "2024-12-04", 
197                          "2024-12-05", "2024-12-06", "2024-12-07", "2024-12-08", 
198                          "2024-12-09", "2024-12-10", "2024-12-11", "2024-12-12", 
199                          "2024-12-13", "2024-12-14", "2024-12-15", "2024-12-16", 
200                          "2024-12-17", "2024-12-18", "2024-12-19", "2024-12-20", 
201                          "2024-12-21", "2024-12-22", "2024-12-23", "2024-12-24"]
202trading_control_message = "⚠️ Trading restricted"
203
204
205########################################
206###         PLUGINS SETTINGS         ###
207########################################
208
209# Enable/Disable Plugins
210plugin_enabled = true
211# Plugins Locations
212plugin_directory = "tt.plugins.default_plugins"
213
214# Plugins name list to load at the start
215# of the bot to allow a reduced memory 
216# usage and footprint if needed
217# if you want all the plugins to be loaded
218# at the start, set it to
219# authorized_plugins = []
220# Here the value has been set for
221# main plugins
222authorized_plugins = [
223    'helper_plugin',
224#     'exchange_plugin',
225#     'ai_agent_plugin',
226#      'talkytrend_plugin',
227#     # 'feed_plugin',
228    ]
229
230# Enable/Disable Helper
231helper_enabled = true
232
233# Enable/Disable IAMListening
234iamlistening_enabled = true
235
236# Enable/Disable Findmyorder
237findmyorder_enabled = true
238
239# Enable/Disable Myllm
240myllm_enabled = true
241ai_agent_mode = false # command to toggle aimode in continuous mode
242ai_agent_prefix = "" # prefix use to filter the AI agent 
243ai_agent_suffix = ""
244browser_url = "https://www.google.com"
245browser_headless = true
246
247# Enable/Disable CEFI
248cex_enabled = true
249
250# Enable/Disable DXSP
251dxsp_enabled = true
252
253# Enable/Disable Talkytrend
254# Set default to true, control via specific environments (like [testing]) if needed
255talkytrend_enabled = true 
256
257# Enable/Disable RSS Feed Plugin
258rss_feed_plugin_enabled = false
259
260# Enable/Disable Example Plugin
261# example_plugin_enabled = true
262example_plugin_enabled = false
263# Enable/Disable User Plugins
264# Not yet implemented
265# user_plugins_allowed = true
266user_plugins_allowed = false
267
268# plugin cron scheduler
269user_day_of_week="tue-thu"
270user_hours="6,12,18"
271user_timezone="UTC"
272
273########################################
274###          HELPER SETTINGS         ###
275########################################
276
277# URL endpoint for latency ping.
278ip_check_url = "8.8.8.8"
279
280
281########################################
282###        RSS FEED SETTINGS         ###
283########################################
284
285# url of the rss feed
286rss_feed_url= "https://finance.yahoo.com/rss/"
287
288# frequency of the rss feed update in
289# minutes
290rss_feed_frequency = 5
291
292# prefix for the rss identifier and filtering
293rss_prefix = "πŸ“’"
294
295
296########################################
297###        FINDMYORDER SETTINGS      ###
298########################################
299
300[default.findmyorder.standard]
301enabled = false
302parser_library = "standard"
303# Keyword to be use to identify an order
304action_identifier = "BUY SELL LONG SHORT"
305# Keyword identifier for stoploss
306stop_loss_identifier = "sl="
307# Keyword identifier for take-profit
308take_profit_identifier = 'tp='
309# Keyword identifier for quantity
310quantity_identifier = 'q='
311# Keyword identifier for order type
312order_type_identifier = "spot future margin"
313# Keyword identifier for leverage
314leverage_type_identifier = "cross isolated"
315# Keyword identifier for comments
316comment_identifier = "comment="
317
318# Stoploss default value is none is provided
319stop_loss = 1000
320# Take-Profit default value is none is provided
321take_profit = 1000
322# Quantity default value is none is provided
323quantity = 1
324
325# Settings to enable or disable
326# instrument mapping
327instrument_mapping = false
328# instrument mapping to use and alternative 
329#  symbol when generating the order
330mapping = [
331    # { id = "EURUSD", alt = "EUR/sUSD" },
332    # { id = "GOLD", alt = "XAU" },
333    # { id = "BTC", alt = "WBTC" },
334    # { id = "ETH", alt = "WETH" },
335]
336
337# Instruments to be ignored
338# when generating an order
339ignore_instrument = "DOGE"
340
341
342#####################
343###  TALKYTREND   ###
344#####################
345
346# # Tradingview Parameters
347[default.talkytrend.tradingviewexample]
348# Signals Enable/Disable
349enabled = false
350library = "tradingview"
351# instrument monitored under trend
352# use https://tvdb.brianthe.dev
353# to update the list for your instrument
354instrument = [
355    { id ="EURUSD", exchange='FX_IDC',screener="forex"},
356    { id ="GOLD", exchange='TVC',screener="cfd"},
357    { id ="SPX", exchange='SP',screener="cfd"},
358    { id ="UKOIL", exchange='FX',screener="cfd"},
359    { id ="BTCUSD", exchange='BINANCE',screener="crypto"},
360]
361# Tradingview Prettytable Format
362# default format is flat table
363# other option is "HTML"
364# see https://pypi.org/project/prettytable/
365format = ""
366
367# # yahoo finance ticker reference
368# # to retrieve company news or index news
369# [default.talkytrend.yfinance]
370# enabled = true
371# library = "yfinance"
372# instrument = "MSFT"
373
374
375# # Events calendar
376# [default.talkytrend.calendar]
377# enabled = true
378# library = "calendar"
379# url = "https://nfs.faireconomy.media/ff_calendar_thisweek.json"
380# # Adhoc date to add in event tracker
381# date = [
382#     "2023-11-01", "2023-12-13", "2024-01-31",
383#     "2024-03-20", "2024-05-01","2024-06-12", 
384#     "2024-07-31", "2024-09-18","2024-11-07", 
385#     "2024-12-18", "2025-01-29"
386#     ]
387
388# # Live TV
389# [default.talkytrend.livetv]
390# enabled = true
391# library = "livetv"
392# url = "https://bloomberg.com/media-manifest/streams/us.m3u8"
393
394# # RSS Feeds
395# [default.talkytrend.feed]
396# enabled = true
397# library = "feed"
398# url = "https://www.dailyfx.com/feeds/market-news"
399
400# # Finnhub news fetcher
401# [default.talkytrend.finnhub]
402# enabled = false
403# library = "finnhub"
404# api_key = ""
405# category = "forex"
406
407# # web scraper
408# [default.talkytrend.scraper]
409# enabled = false
410# library = "scraper"
411# url = ""
412# scraper_page_id = ""
413
414#################################
415###        MYLLM SETTINGS     ###
416#################################
417
418# [default.myllm.openai]
419# enabled = true
420# llm_library = "openai"
421# llm_model= "gpt-4o"
422# llm_provider = "" 
423# llm_provider_key = "DEADBEEF"
424# max_memory = 100
425# timeout = 0
426# stream_mode = false
427# llm_prefix = "" 
428# llm_suffix = "" 
429# llm_template = """
430# You are a friendly AI helping me with 
431# trade monitoring and execution.
432# """
433# vision_prompt = "Summarize the image content:"
434
435# [default.myllm.g4f]
436# enabled = false # options are true or false to enable or disable the llm
437# llm_library = "g4f" # options are bard, openai or g4f
438# llm_model= "gpt-4-turbo" # model to use e.g. gpt-3.5-turbo, gpt-4, gpt-4-32k
439# llm_provider = "g4f.Provider.Bing" # only for g4f. Refer to https://github.com/xtekky/gpt4free
440# llm_provider_key = "" # only for bard and openai to pass either the cookie or the api key
441# max_memory = 100 # Conversation history size
442# timeout = 5 # time lag to wait ai response
443# stream_mode = false # enable streaming mode
444# llm_prefix = "🐻" # prefix use to filter the AI response
445# llm_suffix = "🐻" # suffix use to filter the AI response
446# llm_template = """
447# You are a friendly AI helping me with 
448# trade monitoring and execution.
449# """
450# vision_prompt = "Summarize the image content:"
451
452########################################
453###      CHAT PLATFORM SETTINGS      ###
454########################################
455
456# # telegram example
457# [default.platform.telegram]
458# enabled=true
459# platform="telegram"
460# bot_token = "mytoken"
461# bot_channel_id = "mychannelid"
462# bot_api_id = "myapiid"
463# bot_api_hash = "myapihash"
464# bot_hostname = ""
465# bot_user = ""
466# bot_pass = ""
467# bot_auth_token = ""
468# iteration_enabled = false
469# iteration_limit = -1
470
471# # discord example
472# [default.platform.discord]
473# platform="discord"
474# enabled = true
475# bot_token = "mytoken"
476# bot_channel_id = "mychannelid"
477# bot_api_id = ""
478# bot_api_hash = ""
479# bot_hostname = ""
480# bot_user = ""
481# bot_pass = ""
482# bot_auth_token = ""
483# iteration_enabled = false
484# iteration_limit = -1
485
486########################################
487###           DEX SETTINGS          ###
488########################################
489
490# # uniswap v2 protocol type and router uniswap
491# [default.dex.eth]
492# enabled=true
493# wallet_address = "0x1234567890123456789012345678901234567890"
494# private_key = "0xdeadbeef88"
495# rpc = "https://rpc.ankr.com/eth"
496# protocol = "uniswap"
497# protocol_version = 2
498# api_endpoint = ''
499# api_key = ""
500# router_contract_addr = "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D"
501# factory_contract_addr = "0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f"
502# trading_risk_percentage = true
503# trading_risk_amount = 10
504# trading_slippage = 2
505# trading_amount_threshold = 0
506# trading_asset_address = "0xdAC17F958D2ee523a2206206994597C13D831ec7"
507# trading_asset_separator = ""
508# block_explorer_url = "https://api.etherscan.io/api?"
509# block_explorer_api = "123123123123123"
510# mapping = [
511#     { id = "BTC", alt = "WBTC" },
512# ]
513# # Header to use for retrieving urls content below
514# headers = {User-Agent= 'Mozilla/5.0'}
515
516# # DEX ABI to use in case you have no explorer setup
517# dex_erc20_abi_url = "https://raw.githubusercontent.com/Uniswap/interface/44c355c7f0f8ab5bdb3e0790560e84e59f5666f7/src/abis/erc20.json"
518
519# # token list using uniswap tokenlist format
520# # https://github.com/mraniki/tokenlist
521# # this can be used to avoid using coingecko
522# # or if token are not listed yet or for testnet
523# # token_mainnet_list = "https://raw.githubusercontent.com/mraniki/tokenlist/main/all.json"
524# # token_testnet_list = "https://raw.githubusercontent.com/mraniki/tokenlist/main/testnet.json"
525# token_mainnet_list = ""
526# token_testnet_list = ""
527# token_personal_list = "https://raw.githubusercontent.com/mraniki/tokenlist/main/TT.json"
528
529# # uniswap v2 protocol type and router pancakeswap on BSC chain 56
530# [default.dex.bsc]
531# enabled=true
532# wallet_address = "0x1234567890123456789012345678901234567890"
533# private_key = "0xdeadbeef88"
534# rpc = "https://rpc.ankr.com/bsc"
535# protocol = "uniswap"
536# protocol_version = 2
537# api_endpoint = ''
538# api_key = ""
539# router_contract_addr = "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D"
540# factory_contract_addr = "0xcA143Ce32Fe78f1f7019d7d551a6402fC5350c73"
541# trading_risk_percentage = true
542# trading_risk_amount = 10
543# trading_slippage = 2
544# trading_amount_threshold = 0
545# trading_asset_address = "0xdAC17F958D2ee523a2206206994597C13D831ec7"
546# trading_asset_separator = ""
547# block_explorer_url = "https://api.bscscan.com/api?"
548# block_explorer_api = "123123123123123"
549# mapping = [
550#     { id = "BTC", alt = "BTCB" },
551# ]
552# # Header to use for retrieving urls content below
553# headers = {User-Agent= 'Mozilla/5.0'}
554
555# # DEX ABI to use in case you have no explorer setup
556# dex_erc20_abi_url = "https://raw.githubusercontent.com/Uniswap/interface/44c355c7f0f8ab5bdb3e0790560e84e59f5666f7/src/abis/erc20.json"
557
558# # token list using uniswap tokenlist format
559# # https://github.com/mraniki/tokenlist
560# # this can be used to avoid using coingecko
561# # or if token are not listed yet or for testnet
562# # token_mainnet_list = "https://raw.githubusercontent.com/mraniki/tokenlist/main/all.json"
563# # token_testnet_list = "https://raw.githubusercontent.com/mraniki/tokenlist/main/testnet.json"
564# token_mainnet_list = ""
565# token_testnet_list = ""
566# token_personal_list = "https://raw.githubusercontent.com/mraniki/tokenlist/main/TT.json"
567
568# # uniswap v3 and router uniswap v3 on arbitrum chain
569# [default.dex.arb]
570# enabled=true
571# wallet_address = "0x1234567890123456789012345678901234567890"
572# private_key = "0xdeadbeef88"
573# rpc = "https://arbitrum.llamarpc.com"
574# protocol = "uniswap"
575# protocol_version = 3
576# api_endpoint = ''
577# api_key = ""
578# router_contract_addr = ""
579# factory_contract_addr = ""
580# trading_risk_percentage = true
581# trading_risk_amount = 10
582# trading_slippage = 2
583# trading_amount_threshold = 0
584# trading_asset_address = "0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9"
585# trading_asset_separator = ""
586# block_explorer_url = "https://api.arbiscan.io/api?"
587# block_explorer_api = "123123123123123"
588# mapping = [
589#     { id = "BTC", alt = "WBTC" },
590# ]
591# # Header to use for retrieving urls content below
592# headers = {User-Agent= 'Mozilla/5.0'}
593
594# # DEX ABI to use in case you have no explorer setup
595# dex_erc20_abi_url = "https://raw.githubusercontent.com/Uniswap/interface/44c355c7f0f8ab5bdb3e0790560e84e59f5666f7/src/abis/erc20.json"
596
597# # token list using uniswap tokenlist format
598# # https://github.com/mraniki/tokenlist
599# # this can be used to avoid using coingecko
600# # or if token are not listed yet or for testnet
601# # token_mainnet_list = "https://raw.githubusercontent.com/mraniki/tokenlist/main/all.json"
602# # token_testnet_list = "https://raw.githubusercontent.com/mraniki/tokenlist/main/testnet.json"
603# token_mainnet_list = ""
604# token_testnet_list = ""
605# token_personal_list = "https://raw.githubusercontent.com/mraniki/tokenlist/main/TT.json"
606
607# # ZeroX 0x protocol type on polygon chain 137
608# [default.dex.polygon]
609# enabled=true
610# wallet_address = "0x1234567890123456789012345678901234567890"
611# private_key = "0xdeadbeef88"
612# rpc = "https://rpc.ankr.com/polygon"
613# protocol = "0x"
614# protocol_version = 4
615# api_endpoint = "https://polygon.api.0x.org/"
616# api_key = ""
617# router_contract_addr = "0xdef1c0ded9bec7f1a1670819833240f027b25eff"
618# factory_contract_addr = "0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f"
619# trading_risk_percentage = true
620# trading_risk_amount = 10
621# trading_slippage = 2
622# trading_amount_threshold = 0
623# trading_asset_address = "0xdAC17F958D2ee523a2206206994597C13D831ec7"
624# trading_asset_separator = ""
625# block_explorer_url = "https://api.polygonscan.com/api?"
626# block_explorer_api = "123123123123123"
627# mapping = [
628#     { id = "BTC", alt = "WBTC" },
629# ]
630# # Header to use for retrieving urls content below
631# headers = {User-Agent= 'Mozilla/5.0'}
632
633# # DEX ABI to use in case you have no explorer setup
634# dex_erc20_abi_url = "https://raw.githubusercontent.com/Uniswap/interface/44c355c7f0f8ab5bdb3e0790560e84e59f5666f7/src/abis/erc20.json"
635
636# # token list using uniswap tokenlist format
637# # https://github.com/mraniki/tokenlist
638# # this can be used to avoid using coingecko
639# # or if token are not listed yet or for testnet
640# # token_mainnet_list = "https://raw.githubusercontent.com/mraniki/tokenlist/main/all.json"
641# # token_testnet_list = "https://raw.githubusercontent.com/mraniki/tokenlist/main/testnet.json"
642# token_mainnet_list = ""
643# token_testnet_list = ""
644# token_personal_list = "https://raw.githubusercontent.com/mraniki/tokenlist/main/TT.json"
645
646# # kwenta protocol type on OPTIMISM chain 10 
647# [default.dex.opt]
648# enabled=false
649# wallet_address = "0x1234567890123456789012345678901234567890"
650# private_key = "0xdeadbeef88"
651# rpc = "https://optimism.llamarpc.com"
652# protocol = "kwenta"
653# protocol_version = 2
654# api_endpoint = ""
655# api_key = ""
656# router_contract_addr = "0xa062aE8A9c5e11aaA026fc2670B0D65cCc8B2858"
657# factory_contract_addr = "0xF4c67CdEAaB8360370F41514d06e32CcD8aA1d7B"
658# trading_risk_percentage = true
659# trading_risk_amount = 1
660# trading_slippage = 2
661# trading_amount_threshold = 0
662# trading_asset_address = "0x8c6f28f2F1A3C87F0f938b96d27520d9751ec8d9"
663# trading_asset_separator = ""
664# block_explorer_url = "https://optimistic.etherscan.com/api?"
665# block_explorer_api = "123123123123123"
666# mapping = [
667#     { id = "BTC", alt = "WBTC" },
668# ]
669# # Header to use for retrieving urls content below
670# headers = {User-Agent= 'Mozilla/5.0'}
671
672# # DEX ABI to use in case you have no explorer setup
673# dex_erc20_abi_url = "https://raw.githubusercontent.com/Uniswap/interface/44c355c7f0f8ab5bdb3e0790560e84e59f5666f7/src/abis/erc20.json"
674
675# # token list using uniswap tokenlist format
676# # https://github.com/mraniki/tokenlist
677# # this can be used to avoid using coingecko
678# # or if token are not listed yet or for testnet
679# # token_mainnet_list = "https://raw.githubusercontent.com/mraniki/tokenlist/main/all.json"
680# # token_testnet_list = "https://raw.githubusercontent.com/mraniki/tokenlist/main/testnet.json"
681# token_mainnet_list = ""
682# token_testnet_list = ""
683# token_personal_list = "https://raw.githubusercontent.com/mraniki/tokenlist/main/TT.json"
684
685# # uniswap v3 protocol type using pancakeswap on zkSync chain 324 
686# [default.dex.zkSync]
687# enabled=true
688# wallet_address = "0x1234567890123456789012345678901234567890"
689# private_key = "0xdeadbeef88"
690# rpc = "https://zksync.drpc.org"
691# protocol = "uniswap"
692# protocol_version = 3
693# api_endpoint = ""
694# api_key = ""
695# router_contract_addr = "0xD70C70AD87aa8D45b8D59600342FB3AEe76E3c68"
696# factory_contract_addr = "0x1BB72E0CbbEA93c08f535fc7856E0338D7F7a8aB"
697# trading_risk_percentage = true
698# trading_risk_amount = 1
699# trading_slippage = 2
700# trading_amount_threshold = 0
701# trading_asset_address = "0x8c6f28f2F1A3C87F0f938b96d27520d9751ec8d9"
702# trading_asset_separator = ""
703# block_explorer_url = "https://explorer.zksync.io/api?"
704# block_explorer_api = "123123123123123"
705# mapping = [
706#     { id = "BTC", alt = "WBTC" },
707# ]
708# # Header to use for retrieving urls content below
709# headers = {User-Agent= 'Mozilla/5.0'}
710
711# # DEX ABI to use in case you have no explorer setup
712# dex_erc20_abi_url = "https://raw.githubusercontent.com/Uniswap/interface/44c355c7f0f8ab5bdb3e0790560e84e59f5666f7/src/abis/erc20.json"
713
714# # token list using uniswap tokenlist format
715# # https://github.com/mraniki/tokenlist
716# # this can be used to avoid using coingecko
717# # or if token are not listed yet or for testnet
718# # token_mainnet_list = "https://raw.githubusercontent.com/mraniki/tokenlist/main/all.json"
719# # token_testnet_list = "https://raw.githubusercontent.com/mraniki/tokenlist/main/testnet.json"
720# token_mainnet_list = ""
721# token_testnet_list = ""
722# token_personal_list = "https://raw.githubusercontent.com/mraniki/tokenlist/main/TT.json"
723
724########################################
725###           CEX SETTINGS          ###
726########################################
727
728# # CEFI example using ccxt binance
729# enabled=true
730# protocol = "ccxt"
731# api_key= ""
732# secret= ""
733# password = ""
734# testmode = true
735# defaulttype = "spot"
736# ordertype = "market"
737# leverage_type = "isolated"
738# leverage = 1
739# trading_risk_percentage = true
740# trading_risk_amount = 10
741# trading_slippage = 2
742# trading_amount_threshold = 0
743# trading_asset = "USDT"
744# trading_asset_separator = ""
745# mapping = [
746#     { id = "BTC", alt = "BTC/USDT" },
747# ]
748# balance_limit = true
749# balance_limit_value = 10
750
751# [default.cex.capital]
752# enabled = false
753# protocol = "capital"
754# user_id = "12345678"
755# api_key= "myapi_DEADBEEF"
756# password = "12345678"
757# testmode = false
758# defaulttype = ""
759# ordertype = ""
760# leverage_type = ""
761# leverage = 1
762# trading_risk_percentage = true
763# trading_risk_amount = 10
764# trading_slippage = 2
765# trading_amount_threshold = 0
766# trading_asset = "USD"
767# trading_asset_separator = ""
768# mapping = [
769#     { id = "EURUSD", alt = "EURUSD" },
770#     { id = "BTC", alt = "BTCUSD" },
771#     { id = "ETH", alt = "ETHUSD" },
772#     { id = "CRUDE", alt = "OIL_CRUDE" },
773#     { id = "BRENT", alt = "OIL_BRENT" },
774#     { id = "GOLD", alt = "GOLD" },
775#     { id = "SILVER", alt = "SILVER" },
776#     { id = "US500", alt = "US500" },
777# ]
778# balance_limit = false
779# balance_limit_value = 10
780
781
782########################################
783###     END OF DEFAULT SETTINGS      ###
784########################################

Settings Example#

Settings.toml#

  1########################################
  2###          EXAMPLE SETTINGS       ###
  3#######################################
  4# [default]
  5# loglevel = "INFO"
  6# ui_enabled = false
  7
  8# DISCORD BOT on ethereum chain using 
  9# uniswap v2 router
 10    #[default.platform.main]
 11    # bot_token = '12122121'
 12    # bot_channel_id = '1221212'
 13    # apprise_url = 'discord://12121/121212'
 14    # [default.dex.uniswap]
 15    # wallet_address = ""
 16    # private_key = ""
 17    # rpc = "https://rpc.ankr.com/eth"
 18    # protocol = "uniswap"
 19    # protocol_version = 2
 20    # api_endpoint = ""
 21    # api_key = ""
 22    # router_contract_addr = "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D"
 23    # factory_contract_addr = "0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f"
 24    # trading_risk_percentage = true
 25    # trading_risk_amount = 10
 26    # trading_slippage = 2
 27    # trading_asset_address = "0xdAC17F958D2ee523a2206206994597C13D831ec7"
 28    # trading_asset_separator = ""
 29    # block_explorer_url = "https://api.etherscan.com/api?"
 30    # block_explorer_api = ""
 31    # mapping = [
 32    # { id = "BTC", alt = "WBTC" },
 33    # ]
 34
 35# TELEGRAM BOT on CEX Binance
 36    #[default.platform.main]
 37    # bot_token = '121212121'
 38    # bot_channel_id = '-1122121'
 39    # bot_api_id = '1212912'
 40    # bot_api_hash = '121212121' 
 41    # apprise_url = 'tgram://121221/-11211212121'
 42    # [default.cex.binance]
 43    # name ="binance"
 44    # api_key= ''
 45    # secret = ''
 46    # password = ""
 47    # testmode = true
 48    # defaulttype = "spot"
 49    # ordertype = "market"
 50    # trading_risk_percentage = true
 51    # trading_risk_amount = 4
 52    # trading_slippage = 2
 53    # trading_asset = "USDT"
 54    # trading_asset_separator = ""
 55    # mapping = [
 56    # { id = "BTC", alt = "BTCUSDT" },
 57    # ]
 58
 59#DISCORD BOT on BSC chain using pancakeswap v2 router
 60    #[default.platform.main]
 61    # bot_token = '1212121212121'
 62    # bot_channel_id = '121212121212'
 63    # apprise_url = 'discord://121121/1212212'
 64    # [default.dex.pancake]
 65    # wallet_address = ""
 66    # private_key = ""
 67    # rpc = "https://rpc.ankr.com/bsc"
 68    # protocol = "uniswap"
 69    # protocol_version = 2
 70    # api_endpoint = ""
 71    # api_key = ""
 72    # router_contract_addr = "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D"
 73    # factory_contract_addr = "0xcA143Ce32Fe78f1f7019d7d551a6402fC5350c73"
 74    # trading_risk_percentage = true
 75    # trading_risk_amount = 10
 76    # trading_slippage = 2
 77    # trading_asset_address = "0x55d398326f99059ff775485246999027b3197955"
 78    # trading_asset_separator = ""
 79    # block_explorer_url = "https://api.bscscan.com/api?"
 80    # block_explorer_api = ""
 81    # mapping = [
 82    # { id = "BTC", alt = "BTCB" },
 83    # ]
 84
 85#MATRIX BOT on Polygon chain using zerox protocol
 86    #[default]
 87    # bot_token = '12122121'
 88    # bot_channel_id = '12121212'
 89    # bot_hostname='matrix.org'
 90    # bot_user='itsme'
 91    # bot_pass='mario'
 92    # apprise_url = 'discord://1212121/1211212'
 93    # [default.dex.polygon]
 94    # wallet_address = ""
 95    # private_key = ""
 96    # rpc = "https://polygon.llamarpc.com"
 97    # protocol = "0x"
 98    # protocol_version = 4
 99    # api_endpoint = "https://polygon.api.0x.org"
100    # api_key = ""
101    # router_contract_addr = "0xdef1c0ded9bec7f1a1670819833240f027b25eff"
102    # factory_contract_addr = "0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f"
103    # trading_risk_percentage = true
104    # trading_risk_amount = 10
105    # trading_slippage = 2
106    # trading_asset_address = "0xc2132D05D31c914a87C6611C10748AEb04B58e8F"
107    # trading_asset_separator = ""
108    # block_explorer_url = "https://api.polygonscan.com/api?"
109    # block_explorer_api = ""
110    # mapping = [
111    # { id = "BTC", alt = "WBTC" },
112    # ]

.env or ENV VARS#

 1########################################
 2###          EXAMPLE SETTINGS        ###
 3########################################
 4
 5# Below are examples for minimum setup
 6#
 7# If you use env vars, you need to
 8# prefix them with 'TT_'
 9# refer to example_settings.toml for
10# toml setup and complete settings list
11
12########################################
13#             TELEGRAM BOT             #
14#             on Binance               #
15########################################
16# TT_LOGLEVEL = 'INFO'
17# TT_PLATFORM__MAIN__BOT_TOKEN = '121212121'
18# TT_PLATFORM__MAIN__BOT_CHANNEL_ID = '-1122121'
19# TT_PLATFORM__MAIN__BOT_API_ID = '1212912'
20# TT_PLATFORM__MAIN__BOT_API_HASH = '121212121' 
21# TT_APPRISE_URL = 'tgram://121221/-11211212121'
22# TT_CEX__PRIMARY__NAME ="binance"
23# TT_CEX__PRIMARY__API_KEY= ''
24# TT_CEX__PRIMARY__SECRET = ''
25# TT_CEX__PRIMARY__PASSWORD = ""
26# TT_CEX__PRIMARY__TESTMODE = true
27# TT_CEX__PRIMARY__DEFAULTTYPE = "spot"
28# TT_CEX__PRIMARY__ORDERTYPE = "market"
29# TT_CEX__PRIMARY__TRADING_RISK_PERCENTAGE = true
30# TT_CEX__PRIMARY__TRADING_RISK_AMOUNT = 4
31# TT_CEX__PRIMARY__TRADING_SLIPPAGE = 2
32# TT_CEX__PRIMARY__TRADING_ASSET = "USDT"
33# TT_CEX__PRIMARY__TRADING_ASSET_SEPARATOR = ""
34# TT_CEX__PRIMARY__MAPPING = [{ id = "BTC", alt = "BTCUSDT" },]

Config#

TalkyTrader Settings, Scheduling and Logging,

πŸ§β±οΈβš™οΈ

tt.config.scheduler = <asyncz.schedulers.asyncio.AsyncIOScheduler object>#

Logging is managed via loguru

class tt.config.InterceptHandler(level=0)[source]#

InterceptHandler is a loguru handler that intercepts all log records. It can be used as a replacement for logging.basicConfig()

Initializes the instance - basically setting the formatter to None and the filter list to empty.

emit(record)[source]#

Emit a log record.

Parameters:

record (logging.LogRecord) – The log record to emit.

Returns:

None

tt.config.loguru_setup()[source]#

Set up the loguru logger with custom configurations.

Returns:

The configured loguru logger instance.

Return type:

loguru.logger