Telegram bot to automate a cryptocurrency exchanger

Instead of a preface

In this article, I will outline in general terms the direction in which to move in order to create a semi-automatic cryptocurrency exchanger with the ability to manage transactions from any device anywhere in the world 24/7. You won't find implementation details here, since rather, this material is intended to provide the basic knowledge needed to launch such a startup.





Semi-automatic cryptocurrency exchanger.

Once upon a time, I wrote a little about the use of a telegram bot to automate some processes. I must say that a lot of time has passed, but I continue to use some of the ideas that were presented in that little material.





The exchange of cryptocurrency today is no longer just a reality, to some extent it is already a need. Time is ruthless and now digital gold is becoming a very important part of the assets of millions of people. There are several types of exchangers on the Internet, the main of which are:





  • semi-automatic





  • manual





  • automatic





  • p2p - exchangers





  • exchanges





We will talk about a semi-automatic option with the ability to expand to a p2p exchanger, because this is a fairly simple and convenient way.





Required skill set.

, . , , , . , . :





  1. Linux, zsh, vim, systemd







  2. nginx, ssl







  3. ES6, Material Ui, React, eslint, webpack, scss







  4. python3, asyncio, aiohttp, peewee







  5. postgresql







  6. telegram bot api







  7. docker







:





  1. MVC



    -





  2. Abstract Factory, Factory Method, Builder, Facade, Prototype



    -





  3. Scheduler



    -





  4. Event Listner, State



    - ,





  5. Proxy



    -





, , . , , .





- , , , - . .. , , , : . , ( ) - ?





, . - , , . Single Page Application, , json-rpc



. tcp,



http.







. Node Package Manager



, , react router,



eslint



, node-sass



css



, webpack



.





- . - . stateless. redux



- , .





, , . , react



material ui



. - , , - .





, :





- ,

. P2P , , . , . , , .





asyncio



, . , . BTC/USD USD/RUB, , . get



, coinbase, kraken, bitmex. aiohttp client



:





, , , - , - , , .





- BaseModel, , , created_at, updated_at , , datetime_serializer, , :





API KEY, blockchain.com. , " ". ? , , . - , . , . , . , , . . callback_url, . webhook url



. . , , . , BTC . , BTC, .





, master wallet, , . . :





, . , , ( ) blockchain.



Billing



Processing,



.





: , , , . : .





Telegram bot

. @BotFather, , , ( - , ).





, rpc



, .





, . ( ). , .





, message



callback_query



(reply inline ).





, . race condition, - , atomic_db_query







async with objects.atomic() as atomic_db_query:
	try:
  	pass  # some database change
  except:  
		atomic_db_query.rollback()
      
      



- .. , , , . , subscription



, , :





, , . 24/7 , , , :





production

, , CI-CD, .





, , ipython



:





nginx



, , mod_rewrite



.





location = /api/rates/rates.xml {
  rewrite .* /api/rates/ last;
}   
      
      



, xml , rewrite



.





- - Basic Auth



bootstrap admin template



. :





, , , , , . JWT



, SLL



, CORS



, , . , . , , . - . . , - .





I hope someone finds this information useful. I just wanted to share a bit of my experiences and experiences gained from the process.





Further development is positioned as a p2p platform for making an exchange. I would be glad to have any questions and suggestions, and thank you very much for your time.








All Articles