GithubHelp home page GithubHelp logo

fundingrate / tradingview-webhooks Goto Github PK

View Code? Open in Web Editor NEW
52.0 3.0 23.0 145 KB

Backend service converting tradingview alerts into action.

Home Page: https://fundingrate.io

License: Apache License 2.0

Dockerfile 0.35% JavaScript 99.65%
tradingview webhooks bot code bot-framework tradingview-listener exchange-orders notifications alerts trading

tradingview-webhooks's Introduction

Tradingview-Webhooks

A simple service converting tradingview webhooks into exchange orders. Once running, the end user is able to submit commands via http. This tool was made so I could concurrently test multiple alert/signal stratagies using live market data. We now offer a hosted version at Fundingrate.io.

Software Dependancies

Below are the required software dependancies.

.env

The .env contains all the app's configuration details.

  name=api
  port=9001

  # database
  rethink.db=tradingview
  rethink.host=localhost
  # rethink.port=32769
  # rethink.user=
  # rethink.password=

  # bitmex api key
  bitmex.key=
  bitmex.secret=

  # bybit api key
  bybit.key=
  bybit.secret=

Install & Run

Install the dependancies and startup the app.

npm install
npm run api

TradingView Event Format

Below is the format the bot expects.

  • type - The event position type.
  • provider - Defined name for the event.
  • timeframe - Timeframe the event is listening to.
{
  "token": "4432424-d9b3-433d-9388-19650eb7bf2a",
  "type": "LONG",
  "condition": "Whale",
  "description": "Price can still go up",
  "provider": "Market Liberator A",
  "timeframe": "5m"
}

Setup Tutorial

Below is a short tutorial on how to setup the app.

  1. Clone the repository.
  2. Create a .env file (example above.).
  3. Configure the app.
  4. install and run.
  5. Point a domain to the app.
  6. Input that domain into tradingview.
  7. Create events using the format.

HTTP Interface

Below is an example of how to use the http interface exposed by the app.

import axios from 'axios'
import assert from 'assert'

export default async baseURL => {
  const api = axios.create({
    baseURL,
    transformResponse: [
      function(data) {
        return JSON.parse(data)
      },
    ],
  })
  const { data } = await api.get('/')
  console.log(data)
  return data.reduce(
    (memo, action) => {
      return {
        ...memo,
        [action]: async params => {
          const { data } = await api.post(`/${action}`, params)
          console.log(action, params, data)
          return data
        },
      }
    },
    {
      _api: api,
      _post: async (endpoint, params) => {
        const { data } = await api.post(endpoint, params)
        return data
      },
      _get: async (endpoint, params) => {
        const { data } = await api.get(endpoint, params)
        return data
      },
    }
  )
}

Actions

Below is a list of the available api endpoints.

echo(params)

returns back whatever is posted to it.

  • params - optional params.

ping()

returns 200 ok message.

me({token})

returns the user valided by the token.

  • token - a user token.

getTicker()

returns the current bybit ticker information.

registerUsername({username})

returns user token and creates userid.

  • username - desired username.

listUsers()

list all registered users.

listTraders()

list all users who are active traders.

consumeEvent({token, ...params})

returns the created event.

  • token - a user token.
  • params - optional event params.

listMyTrades({token})

returns list of created trades.

  • token - a user token.

getMyStats({token})

list my current trade stats.

  • token - a user token.

listMyTokens({token})

list all my created tokens.

  • token - a user token.

listEventProviders({token})

list all event providers and count of events.

listUserEventProviders({token})

list all event providers and count of events from each userid.

createSubscription({userid, token})

Subscribe to a provider

  • token - a user token.
  • userid - provider name (indicator name)

listMySubscriptions({token})

list all your subscriptions.

  • token - a user token.

license

license zero parity and apache 2.0 (contributions)

tradingview-webhooks's People

Contributors

tacyarg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

tradingview-webhooks's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.