From 2e5cc768880ddb608151af337a1d3074aca552a7 Mon Sep 17 00:00:00 2001 From: mraniki Date: Tue, 8 Aug 2023 08:46:20 +0000 Subject: [PATCH 1/9] Update Requirements --- .requirements/requirements.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.requirements/requirements.txt b/.requirements/requirements.txt index 50cf6a0fa..396010a8c 100644 --- a/.requirements/requirements.txt +++ b/.requirements/requirements.txt @@ -16,7 +16,7 @@ beautifulsoup4==4.12.2 ; python_version >= "3.10" and python_version < "4.0" bitarray==2.8.1 ; python_version >= "3.10" and python_version < "4" blurhash==1.1.4 ; python_version >= "3.10" and python_version < "4.0" browser-cookie3==0.19.1 ; python_version >= "3.10" and python_version < "4.0" -ccxt==4.0.52 ; python_version >= "3.10" and python_version < "4.0" +ccxt==4.0.53 ; python_version >= "3.10" and python_version < "4.0" certifi==2023.7.22 ; python_version >= "3.10" and python_version < "4.0" cffi==1.15.1 ; python_version >= "3.10" and python_version < "4.0" charset-normalizer==3.2.0 ; python_version >= "3.10" and python_version < "4.0" @@ -56,8 +56,9 @@ html5lib==1.1 ; python_version >= "3.10" and python_version < "4.0" httpcore==0.17.3 ; python_version >= "3.10" and python_version < "4.0" httpx==0.24.1 ; python_version >= "3.10" and python_version < "4.0" hyperframe==6.0.1 ; python_version >= "3.10" and python_version < "4.0" -iamlistening==3.2.0 ; python_version >= "3.10" and python_version < "4.0" +iamlistening==3.3.0 ; python_version >= "3.10" and python_version < "4.0" idna==3.4 ; python_version >= "3.10" and python_version < "4.0" +iso8601==2.0.0 ; python_version >= "3.10" and python_version < "4.0" jeepney==0.8.0 ; python_version >= "3.10" and (sys_platform == "bsd" or sys_platform == "linux") and python_version < "4.0" js2py==0.74 ; python_version >= "3.10" and python_version < "4.0" jsonschema-specifications==2023.7.1 ; python_version >= "3.10" and python_version < "4.0" @@ -130,6 +131,7 @@ tinode-grpc==0.22.3 ; python_version >= "3.10" and python_version < "4.0" toml==0.10.2 ; python_version >= "3.10" and python_version < "4.0" toolz==0.12.0 ; python_version >= "3.10" and python_version < "4" and (implementation_name == "pypy" or implementation_name == "cpython") tradingview-ta==3.3.0 ; python_version >= "3.10" and python_version < "4.0" +twitchio==2.6.0 ; python_version >= "3.10" and python_version < "4.0" typing-extensions==4.7.1 ; python_version >= "3.10" and python_version < "4.0" tzdata==2023.3 ; python_version >= "3.10" and python_version < "4.0" tzlocal==4.3.1 ; python_version >= "3.10" and python_version < "4.0" From ddeee6417a96f969f874d4b822a92c04006ed5ba Mon Sep 17 00:00:00 2001 From: mraniki Date: Tue, 8 Aug 2023 16:32:50 +0000 Subject: [PATCH 2/9] Update Requirements --- .requirements/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.requirements/requirements.txt b/.requirements/requirements.txt index 396010a8c..a79dd6070 100644 --- a/.requirements/requirements.txt +++ b/.requirements/requirements.txt @@ -56,7 +56,7 @@ html5lib==1.1 ; python_version >= "3.10" and python_version < "4.0" httpcore==0.17.3 ; python_version >= "3.10" and python_version < "4.0" httpx==0.24.1 ; python_version >= "3.10" and python_version < "4.0" hyperframe==6.0.1 ; python_version >= "3.10" and python_version < "4.0" -iamlistening==3.3.0 ; python_version >= "3.10" and python_version < "4.0" +iamlistening==3.3.1 ; python_version >= "3.10" and python_version < "4.0" idna==3.4 ; python_version >= "3.10" and python_version < "4.0" iso8601==2.0.0 ; python_version >= "3.10" and python_version < "4.0" jeepney==0.8.0 ; python_version >= "3.10" and (sys_platform == "bsd" or sys_platform == "linux") and python_version < "4.0" From af99d90150206fc33087076056ebb9fb8a47450c Mon Sep 17 00:00:00 2001 From: mraniki <8766259+mraniki@users.noreply.github.com> Date: Tue, 8 Aug 2023 20:17:52 +0200 Subject: [PATCH 3/9] =?UTF-8?q?=F0=9F=93=9D=20Updated=20Settings=20documen?= =?UTF-8?q?tation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/plugins/cex.rst | 4 +- examples/example_settings.toml | 42 +++--- tt/bot.py | 8 +- tt/talky_settings.toml | 251 ++++++++++++++++++++++++++------- 4 files changed, 228 insertions(+), 77 deletions(-) diff --git a/docs/plugins/cex.rst b/docs/plugins/cex.rst index 1acfe3dbb..6386abd68 100644 --- a/docs/plugins/cex.rst +++ b/docs/plugins/cex.rst @@ -5,9 +5,11 @@ CEX User Guide ========== - Retrieve your CEX API Keys +- Refer to https://docs.ccxt.com for the supported exchange Module Reference ================ -.. automodule::tt.plugins.default_plugins.cex_exchange_plugin +:doc:`tt.plugins.default_plugins.cex_exchange_plugin` + diff --git a/examples/example_settings.toml b/examples/example_settings.toml index 3b2b48f3a..60b35ecf9 100644 --- a/examples/example_settings.toml +++ b/examples/example_settings.toml @@ -1,38 +1,38 @@ ######################################## -### EXAMPLE SETTINGS ### +### EXAMPLE SETTINGS ### ####################################### # DISCORD BOT on ethereum chain using # uniswap v2 router -# bot_token = '1212121212121' -# bot_channel_id = '121212121212' -# apprise_url = 'discord://1212121212121/121212121212' -# dex_wallet_address = '0x1234567890123456789012345678901234567890' -# dex_private_key = '0xdeadbeef' -# dex_block_explorer_api = '42342342342' + # bot_token = '12122121' + # bot_channel_id = '1221212' + # apprise_url = 'discord://12121/121212' + # dex_wallet_address = '0x123458901234567890' + # dex_private_key = '0xdeadbeef' + # dex_block_explorer_api = '42342342342' # TELEGRAM BOT on CEX Binance - # bot_token = '1212121212121' - # bot_channel_id = '-112121212121' - # bot_api_id = '1212121212912' - # bot_api_hash = '121212121212121' - # apprise_url = 'tgram://1212121212121/-112121212121' + # bot_token = '121212121' + # bot_channel_id = '-1122121' + # bot_api_id = '1212912' + # bot_api_hash = '121212121' + # apprise_url = 'tgram://121221/-11211212121' # cex_name = 'binance' - # cex_api = 'abcabcabcabcabcabc' - # cex_secret = 'abcabcabcabcabcabc' + # cex_api = 'abcabccabc' + # cex_secret = 'abcacabcabc' #DISCORD BOT on BSC chain using pancakeswap v2 router and custom plugin setup # bot_token = '1212121212121' # bot_channel_id = '121212121212' - # apprise_url = 'discord://1212121212121/121212121212' - # dex_wallet_address = '0x1234567890123456789012345678901234567890' + # apprise_url = 'discord://121121/1212212' + # dex_wallet_address = '0x123467890' # dex_private_key = '0xdeadbeef' # dex_router_contract_addr = "0x10ED43C718714eb63d5aA57B78B54704E256024E" # dex_factory_contract_addr = "0xcA143Ce32Fe78f1f7019d7d551a6402fC5350c73" # dex_block_explorer_url = 'https://api.bscscan.com/api' - # dex_block_explorer_api = '42342342342' + # dex_block_explorer_api = '423442' # trading_asset_address = "0xe9e7cea3dedca5984780bafc599bd69add087d56" # action_identifier = "PUMP DUMP" # mapping = [ @@ -41,13 +41,13 @@ # live_tv_url ='https://reuters-reutersnow-1.plex.wurl.com/manifest/playlist.m3u8' #MATRIX BOT on Polygon chain using zerox protocol - # bot_token = '1212121212121' - # bot_channel_id = '121212121212' + # bot_token = '12122121' + # bot_channel_id = '12121212' # bot_hostname='matrix.org' # bot_user='itsme' # bot_pass='mario' - # apprise_url = 'discord://1212121212121/121212121212' - # dex_wallet_address = '0x1234567890123456789012345678901234567890' + # apprise_url = 'discord://1212121/1211212' + # dex_wallet_address = '0x12345678901234567890' # dex_private_key = '0xdeadbeef' # dex_protocol_type = "0x" # dex_rpc = "https://rpc.ankr.com/polygon" diff --git a/tt/bot.py b/tt/bot.py index 0ac9548f3..6bcdcabe3 100644 --- a/tt/bot.py +++ b/tt/bot.py @@ -18,7 +18,13 @@ @app.on_event("startup") async def start_bot_task(): - """β›“οΈπŸ€–BOT""" + """ + β›“οΈπŸ€–BOT + + Run the talky bot on startup + asynchronously + + """ event_loop = asyncio.get_event_loop() event_loop.create_task(run_bot()) diff --git a/tt/talky_settings.toml b/tt/talky_settings.toml index 717f86743..b79db6691 100644 --- a/tt/talky_settings.toml +++ b/tt/talky_settings.toml @@ -21,46 +21,75 @@ ######################################## [default] -# ENV_FOR_DYNACONF=DEFAULT +# Dynaconf settings verification VALUE = "Production - Default" - ######################################## ### PYTHON SETTINGS ### ######################################## +# Log level +# set to "DEBUG" if you need +# to troubleshoot loglevel = "INFO" -# TT_LOGLEVEL=DEBUG ######################################## ### FASTAPI SETTINGS ### ######################################## +# Uvicorn Server settings host = "0.0.0.0" port = 8080 # Your webhook secret to send -# trade alert directly to your -# bot. +# trade alert directly to your chat. +# If you use Trading view, the webhook +# to be set in the trading view notification +# will be https://0.0.0.0/webhook/123abc +# as per the above and below data + webhook_secret = "123abc" + +# Forward the webhook data +# to another endpoint like another bot +# or webhook service. + +# Forwarded Enable/Disable forwarder = false +# Forwarder URL forwarder_url = "" ######################################## ### APPRISE SETTINGS ### ######################################## +# Refer to +# https://github.com/caronc/apprise/wiki +# Apprise endpoint URL can be a URL +# for the chat, a URL to an Apprise config +# or a URL to the Apprise API endpoint + apprise_url = "json://localhost" -apprise_format = "NotifyFormat.MARKDOWN" -# TT_APPRISE_URL='tgram://TOKEN/CHAT_ID' +#Format of the notification. Format can be +# NotifyFormat.MARKDOWN +# or NotifyFormat.HTML +apprise_format = "NotifyFormat.MARKDOWN" ######################################## ### IAMLISTENING SETTINGS ### ######################################## +# Module Enable/Disable iamlistening_enabled = true -chat_platform="" + +# chat_platform is used to launch +# the specific handler +# for the chat platform. Value can be +# telegram, discord, matrix, etc. +chat_platform = "" + +# bot credentials bot_token = "" bot_channel_id = "" bot_api_id = "" @@ -69,6 +98,17 @@ bot_hostname = "" bot_user = "" bot_pass = "" bot_auth_token = "" + +# Iteration settings used for testing +# if you need the bot to run +# for a long time +# set iteration_enabled to false +# if you need the bot to run +# for a short time +# set iteration_enabled to true +# iteration_limit is the number +# of iterations +# the bot will run for. iteration_enabled = false iteration_limit = -1 @@ -76,187 +116,290 @@ iteration_limit = -1 ### COMMON BOT COMMAND SETTINGS ### ######################################## +# Bot Prefix bot_prefix = "/" +# Specific data that should be ignore by +# the parser bot_ignore = "πŸ—Ώ ⚠️ πŸ“Š 🏦 ⬇️ ⬆️" +# Command for help bot_command_help = "help" +# Command for info bot_command_info = "info" +# Command for user balance bot_command_bal = "bal" +# Command for user position bot_command_pos = "pos" +# Command for daily pnl bot_command_pnl_daily = "d" +# Command for instrument quote bot_command_quote = "q" - ######################################## ### TRADING SETTINGS ### ######################################## +# Trading Enable/Disable trading_enabled = true -trading_risk_amount = 10 +# Trading % of your position to risk per order +# 10 = 10% of the position +trading_risk_amount = 10 ######################################## ### PLUGINS SETTINGS ### ######################################## +# Plugins Enable/Disable plugin_enabled = true +# Plugins Locations plugin_directory = "tt.plugins.default_plugins" +# Example plugin for test purpose example_plugin_enabled = false +# User Plugin Enable/Disable +# Not yet implemented user_plugins_allowed = false - ######################################## ### HELPER SETTINGS ### ######################################## +# Helper Enable/Disable helper_enabled = true +# Help Message helper_commands = "πŸ”€ /trading\nπŸ” /restart\nπŸ•ΈοΈ /network" +# Command for switch trading on or off bot_command_trading = "trading" +# Command to retrieve network info +# such as latency ping and IP address of +# the bot bot_command_network = "network" +# Command to restart the bot bot_command_restart = "restart" +# URL endpoint for the latency +# ping. Used for testping testing ping = "8.8.8.8" ######################################## ### WWW SETTINGS ### ######################################## +# WWW Plugin Enable/Disable www_enabled = false +# Help Message www_commands = "πŸ“· /src\n" +# Command to get screenshot bot_command_screenshot = "scr" www_url = "https://apod.nasa.gov/apod/astropix.html" - ######################################## ### LLM SETTINGS ### ######################################## +# Module Enable/Disable llm_enabled = true +# LLM Model to use llm_model = "gpt-4" +# LLM Provider llm_provider = "g4f.Provider.Providers.ChatgptAi" +# LLM Host llm_host = "" +# LLM Auth Token llm_auth_token = "" +# SERP API Key +llm_serpapi-key = "" +#default prompt if prompt is not given llm_default_prompt = "write a tiny story" -llm_commands = "🦾 /qq\n /tq" +# help message listing the commands +# available +llm_commands = "🦾 /qq\n" +# command for questions bot_command_question = "qq" +# command for topic/conversation bot_command_topic = "tq" ######################################## ### FINDMYORDER SETTINGS ### ######################################## +# Module Enable/Disable findmyorder_enabled = true + +# Keyword to be use to identify an order action_identifier = "BUY SELL LONG SHORT" +# Keyword identifier for stoploss stop_loss_identifier = "sl=" +# Keyword identifier for take-profit take_profit_identifier = 'tp=' +# Keyword identifier for quantity quantity_identifier = 'q=' +# Keyword identifier for order type order_type_identifier = "spot future margin" +# Keyword identifier for leverage leverage_type_identifier = "cross isolated" +# Keyword identifier for comments comment_identifier = "comment=" + +# Stoploss default value is none is provided stop_loss = 1000 +# Take-Profit default value is none is provided take_profit = 1000 +# Quantity default value is none is provided quantity = 1 + +# Settings to enable or disable +# instrument mapping instrument_mapping = true +# instrument mapping to use and alternative +# symbol when generating the order mapping = [ { id = "GOLD", alt = "XAUUSD" }, { id = "SILVER", alt = "XAGUSD" }, { id = "BTC", alt = "WBTC" }, { id = "ETH", alt = "WETH" }, ] -ignore_instrument = "US500 USTEC DOGE" +# Instrument to be ignored +# when generating an order +ignore_instrument = "US500 USTEC DOGE" ######################################## ### CCXT SETTINGS ### ######################################## +# Module Enable/Disable cex_enabled = false +# Help Message ccxt_commands = "🎯 BUY BTCUSDT\n🎯 /q BTCUSDT\n🏦 /bal\n🏦 /pos\n" +# CCXT Parameters to connect with +# the exchange cex_name = "" cex_api = "" cex_secret = "" cex_password = "" cex_testmode = true + +# Default type: SPOT, FUTURE, etc. cex_defaulttype = "SPOT" +# Order type: Market, Limit, etc. cex_ordertype = "MARKET" - ######################################## ### DXSP SETTINGS ### ######################################## +# Module Enable/Disable dxsp_enabled = true + +# Help Message dxsp_commands = "🎯 BUY WBTC\n🎯 /q WBTC\n 🏦 /bal\n 🏦 /pos\n" + +# Your public wallet address dex_wallet_address = "0x1234567890123456789012345678901234567890" -dex_private_key = "0xdeadbeef" -dex_protocol_type = "uniswap" #0x +# Your private wallet key +dex_private_key = "0xdeadbeef45ab87712ad64ccb3b10217737f7faacbf2872e88fdd9a537d8fe266" + +# Protocol used option are uniswap, 0x and 1inch +dex_protocol_type = "uniswap" +# Version of the protocol dex_protocol_version = 2 + +# RPC connectivity dex_rpc = "https://rpc.ankr.com/eth" + +# 0x API required only if +# dex_protocol_type = "0x" dex_0x_url = "https://api.0x.org/mainnet" dex_0x_api_key = "" -trading_asset_address = "0xdAC17F958D2ee523a2206206994597C13D831ec7" -dex_trading_slippage = 2 -dex_block_explorer_url = "https://api.etherscan.io/api?" -dex_block_explorer_api = "11111111111111111" -dex_router_contract_addr = "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D" + +# DEX router address to use +dex_router_contract_addr = "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D" +# DEX ABI to use in case you have no explorer setup dex_router_abi_url = "https://raw.githubusercontent.com/uniswap-python/uniswap-python/master/uniswap/assets/uniswap-v2/router02.abi" +# DEX factory address to use dex_factory_contract_addr = "0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f" +# DEX ABI to use in case you have no explorer setup dex_erc20_abi_url = "https://raw.githubusercontent.com/Uniswap/interface/44c355c7f0f8ab5bdb3e0790560e84e59f5666f7/src/abis/erc20.json" -dex_notify_invalid_token = true + +# Block Explorer API for ABI search +dex_block_explorer_url = "https://api.etherscan.io/api?" +dex_block_explorer_api = "798437294880920392" headers = {User-Agent= 'Mozilla/5.0'} + +# token list using uniswap tokenlist format +# https://github.com/mraniki/tokenlist +# this can be used to avoid using coingecko +# or be used for niche token not listed anywhere +# or for testnet token_mainnet_list = "https://raw.githubusercontent.com/mraniki/tokenlist/main/all.json" token_testnet_list = "https://raw.githubusercontent.com/mraniki/tokenlist/main/testnet.json" token_personal_list = "https://raw.githubusercontent.com/mraniki/tokenlist/main/TT.json" +# Address of your trading asset for your trading - USDT +trading_asset_address = "0xdAC17F958D2ee523a2206206994597C13D831ec7" + +# Slippage % +# 2 = 2% slippage +dex_trading_slippage = 2 + +# Toggle to remove notification if +# a token doesn't exist in the token list +# or in coingecko +dex_notify_invalid_token = true ######################################## ### TALKYTREND SETTINGS ### ######################################## +# Module Enable/Disable talkytrend_enabled = true + +# help message listing the commands available talkytrend_commands = "πŸ“Ί /live\nπŸ“° /news\nπŸ“Š /trend" + +# bot command for tv feed bot_command_tv = "live" +# bot command for trading view trend bot_command_trend = "trend" +# bot command for news feeds bot_command_news = "news" + +# Signals Enable/Disable enable_signals = true +# instrument monitored under trend +# use https://tvdb.brianthe.dev +# to update the list for your instrument assets = [ { id ="EURUSD", exchange='FX_IDC',screener="forex"}, - { id ="BTCUSD",exchange="BINANCE",screener="crypto"}, + { id ="BTCUSD", exchange='BINANCE',screener="crypto"}, ] + +enable_yfinance = true +# yahoo finance ticker reference +# to retrieve company news +ticker_reference = "MSFT" + +# Events Enable/Disable enable_events = true +# Events calendar economic_calendar = "https://nfs.faireconomy.media/ff_calendar_thisweek.json" +# Adhoc date to add in event tracker fomc_decision_date = ["2023-09-20","2023-11-01","2023-12-13"] + +# TV url live_tv_url = "https://bloomberg.com/media-manifest/streams/us.m3u8" + +# Feeds Enable/Disable enable_feed = true -news_feed="https://www.dailyfx.com/feeds/market-news" +# Feeds RSS url +news_feed = "https://www.dailyfx.com/feeds/market-news" +# News Enable/Disable +enable_news = false +# News API key +news_api_key = "" +# News API endpoint +news_url="https://gnews.io/api/v4/top-headlines?category=business&lang=en&max=2&apikey=" ######################################## ### END OF DEFAULT SETTINGS ### -######################################## - - - - - - -# _ _ _ ___ -#| | | | | | |__ \ -#| |_| |__ ___ ___ _ __ __| | )| -#| __| '_ \ / _ \ / _ \ '_ \ / _` | / / -#| |_| | | | __/ | __/ | | | (_| | |_| -# \__|_| |_|\___| \___|_| |_|\__,_| (_) -######################################## -# -# -# -# -# __ __ -# \ \ / / -# \ \_/ /__ ___ -# \ / _ \/ __| -# | | __/\__ \ -# |_|\___||___/ -# -# -# -# -######################################## +######################################## \ No newline at end of file From d02ad0b8a721b8f22168421a6eb116a133286a96 Mon Sep 17 00:00:00 2001 From: mraniki Date: Tue, 8 Aug 2023 18:19:57 +0000 Subject: [PATCH 4/9] Update Requirements --- .requirements/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.requirements/requirements.txt b/.requirements/requirements.txt index a79dd6070..316f1e3be 100644 --- a/.requirements/requirements.txt +++ b/.requirements/requirements.txt @@ -40,7 +40,7 @@ eth-typing==3.4.0 ; python_version >= "3.10" and python_version < "4" eth-utils==2.2.0 ; python_version >= "3.10" and python_version < "4" exceptiongroup==1.1.2 ; python_version >= "3.10" and python_version < "3.11" fastapi==0.101.0 ; python_version >= "3.10" and python_version < "4.0" -findmyorder==1.7.11 ; python_version >= "3.10" and python_version < "4.0" +findmyorder==1.7.12 ; python_version >= "3.10" and python_version < "4.0" frozendict==2.3.8 ; python_version >= "3.10" and python_version < "4.0" frozenlist==1.4.0 ; python_version >= "3.10" and python_version < "4.0" future==0.18.3 ; python_version >= "3.10" and python_version < "4.0" From 77ee43585c1794e3975191411e5cdc4616f09a96 Mon Sep 17 00:00:00 2001 From: mraniki <8766259+mraniki@users.noreply.github.com> Date: Tue, 8 Aug 2023 20:27:08 +0200 Subject: [PATCH 5/9] =?UTF-8?q?=F0=9F=90=9B=20=E2=9C=85=20Unit=20Test?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/test_dex_exchange_plugin.py | 32 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/tests/test_dex_exchange_plugin.py b/tests/test_dex_exchange_plugin.py index 802a315d6..e2ae1bc83 100644 --- a/tests/test_dex_exchange_plugin.py +++ b/tests/test_dex_exchange_plugin.py @@ -1,11 +1,8 @@ - from unittest.mock import AsyncMock -import iamlistening import pytest from dxsp import DexSwap from findmyorder import FindMyOrder -from iamlistening import Listener from tt.config import settings from tt.plugins.default_plugins.dex_exchange_plugin import DexExchangePlugin @@ -21,6 +18,7 @@ def order(): """return valid order""" return "buy WBTC sl=200 tp=400 q=1%" + @pytest.fixture(name="plugin") def test_fixture_plugin(): return DexExchangePlugin() @@ -29,7 +27,6 @@ def test_fixture_plugin(): def test_dynaconf_is_in_testing_env_DEX56(): print(settings.VALUE) assert settings.VALUE == "On Testing DEX_56" - assert settings.cex_name == "" assert settings.dex_wallet_address == "0x1234567890123456789012345678901234567899" @@ -68,46 +65,47 @@ async def test_parse_valid_order(plugin, order_message): @pytest.mark.asyncio async def test_parse_quote(plugin, caplog): - """Test parse_message balance """ + """Test parse_message balance""" plugin.exchange.get_quote = AsyncMock() - await plugin.handle_message('/q WBTC') - plugin.exchange.get_quote.assert_awaited_once_with('WBTC') + await plugin.handle_message("/q WBTC") + plugin.exchange.get_quote.assert_awaited_once_with("WBTC") @pytest.mark.asyncio async def test_parse_balance(plugin): - """Test balance """ + """Test balance""" plugin.exchange.get_account_balance = AsyncMock() - await plugin.handle_message('/bal') + await plugin.handle_message("/bal") plugin.exchange.get_account_balance.assert_awaited_once() @pytest.mark.asyncio async def test_parse_position(plugin): - """Test position """ + """Test position""" plugin.exchange.get_account_position = AsyncMock() - await plugin.handle_message('/pos') + await plugin.handle_message("/pos") plugin.exchange.get_account_position.assert_awaited_once() @pytest.mark.asyncio async def test_parse_pnl(plugin): - """Test balance """ + """Test balance""" plugin.exchange.get_account_pnl = AsyncMock() - await plugin.handle_message('/d') + await plugin.handle_message("/d") plugin.exchange.get_account_pnl.assert_awaited_once() @pytest.mark.asyncio async def test_parse_help(plugin): - """Test help """ + """Test help""" plugin.exchange.get_help = AsyncMock() - await plugin.handle_message('/help') + await plugin.handle_message("/help") plugin.exchange.get_help.assert_awaited_once() + @pytest.mark.asyncio async def test_parse_info(plugin): - """Test help """ + """Test help""" plugin.exchange.get_info = AsyncMock() - await plugin.handle_message('/info') + await plugin.handle_message("/info") plugin.exchange.get_info.assert_awaited_once() From 9949972e9290acb39754ef67add78fb6d4cdfa12 Mon Sep 17 00:00:00 2001 From: mraniki Date: Tue, 8 Aug 2023 18:29:11 +0000 Subject: [PATCH 6/9] Update Requirements --- .requirements/requirements.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.requirements/requirements.txt b/.requirements/requirements.txt index 316f1e3be..843e731b7 100644 --- a/.requirements/requirements.txt +++ b/.requirements/requirements.txt @@ -16,7 +16,7 @@ beautifulsoup4==4.12.2 ; python_version >= "3.10" and python_version < "4.0" bitarray==2.8.1 ; python_version >= "3.10" and python_version < "4" blurhash==1.1.4 ; python_version >= "3.10" and python_version < "4.0" browser-cookie3==0.19.1 ; python_version >= "3.10" and python_version < "4.0" -ccxt==4.0.53 ; python_version >= "3.10" and python_version < "4.0" +ccxt==4.0.54 ; python_version >= "3.10" and python_version < "4.0" certifi==2023.7.22 ; python_version >= "3.10" and python_version < "4.0" cffi==1.15.1 ; python_version >= "3.10" and python_version < "4.0" charset-normalizer==3.2.0 ; python_version >= "3.10" and python_version < "4.0" @@ -26,7 +26,7 @@ cryptography==41.0.3 ; python_version >= "3.10" and python_version < "4.0" curl-cffi==0.5.7 ; python_version >= "3.10" and python_version < "4.0" cytoolz==0.12.2 ; python_version >= "3.10" and python_version < "4" and implementation_name == "cpython" decorator==5.1.1 ; python_version >= "3.10" and python_version < "4.0" -dxsp==4.2.10 ; python_version >= "3.10" and python_version < "4.0" +dxsp==4.2.11 ; python_version >= "3.10" and python_version < "4.0" dynaconf==3.2.0 ; python_version >= "3.10" and python_version < "4.0" emoji==2.7.0 ; python_version >= "3.10" and python_version < "4.0" eth-abi==4.1.0 ; python_version >= "3.10" and python_version < "4" @@ -56,7 +56,7 @@ html5lib==1.1 ; python_version >= "3.10" and python_version < "4.0" httpcore==0.17.3 ; python_version >= "3.10" and python_version < "4.0" httpx==0.24.1 ; python_version >= "3.10" and python_version < "4.0" hyperframe==6.0.1 ; python_version >= "3.10" and python_version < "4.0" -iamlistening==3.3.1 ; python_version >= "3.10" and python_version < "4.0" +iamlistening==3.3.2 ; python_version >= "3.10" and python_version < "4.0" idna==3.4 ; python_version >= "3.10" and python_version < "4.0" iso8601==2.0.0 ; python_version >= "3.10" and python_version < "4.0" jeepney==0.8.0 ; python_version >= "3.10" and (sys_platform == "bsd" or sys_platform == "linux") and python_version < "4.0" @@ -125,7 +125,7 @@ six==1.16.0 ; python_version >= "3.10" and python_version < "4.0" sniffio==1.3.0 ; python_version >= "3.10" and python_version < "4.0" soupsieve==2.4.1 ; python_version >= "3.10" and python_version < "4.0" starlette==0.27.0 ; python_version >= "3.10" and python_version < "4.0" -talkytrend==1.12.11 ; python_version >= "3.10" and python_version < "4.0" +talkytrend==1.13.0 ; python_version >= "3.10" and python_version < "4.0" telethon==1.29.2 ; python_version >= "3.10" and python_version < "4.0" tinode-grpc==0.22.3 ; python_version >= "3.10" and python_version < "4.0" toml==0.10.2 ; python_version >= "3.10" and python_version < "4.0" From 3488c4ba60bb105db3ae48bd59413dc0fb44e0ed Mon Sep 17 00:00:00 2001 From: mraniki Date: Tue, 8 Aug 2023 20:47:05 +0200 Subject: [PATCH 7/9] :bug: :white_check_mark: Unit Test --- tests/test_dex_exchange_plugin.py | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/tests/test_dex_exchange_plugin.py b/tests/test_dex_exchange_plugin.py index e2ae1bc83..119c542f8 100644 --- a/tests/test_dex_exchange_plugin.py +++ b/tests/test_dex_exchange_plugin.py @@ -27,16 +27,6 @@ def test_fixture_plugin(): def test_dynaconf_is_in_testing_env_DEX56(): print(settings.VALUE) assert settings.VALUE == "On Testing DEX_56" - assert settings.dex_wallet_address == "0x1234567890123456789012345678901234567899" - - -# @pytest.mark.asyncio -# async def test_listener_discord(): -# print(settings.VALUE) -# listener_test = Listener() -# print(listener_test) -# assert listener_test is not None -# assert isinstance(listener_test, iamlistening.main.Listener) @pytest.mark.asyncio From 3754910eb550884cc575fbb458ad1d0facdca083 Mon Sep 17 00:00:00 2001 From: mraniki Date: Tue, 8 Aug 2023 20:54:04 +0200 Subject: [PATCH 8/9] :memo: --- docs/plugins/cex.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/plugins/cex.rst b/docs/plugins/cex.rst index 6386abd68..baf245cfe 100644 --- a/docs/plugins/cex.rst +++ b/docs/plugins/cex.rst @@ -11,5 +11,7 @@ User Guide Module Reference ================ -:doc:`tt.plugins.default_plugins.cex_exchange_plugin` +.. automodule:: tt.plugins.default_plugins.cex_exchange_plugin + :members: + :undoc-members: From 8581b46bd30beca2eb01fe95a2020aa2d8fe9abf Mon Sep 17 00:00:00 2001 From: mraniki Date: Tue, 8 Aug 2023 21:03:37 +0200 Subject: [PATCH 9/9] :memo: improve documentation --- docs/03_module.rst | 16 +++++++++++----- docs/plugins/helper.rst | 11 ++++------- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/docs/03_module.rst b/docs/03_module.rst index 505583248..ddf3b5511 100644 --- a/docs/03_module.rst +++ b/docs/03_module.rst @@ -2,6 +2,11 @@ TalkyTrader =========== +.. automodule:: tt.bot + :members: + :undoc-members: + + API EndPoint ============ @@ -52,11 +57,9 @@ Plugins are the core of Talky Trader, they are loaded at startup and are used to interact with the trading platform. -.. toctree:: - :maxdepth: 2 - - plugins - +.. automodule:: tt.plugins + :members: + :undoc-members: TalkyTrader Module Reference @@ -68,3 +71,6 @@ TalkyTrader Module Reference :recursive: tt + + + diff --git a/docs/plugins/helper.rst b/docs/plugins/helper.rst index 88d93f00c..da4c7f2c5 100644 --- a/docs/plugins/helper.rst +++ b/docs/plugins/helper.rst @@ -5,12 +5,6 @@ helper Provide multiple function such as giving the list of available command, network ping or restarting the bot -.. toctree:: - :maxdepth: 2 - - plugins/helper - - Function ===== @@ -38,4 +32,7 @@ Restart Module Reference ================ -.. automodule::tt.plugins.default_plugins.helper_plugin \ No newline at end of file +.. automodule:: tt.plugins.default_plugins.helper_plugin + :members: + :undoc-members: + \ No newline at end of file