Giter VIP home page Giter VIP logo

bitter's Introduction

OK.Bitter

OK.Bitter is developed to listen Binance crypto currency symbol websockets and when price is changed that less/more than users' specified treshold, send message via Telegram Bot or call via IFTTT Voice Call.

The Structure

Basically, there is an api named "OK.Bitter.Api". The api has bot commands to manage Telegram Bot messages that user sent with webhook and has two hosted service that running in background.

First hosted service SymbolHostedService runs every 30 minutes and updates symbols in database to get new symbols immediately. Second hosted service SocketHostedService listens Binance Websockets and decide notify or call user or do nothing.

NOTE: The project will be restructured using microservice architecture. Development will be in restructured-microservice branch and 'Restructure with Microservice Architecture' issue.

The Scenario

  1. Api starts, bot webhook is up and hosted services are running in background.
  2. User joins the Telegram Bot that your bot created using Telegram BotFather from Telegram Mobile App.
  3. User sends command '/auth password' to bot. If password is 'normal!123' then user will be created as Normal User, if password is 'admin!123' then user will be created as Admin User. Otherwise user cannot be notified for any price change.
  4. User sends command '/subscriptions set ETH|BTC 1.0' to take message for every 1.0 percent price change for ETH coin.
  5. When user sends the subscribe command to bot, Telegram sends the message to our api and our api receives the request. Api stores the subscription in database and tells 'Hey, the user wants to take a notification when the ETH|BTC coin's every 1.0 percent changes' to socket hosted service.
  6. When the subscription changes are performed on Binance market. Our hosted service takes it from websocket and sends a message the user via Telegram Bot.
  7. User sends command '/alerts set BTC|USDT less 3500 greater 4000' to take a voice call for the specified bounds.
  8. When user sends the alert command to bot, Telegram sends the message to our Webhook api and our api receives the request. Api stores the alert in database and tells 'Hey, the user wants to take a alert when the BTC|USDT coin's price is not between $3500 and $4000 prices' to socket hosted service.
  9. When the BTC|USDT price is not between $3500 and $4000, Our hosted service takes it from websocket and sends a request to IFTTT api to make a voice call that contains 'Hey, BTC price is $4001.'.

How to Use

  1. Create a Telegram Bot using Telegram BotFather. The BotFather give you a bot token. Keep it and write to ServiceConfigurations.TelegramService.BotToken property in 'src\OK.Bitter.Api\appsettings.json' file. For more information about creating Telegram Bot, go to official telegram documentation site.
  2. Create a MongoDB database and copy your database connection string. Write to MongoConfigurations.ConnectionString property in 'src\OK.Bitter.Api\appsettings.json' file.
  3. Open the CMD or Bash. Change directory to 'src\OK.Bitter.Api'.
  4. Run the dotnet run command. And now your service listens sockets and notifies you via the Telegram Bot.
  5. When you deploy the api to your server with a domain, you should update your Telegram Bot webhook endpoint as 'your_domain_com/api/bot/update' using Telegram BotFather commands.
  6. Enjoy!

bitter's People

Contributors

oguzhankiyar avatar

Stargazers

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

Watchers

 avatar

bitter's Issues

Restructure with Microservice Architecture

Restructure with Microservice Architecture

Separate the OK.Biter.Api project to three or more microservice like BotCommandService, ListenerService, NotifyService.

BotCommandService

Responsible to manage Telegram Bot commands to list/create/update/delete subscriptions, alerts, prices, etc. and send subscription/alert updates to Message Queue.

ListenerService

Responsible to listen Binance Api WebSockets and send the prices to Message Queue.

NotifyService

Responsible to consume the Message Queue and decide to notify the users with messaging or calling.

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.