captnHook allows users to place trades with Tradingview's webhook alerts. The server is configurable to the most popular broker APIs (Alpaca, Binance, Coinbase, many more)
- cert A folder for housing a self-signed X.509 TLS certificate
- cmd Main application for this project
- docs Design and user documents
- pkg Library code used by the main command
Clone the project to your machine
$ https://github.com/bareish/captnhook.git
Copy the contents of .env.example and create a .env file from the contents - Then, fill in credentials that are required.
$ touch .env
$ cp .env.example .env
Directory tree should look as such:
├── .env
├── .env.example
├── Dockerfile
├── README.md
├── cmd
├── pkg
├── cert
│ ├── cert.pem
│ └── key.pem
# general configuration
MODE = dev # can be dev/prod
BASE_URL=https://0.0.0.0
PORT=8000
# Path to self-signed X.509 TLS certificate
CERT_PATH=./cert/cert.pem
KEY_PATH=./cert/key.pem
# Alpaca Credentials
ALPACA_CLIENT_ID=nicetrygithubscraper
ALPACA_CLIENT_SECRET=nicetrygithubscraper
ALPACA_ACCOUNT_TYPE=Paper
#Binance Credentials
BINANCE_CLIENT_ID=nictrygithubscraper
As simple as one command :)
$ docker-compose up
Output should look as such:
Successfully tagged captnhook_api:latest
Recreating captnhook_api ... done
Attaching to captnhook_api
api_1 |
api_1 | ____ __
api_1 | / __/___/ / ___
api_1 | / _// __/ _ \/ _ \
api_1 | /___/\__/_//_/\___/ v4.2.0
api_1 | High performance, minimalist Go web framework
api_1 | https://echo.labstack.com
api_1 | ______________________________________________
api_1 |
api_1 | ⇨ http server started on [::]:8000
- Let's create a new alert in TradingView
- You can set the condition of the alert to whatever you want
- Check the Webhook URL box and set it to your domain.
- Format your message as JSON, so the server can recognize it
Example:
{
"ticker" : "{{ticker}}",
"price" : "{{close}}",
"action": "Buy"
}
By contributing, you agree that your contributions will be licensed under its MIT License.
In short, when you submit code changes, your submissions are understood to be under the same MIT License that covers the project. Feel free to contact the maintainers if that's a concern.