Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 typo in docs #644

Merged
merged 12 commits into from
Aug 8, 2023
4 changes: 2 additions & 2 deletions .requirements/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.12 ; python_version >= "3.10" and python_version < "4.0"
findmyorder==1.7.13 ; 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"
Expand Down Expand Up @@ -111,7 +111,7 @@ pyunormalize==15.0.0 ; python_version >= "3.10" and python_version < "4.0"
pywin32==306 ; python_version >= "3.10" and python_version < "4.0" and platform_system == "Windows"
pyyaml==6.0.1 ; python_version >= "3.10" and python_version < "4.0"
referencing==0.30.2 ; python_version >= "3.10" and python_version < "4.0"
regex==2023.6.3 ; python_version >= "3.10" and python_version < "4"
regex==2023.8.8 ; python_version >= "3.10" and python_version < "4"
requests-oauthlib==1.3.1 ; python_version >= "3.10" and python_version < "4.0"
requests==2.31.0 ; python_version >= "3.10" and python_version < "4.0"
revolt-py==0.1.11 ; python_version >= "3.10" and python_version < "4.0"
Expand Down
4 changes: 3 additions & 1 deletion docs/01_start.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,18 @@ Exchange Credentials
====================

Get your DEX or CEX credentials:

- DEX wallet address and private key: :doc:`talky:plugins/dex`

- CEX API Keys: :doc:`talky:plugins/cex`


Setup your config
=================

Create your config file settings.toml or use env variables.
Refer to :doc:`talky:02_config` for details.

example:

.. literalinclude:: ../examples/example_settings.toml

Expand Down
7 changes: 2 additions & 5 deletions docs/02_config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ Config will load:
- 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 :file:`/app/settings.toml` or :file:`/app/.env` for docker.
If deployed locally, place your file in :file:`/tt/` folder.
Settings.toml or .env can be located in :file:`/app/settings.toml` or :file:`/app/.env` for docker.
If deployed locally, place your file in :file:`/tt/` folder.


Talky Settings
Expand All @@ -45,7 +45,6 @@ Settings Example

Settings.toml
-------------
example:

.. literalinclude:: ../examples/example_settings.toml
:linenos:
Expand All @@ -54,8 +53,6 @@ example:
.env or ENV VARS
------------------

place the .env at

.. literalinclude:: ../examples/example.env
:linenos:

51 changes: 15 additions & 36 deletions docs/03_module.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,65 +5,42 @@ TalkyTrader
.. automodule:: tt.bot
:members:
:undoc-members:


API EndPoint
============

Talky Trader is an app built with FastAPI https://fastapi.tiangolo.com
It allows you to connect to a messaging chat platform to interact with
trading module.

HealthCheck
-----------

End point to know if the API is up and running

.. autofunction::tt.bot.health_check

Webhook
-------

Webhook endpoint to send your trade generated via http://tradingview.com
or anyother platform you work with.
Endpoint is :file:`/webhook/{settings.webhook_secret}` so in trading view you can add:
https://talky.trader.com/webhook/123456

.. autofunction::tt.bot.webhook

Startup
-------

Starting the coroutine run_bot

.. autofunction::tt.bot.start_bot_task


iamlistening
============

:doc:`iamlistening:index`

.. autoclass:: iamlistening.main.Listener
:members:
:undoc-members:

FindMyOrder
===========

:doc:`findmyorder:index`

.. autoclass:: findmyorder.main.FindMyOrder
:members:
:undoc-members:


Plugins
=======

Plugins are the core of Talky Trader, they are loaded at startup and
are used to interact with the trading platform.


.. automodule:: tt.plugins
.. automodule:: tt.plugins.plugin_manager
:members:
:undoc-members:


TalkyTrader Module Reference
=====================
TalkyTrader Module
==================


.. autosummary::
:toctree: _autosummary
Expand All @@ -72,5 +49,7 @@ TalkyTrader Module Reference

tt





26 changes: 5 additions & 21 deletions docs/development/index.rst
Original file line number Diff line number Diff line change
@@ -1,30 +1,14 @@
====================
Build your own Plugin
=====================


You can fork this repo or you can use the current repo and add your own plugins


=================
Community Plugins
=================


:doc:`community:index`

Build Your Plugin
=================

Build Plugin
============


