tvbit-bot

module
v1.8.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 28, 2022 License: AGPL-3.0

README

tvbit-bot

lint

tvbit-bot is TradingView webhook handler for Bybit.

tvbit = T(rading)V(iew) (By)bit

Twitter @rarirureluis

Introduction

  1. First of all, register you account. See PUT /setting
  2. Enable Webhook https://<domain>/tv
  3. Set an alert with webhook and a message as JSON like below:
{
  "is_test_net": true,
  "api_key": "",
  "api_secret_key": "",
  "order": {
    "name": "alert name, description or something",
    "symbol": "BTCUSDT",
    "type": "Market",
    "price": 0, // If type is "Limit" set it as an int greater than 0
    "side": "Buy",
    "qty": 0.014,
    "tp": "0", // see below
    "sl": "{{high}}" // see below
  }
}
TP and SL

You need to set tp and sl as a string.

  • {{high}} is an embedded value of TradingView, Also you can set any other TradingView's embedded values.
  • Other methods, you can set as a percent like "tp": "10%" calculate from mark price.
  • "tp": "+40", "sl": "-20" means, TP: mark price + 40 and SL: mark price - 20.

see tv.go or Bybit API Documentation .

Path

Path Method Description
/tv POST Create order
/setting PUT Update your setting
/setting GET Get your setting
/wallet GET Get your wallet balance
PUT /setting

Register your account.

Why you have to register an account?
tvbit-bot fetch your wallet balance and save it to DB. cron.go

Request body
{
  "is_testnet": true,
  "cex": "bybit", 
  "api_key": "",
  "api_secret_key": "",
  "max_position": 0,
  "start_time": "09:00",
  "stop_time": "23:00"
}
  • cex must be lowercase.
  • max_position is how many active position you have
  • start_time end_time is optional.
[WIP] GET /setting

Get your setting.

Response
{
  "api_key": "",
  "api_secret_key": ""
}

Setup

You can change listen port with PORT environment variable.

Docker

ghcr.io/rluisr/tvbit-bot:latest

Binary

Release page.

MySQL

tvbit-bot requires MySQL for storing user setting and wallet balance histories.

Set these environment variables:

  • MYSQL_HOST_RW
  • MYSQL_HOST_RO
  • MYSQL_USER
  • MYSQL_PASS
  • MYSQL_DB_NAME

tvbit-bot.hcloud.ltd

URL: https://tvbit-bot.hcloud.ltd/tv

I am offering this application for public use. But I am sure that I may betray you. You may use it for production operation, or you may try it only for testing.

Powered by HCloud Ltd

Terms of service

I accept no responsibility whatsoever.

Limitation

tvbit-bot does not support to close/cancel positions now.

Welcome your PR.

Twitter @rarirureluis

TODO

There are no plans to support bybit/options/spot trading and other CEX.

  • [bybit/core] Futures
  • [bybit/core] USDC
  • [bybit/wallet] Deriv
  • [bybit/wallet] USDC
  • [core/binance]

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL