Skip to content

Latest commit

 

History

History
214 lines (157 loc) · 9.25 KB

gettingstarted.md

File metadata and controls

214 lines (157 loc) · 9.25 KB

Getting Started with TradingView-Free-Webhook-Alerts

⚙️ Installation

🌻 Usage

1. Installing the Python package dependencies

To install the Python package dependencies you have to type pip install -r requirements.txt into the command prompt which already cd into the project directory.

2. ngrok Version (Local / Docker)

▶️ Tutorial Video

2.1 Extra Requirement

  • A ngrok account.
  • A pipedream account or any other workflow
  • Docker Desktop (optional) - If you want to use the Docker version. automation service.

2.2 Setup

Configuration

  1. Make a copy of the config.example.toml.
  2. Rename the copied file to config.toml.
  3. Open config.toml with any text editor you like.
  4. Set mode_traditional to false.
  5. Copy your ngrok authtoken and fill in ngrok_auth_token. img
  6. Fill in webhook_urls with your webhook service URLs.

Note

It is a good idea to test your signal or the program using a webhook test service such as webhook.site instead of using your production webhook.

  1. Save the config file.

Find API KEY and ngrok URL

Branch - Local Version
  1. Open the command prompt and cd into the project directory.
  2. Type pip install -r requirements.txt to install the Python package dependencies.
  3. Type python main.py to start the program.
Branch - Docker Version
  1. Open the command prompt and cd into the project directory.
  2. Type docker-compose build to build the docker image.
  3. Type docker-compose up to start the program. (You can close the command prompt after finishing next step.)

Warning

Your config.toml will be copied directly into the docker image. Meaning that you WILL expose your secrets to the public if you push/share the docker image to the public/others. (You should not do that.)

Note

To view the program logs, simply click the name of the tradingview-free-webhook-alerts container. (You have to do this to get the API KEY and ngrok URL.)

Note

You have to run the docker-compose build & docker-compose up command if you updated the config.toml.

Both
  1. Copy the "API KEY" and "ngrok URL" from the command prompt and paste them somewhere for later use. img
  2. Keep the program running in the background.

⚠️ Every time you start the program, you will get a new API KEY and ngrok URL. You need to update the webhook service with the new API KEY and ngrok URL.

Setting up pipedream

  1. Login to pipedream and create a new workflow.

img

  1. Select New Emails as the trigger.

img

  1. Copy the email address given by pipedream and paste it into the Email-to-SMS field in your TradingView account. (You can follow this instruction to change the Email-to-SMS email address.)
  2. In order to find out the Email-to-SMS update verification code, you need to click the event dropdown menu below the given email address and select the verification email.

img

  1. Find your verification code under steps.trigger -> event -> body -> text and paste it back into the Email-to-SMS field.
  2. Click the "Continue" button.

img

  1. Select HTTP / Webhook.

img

  1. Select Send any HTTP Request.

img

  1. Change the HTTP request method to POST.
  2. Paste the ngrok URL into the "URL" field and add /api to the end of the URL.

EG. https://12345678.ngrok.io/api

  1. Add a new header field with the name X-API-KEY and paste the API KEY into the value field.
  2. Go to the "Body" tab.

img

  1. Change the "Content Type" to application/json.
  2. Copy and paste the following KEY and VALUE pairs.
KEY VALUE
from {{steps.trigger.event.headers.from.value[0].address}}
subject {{steps.trigger.event.headers.subject}}
content {{steps.trigger.event.body.text}}
receive_datetime {{steps.trigger.context.ts}}

(order is not important)

  1. Click the "Test" button.

img

  1. If you see the message "Success", you can click the "Deploy" button.

img

  1. You are done! Now you can test your TradingView alert.

3. Traditional version

3.1 Extra Requirement

  • An IMAP available email account (eg.Hotmail, Outlook, Gmail, etc.)
    • Hotmail & Gmail have be tested and works well.

3.2 Setting up configuration

You must finish the following steps before using the program.

  1. Make a copy of the config.example.toml.
  2. Rename the copied file to config.toml.
  3. Open config.toml with any text editor you like.
  4. Fill in email_address and login_password with your email and password.
  5. Fill in imap_server_address and imap_server_port with your email server and port. (For example, if you are using Hotmail, it will be outlook.office365.com and 993, Gmail will be imap.gmail.com and 993.)
  6. Fill in webhook_urls with your webhook service URLs.
  7. Save the config file.

You can adjust other settings on your own.

Note

It is a good idea to test your signal or the program using a webhook test service such as webhook.site instead of using your production webhook.

3.3 Setting up email configuration

You must finish the following steps before using the program.

< Gmail >
  1. Enable 2-Step Verification on your Gmail account.
  2. Create an App Password for the program to use. (Please read through this article for more information.) It is recommended to choose Other (Custom name) as the app in order to make it easier to identify in the future.
  3. Fill in email_address and login_password with your email and the app password.
  4. Enable IMAP in your email account. (Please read through this article for more information.)

< OutLook/Hotmail >

You are good to go!

< Other >
  1. Enable IMAP in your email account.

4. Setting up TradingView alert

  1. Create a new alert as usual. (Fill in the Condition, Options and Expiration time fields.)
  2. Enable Send email-to-SMS / Send email and other action you want in Alert actions. If you want another email address that is different from your TradingView account, you should enable Send email-to-SMS instead of Send email.
  3. Fill in the Alert name and your webhook message in Message.
  4. Save the alert.

alt text

5. Program Deployment

Local (ngrok / traditional)

  1. Open the command prompt and cd into the project directory.
  2. Run python main.py in the command prompt.

Docker (ngrok)

  1. Open the Docker Desktop
  2. Click to the "Containers" tab.
  3. Click the "Run" button. (Inside the "Actions" column)

Warning

If you are using ngrok version (Local / Docker), you will get a new API KEY and ngrok URL every time you start the program. You need to update the webhook service with the new API KEY and ngrok URL.