.. literalinclude:: ../tt/plugins/default_plugins/example_plugin.py



Use your Plugin
===============

Plugin example:

:doc:`community:index`
.. literalinclude:: ../../tt/plugins/default_plugins/example_plugin.py
:linenos:

32 changes: 2 additions & 30 deletions docs/plugins/helper.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,9 @@
helper
=====

Provide multiple function such as giving the list of
available command, network ping or restarting the bot

Function
=====

Help
----

:file:`/help` command to return the list of available command

Trading Switch
--------------

:file:`/trading` command to turn off or on the trading capability

Network
-------

:file:`/network` command to retrieve the network ping latency and IP of the bot

Restart
--------

:file:`/restart` command to restart the bot


Module Reference
================

.. automodule:: tt.plugins.default_plugins.helper_plugin
:members:
:undoc-members:



25 changes: 23 additions & 2 deletions tt/bot.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
"""
TalkyTrader 🪙🗿
====================
================

Bot Launcher and API

Talky Trader is an app
built with FastAPI
https://fastapi.tiangolo.com

It allows you to connect
to a messaging chat platform
to interact with trading module.

"""

import asyncio
Expand Down Expand Up @@ -36,7 +46,10 @@ async def root():

@app.get("/health")
async def health_check():
""" health check """
"""
End point to know if
the API is up and running
"""
return __version__


Expand All @@ -45,6 +58,14 @@ async def webhook(request: Request):
"""
Webhook endpoint to receive webhook requests
with option to forward the data to another endpoint.
Webhook endpoint to
send order signal generated
via http://tradingview.com
or anyother platform.
Endpoint is
:file:`/webhook/{settings.webhook_secret}`
so in trading view you can add:
https://YOURIPorDOMAIN/webhook/123456
"""
data = await request.body()
await send_notification(data)
Expand Down
8 changes: 5 additions & 3 deletions tt/config.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
"""
TalkyTrader Config
Used for Logging, Scheduleing and Settings
TalkyTrader Config
Used for Logging,
Scheduleing and Settings
🧐⏱️⚙️

"""

import logging
Expand All @@ -13,7 +15,7 @@
from loguru import logger as loguru_logger

########################################
### ⚙️ Settings ###
### ⚙️ Settings ###
########################################

ROOT = os.path.dirname(__file__)
Expand Down
2 changes: 1 addition & 1 deletion tt/plugins/default_plugins/example_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#from myclass import MyClass


class ExamplePlugin(BasePlugin):
"""Example Plugin
Initialization of imported class MyClass
Expand Down
43 changes: 36 additions & 7 deletions tt/plugins/default_plugins/helper_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,14 @@


class HelperPlugin(BasePlugin):
""" Helper Plugin """
"""
Helper Plugin
Provide multiple function
such as giving the list of
available command, network ping
or restarting the bot

"""
name = os.path.splitext(os.path.basename(__file__))[0]
def __init__(self):
super().__init__()
Expand Down Expand Up @@ -53,31 +60,53 @@ async def handle_message(self, msg):
await self.send_notification(f"{await function()}")

async def get_helper_help(self):
"""Help Message"""
"""
Help Message
:file:`/help` command to
return the list of
available command
"""
return f"{self.help_message}"

async def get_helper_info(self):
"""Help Message"""
"""
return
TalkyTrader version
"""
return self.version

async def get_helper_network(self):
"""Help Message"""
"""
:file:`/network` command to retrieve the network
ping latency and
the bot IP address
"""
ping_result = ping3.ping(settings.ping, unit='ms')
ping_result = round(ping_result, 2) if ping_result is not None else 0
return (f"️{self.host_ip}\n"
f"🏓 {ping_result}\n")

async def trading_switch_command(self):
"""Trading switch command"""
"""
Trading switch command
:file:`/trading` command
to turn off or on the
trading capability
"""
settings.trading_enabled = not settings.trading_enabled
return f"Trading is {'enabled' if settings.trading_enabled else 'disabled'}."

async def restart(self):
"""Restart Bot """
"""
:file:`/restart` command
to restart the bot
"""
os.execl(sys.executable, os.path.abspath(__file__), sys.argv[0])

def get_host_ip(self):
"""Returns host IP """
"""
Returns bot IP
"""
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect((settings.ping, 80))
ip_address = s.getsockname()[0]
Expand Down
Loading