Statement 1: I have been working in the new company. I will take the time to update some descriptive things here so that everyone can compile, build, and develop
Statement 2: The APP source code and the trading robot source code are not open source (provided for a fee), if necessary, email: [email protected]
This project is a bitcoin exchange based on Java (SpringCloud) | BTC exchange | ETH exchange | digital currency exchange | trading platform | matching trading engine. This project is based on the development of Spring Cloud microservices, which can be used to build and secondary development digital currency exchanges, and has a complete system component.
Just draw a few sketches, just look at it。。。
PC front end (user web end)：https://gitee.com/cexchange/CoinExchange/attach_files
Development Reference Document：https://gitee.com/cexchange/CoinExchange/blob/master/DEVELOP.md
Manage background screenshots：https://gitee.com/cexchange/CoinExchange/tree/master/09_DOC/管理后台截图
If you want to build an exchange system on your computer or cloud server, I have prepared some basic deployment manuals. Of course, installing software on linux/unix is not a simple matter. You need to have a certain Linux basics and command line skills, but also the courage and patience to solve problems, I wish you success!
Spring Cloud is an ordered collection of frameworks. It uses Spring Boot's development convenience to subtly simplify the development of distributed system infrastructure, such as service discovery registration, configuration center, message bus, load balancing, circuit breaker, data monitoring, etc., can be done using Spring Boot's development style One click to start and deploy. Spring Cloud does not repeat the manufacturing of wheels. It just combines the mature and practical service frameworks developed by various companies. The re-encapsulation through the Spring Boot style shields the complex configuration and implementation principles, and finally gives the development The author has left a set of distributed system development kits that are simple to understand, easy to deploy, and easy to maintain. In general, a complete Spring Cloud framework should be as shown in the following figure:
If you are unfamiliar with Spring Cloud, you can simply learn about Spring Cloud related tutorials first, so that you will come back to this project and it will be easier to get started. As a reminder, because the Springcloud framework diagram is a complete architecture, we will tailor some content appropriately during development to make development and deployment faster, so there are some discrepancies.
The system uses memory matching for the transaction queue, Kafka is used for matching order information transmission, MongoDB persists the order transaction details, and MySQL records the overall order transaction. Among them, the 01_Framework/Exchange project is mainly responsible for memory matching, and the 01_Framework/Market project is mainly responsible for order transaction persistence, market generation, market push and other services, including:
Modes supported by memory matching transactions
Limit & Market Order Processing Logic
Other features supported by match engine
In addition to the ordinary matching functions of limit and market prices, the matching trading engine of this system also introduces an active transaction mode. By setting the trading start time, initial issuance volume, initial issuance price, and activity of trading pairs (such as BTC/USDT) Modes and other parameters can formulate a wealth of matching transaction modes to meet different matching modes.
The exchange is expected to launch the trading pair AAA/USDT at 12:00:00 on August 8, 2020, but as a newly launched currency, how can it work without activity? The project party or the exchange decided to come up with 10,000 AAA at a price of 0.0001USDT (market price: 0.0005) for everyone to snap up. The system supports the setting of such activities.
In addition, if the project party or the exchange decides to take out 10,000 AAAs to issue at the price of 0.0001USDT, I don’t want everyone to snap up, but hope that all users who recharge USDT can divide 10,000 AAAs on average. This system also supports the setting of this activity .
to sum up
n short, this system supports a highly customized matching mode. At the same time, you can also develop your own matching transaction mode, just by modifying the matching logic in the Exchange project.
This was done for the customer, but later the customer stopped operating, so this website was left, because I don’t have server permissions, so this website may not be accessible at any time.
Building a test site requires purchasing several cloud servers, which cost a lot, so I did not set up a test station myself, but the system is complete and has passed the commercial and practical operation test for nearly a year.
About trading robots
Trading robots are automatic trading programs that can automatically trade based on external market conditions, so that the exchange's trading pair prices are consistent with the external, preventing losses caused by some users "moving bricks".
└─———admin Background management API
└─———bitrade-job Task management（Empty）
└─———chat OTC Chat
└─———cloud SpringCloud Eureka
└─———exchange match trading
└─———exchange-api order API
└─———exchange-core order core
└─———jar Other lib
└─———market market API、K-line service
└─———otc-api OTC trade API
└─———otc-core OTC core
└─———sql SQL script
└─———ucenter-api user API
This digital currency trading system is a project developed by my company for an exchange. The exchange has ceased operations due to team reasons, and our company was disbanded in February. Since I participated in the project, I was responsible for overall R&D management, architecture design and customer docking, so I mastered all the codes.
There are some places that need special attention in the use of the function of this system, such as other operations after the new transaction pair, improper operation will cause data disorder errors.
I can provide paid technical assistance and use training guidance!
When the memory is insufficient, enter top in the Linux console to view the java process occupies a lot of memory (a java process occupies more than 1G), because there are many jar packages to run, so you need to control the memory used by certain jar packages, you can choose A few less resource intensive projects are as follows:
java -jar -Xms128m -Xmx128m -Xmn200m -Xss256k admin-api.jar java -jar -Xms512m -Xmx512m -Xmn200m -Xss256k cloud.jar java -jar -Xms512m -Xmx512m -Xmn200m -Xss256k wallet.jar
Some reported that there is no complete SQL file. This is because the successfully compiled Jar will automatically map the Entity to a database structure after the first run. The SQL in the project only completes some database structures that Springcloud cannot complete. The automatic database configuration is located in the application.properties configuration file:
spring.jpa.hibernate.ddl-auto=update This configuration will automatically update the database structure.
- [x] 6-1. First launch panic buying activity mode (for example, when issuing a new trading pair, a certain number of currencies can be set on the trading pair for panic buying)
- [x] 6-2. The first distribution mode of activity (for example, before issuing the BTC/USDT trading pair, the official took out 5BTC for the activity, and divided the BTC equally according to how much USDT the user recharged mortgaged)
- [x] 6-3. Panic buying mode (for example, before the ZZZ/USDT trading pair is issued, the ZZZ currency price is 5USDT, and the official issuance activity price is 0.5USDT, you can use this mode)
- [x] 6-4. Control panel sharing mode (such as 6-3, only average distribution)
- [x] 6-5. Mining machine activity mode (support users to mortgage a certain amount of currency, and the official promise to return a certain amount of currency every month)
This project provides two wallet docking methods, one is self-built node + blockchain browser, and the other is third-party wallet docking. If you want to use a self-built node or blockchain browser, you can directly compile the code in 00_framework. If you want to use a third-party wallet for docking, you can download the project files of the YouDun wallet in the 07_Uduncloud folder and copy them to 00_framework.
After you get the code, you can not connect the blockchain nodes during the debugging and running of this project, which will not have much impact; even if you do not connect the blockchain nodes, you can deploy one of them with matching transaction function Trading platform (just that users cannot recharge their wallet addresses).
When you are gradually familiar with the entire system, and have a certain basic reserve of blockchain operation principles, node construction, and blockchain browser, you can start to study the projects under the 01_wallet_rpc folder. Each currency corresponds to different data access methods. Most blockchain projects have the same or very similar wallet operation methods. For example, Bitcoin derivatives such as BTC, LTC, BCH, BSV, BCD, etc., have almost the same API operations. The same; another example is ETH, when you master the operation of a contract currency, the operation of other digital currencies based on ETH is almost the same. So, basically when you spend time understanding one, you understand a bunch of currencies.
The wallet operation scheme used in this project is also different, and as far as possible to show you different usages:
Generally speaking, when the amount of funds exchanged by the exchange is not large, you can explore it yourself, but when the amount of funds exchanged is large, if you are not confident about operating your wallet, you can also use a third-party wallet service Of course, this requires you to negotiate with the wallet service provider to pay an annual fee or something.
The following figure is a brief explanatory diagram of the user recharge monitoring logic, just take a look at it:
Anyone who uses this source code to engage in commercial activities and causes losses to others and himself is not responsible for me!