This is a fork repository of the unofficial Python client for the Coinbase Advanced Trade API Fork. The Coinbase Advanced Trade Api will allow you to interact with coinbase advanced trading plateform and in this repository a layer was added in order to add basic functionalities and send command via a telegram chat bot.
I've developed this small telegram bot using this Coinbase wrapper to suit my needs and I will not continue developing new feature. I've already updated everything, also created a dockerfile that you can build and run directly, so don't expect me to answer issues or pull requests. Feel free to fork it and work on it as you want add new features and so on.
- Telegram bot, based on the Conbaise Advanced Trade API wrapper.
- Send command to bot to do action directly on Coinbase advanced trading plateform
- Possibility to create Reccuring buy order (DCA)
- create new bot command to match other API endpoint
- update /setDCA command to accept specific days and specific hours
- Update documentation to self host using docker or linux host (in progress)
-
Clone this repository
git clone https://github.com/thomaslc66/coinbase-advancedtrade-python.git
-
Install the required Python packages:
pip install -r requirements.txt
-
Set your CoinBase API key and secret in config.py. To obtain your API key and secret, follow the steps below:
- Log in to your Coinbase account.
- Navigate to API settings.
- Create a new API key with the appropriate permissions.
-
Create a telegram bot and retrive the token for that: https://core.telegram.org/bots/features#creating-a-new-bot
- start a chat with @BotFather
- send
/newbot
- then follow instruction and give your bot a name
- then follow instruction and select a username for your bot
- @BotFather will answer you and give you the token : :<random_letter_and_number>
- Copy that token in .env or .env.docker
- if needed
/help
to see what you can do
-
Edit .evn.to.edit with all your API
- Copy the Coinbase API key and secret to .env.to.edit and rename it as .env.
- Copy your Telegram Bot Token and save
- This file will be loaded and API KEY will not be exposed
-
Run it :
python main.py
Here's an example of how to use the repository: After cloning the repostitory you will have two files to edit.
all api key need to be between " "
# Set your API key and secret
API_KEY="api_key_example"
API_SECRET="api_secret_example"
TELEGRAM="telegram_bot_token_example"
rename the file from .env.to.edit to .env
Then you can call:
python main.py
all api key need to be without the " " and without space in order for it to work in docker
# Set your API key and secret
API_KEY=api_key_example
API_SECRET=api_secret_example
TELEGRAM=telegram_bot_token_example
Then build and run the image like that:
passing the .env.docker as env file
docker build . -t coinbase-telegram
docker run --env-file ./.env.docker coinbase-telegram
/listAccounts
/buyBTC Currency Amount
Example: /buyBTC EUR 10 -> Buy BTC for 10 EUR
Same as market order just set a price variable
/buyBTC Currency Amount Price
Example: /buyBTC USD 0.0004 15000 -> Place a limit order to buy 0.0004 BTC when price hit 15000 USD
/setDCA <job_name> <currency> <amount>
Example: /setDCA MY_DCA_JOB_NAME EUR 10 -> Place a daily market order for 10 EUR worth of Bitcoin
Then when order will be send at 12:30
/setDCA <job_name> <currency> <amount>
Example: /setDCA MY_DCA_JOB_NAME USD 0.0004 15000 -> Place a daily limit order to buy 0.0004 BTC when price hit 15000 USD
/unsetDCA <job_name>
/listJobs
/help
For more information about the Coinbase Advanced Trader API, consult the official API documentation.
This project is licensed under the MIT License. See the LICENSE file for more information.
Coinbase advanced repo: Rhett Reisman
Fork and modification with telegram bot: @thomaslc66
GitHub: https://github.com/thomaslc66/coinbase-advancedtrade-python
This project is not affiliated with, maintained, or endorsed by Coinbase. Use this software at your own risk. Trading cryptocurrencies carries a risk of financial loss. The developers of this software are not responsible for any financial losses or damages incurred while using this software.