viabtc / viabtc_exchange_server

A trading engine with high-speed performance and real-time notification
MIT License
2.69k stars 1.49k forks source link

Question about matching server #200

Closed KabDeveloper closed 5 years ago

KabDeveloper commented 5 years ago

Hi,

matchengine: This is the most important part for it records user balance and executes user order. It is in memory database, saves operation log in MySQL and redoes the operation log when start. It also writes user history into MySQL, push balance, orders and deals message to kafka.

As in memory DB, what are you using please ? is it Redis ? and what is the use case of in memory database at this stage ?

Are the orders received from REDIS and then used inside an another in memory database or ? a clear informations will be awesome please :)

Thank you

objectt commented 5 years ago

@bcashier matchengine does not use redis. marketprice uses redis for storing kline info. 'in memory database' in the description implies that it internally stores(holds) all data in its memory in various data structures.

KabDeveloper commented 5 years ago

@objectt First many thanks for your answer :)

Please what do you mean by kline infos ? (sorry for my ignorance)

Can you developpe more the process used to store in memory and what kind of data stored if possible ? And important thing, why not using REDIS instead ? Why is this solution is better than other ?

Sorry for all my questions and hope I will get detailed infos since I am stuck on this long ago and I am thirsty to know more about it ... You can take the time it takes to answer, be comfortable with it.

Thank you again.

objectt commented 5 years ago

@bcashier

  1. What is kline? = statistics of transactions in the given range of time (candle chart)
  2. What kind of data is stored in memory?
    • information of all orders
    • user balances
    • market info
  3. whay not use Redis instead? = because the data must be persistent. You can use any types of database if you can manage it without losing it. MySQL is just one of many options.
KabDeveloper commented 5 years ago

@objectt

Thank you sir for your time and effort given to answer my question :)

I misunderstand you in one point: MySQL is not an In Memory DB no ? List of In Memory Database from here: https://en.wikipedia.org/wiki/List_of_in-memory_databases

Where are stored orders received from WEB/API before they go to MySQL database to save history ?

In my understanding, I see your matching server working like this (Correct me if I am wrong of course):

Is this the process used ? I think from the schema here it's what I understand: https://user-images.githubusercontent.com/1209350/32476113-5ffc622a-c3b0-11e7-9755-924f17bcc167.jpeg

What kind of data is stored in memory?

information of all orders
user balances
market info

This datas must be stored in a MySQL database and not In memory database.

Please correct me and give me more infos if possible :)

Thank you again sir :)

objectt commented 5 years ago

@bcashier

KabDeveloper commented 5 years ago

@objectt This is what I am looking for !

Thank you sir :)