Giter Club home page Giter Club logo

exchange-core's Introduction

exchange-core

Build Status Javadocs Language grade: Java

Exchange-core is an open source market exchange core based on LMAX Disruptor, Eclipse Collections (ex. Goldman Sachs GS Collections), Real Logic Agrona, OpenHFT Chronicle-Wire, LZ4 Java, and Adaptive Radix Trees.

Exchange-core includes:

  • orders matching engine
  • risk control and accounting module
  • disk journaling and snapshots module
  • trading, admin and reports API

Designed for high scalability and pauseless 24/7 operation under high-load conditions and providing low-latency responses:

  • 3M users having 10M accounts in total
  • 100K order books (symbols) having 4M pending orders in total
  • less than 1ms worst wire-to-wire target latency for 1M+ operations per second throughput
  • 150ns per matching for large market orders

Single order book configuration is capable to process 5M operations per second on 10-years old hardware (Intel® Xeon® X5690) with moderate latency degradation:

rate 50.0% 90.0% 95.0% 99.0% 99.9% 99.99% worst
125K 0.6µs 0.9µs 1.0µs 1.4µs 4µs 24µs 41µs
250K 0.6µs 0.9µs 1.0µs 1.4µs 9µs 27µs 41µs
500K 0.6µs 0.9µs 1.0µs 1.6µs 14µs 29µs 42µs
1M 0.5µs 0.9µs 1.2µs 4µs 22µs 31µs 45µs
2M 0.5µs 1.2µs 3.9µs 10µs 30µs 39µs 60µs
3M 0.7µs 3.6µs 6.2µs 15µs 36µs 45µs 60µs
4M 1.0µs 6.0µs 9µs 25µs 45µs 55µs 70µs
5M 1.5µs 9.5µs 16µs 42µs 150µs 170µs 190µs
6M 5µs 30µs 45µs 300µs 500µs 520µs 540µs
7M 60µs 1.3ms 1.5ms 1.8ms 1.9ms 1.9ms 1.9ms

Latencies HDR Histogram

Benchmark configuration:

  • Single symbol order book.
  • 3,000,000 inbound messages are distributed as follows: 9% GTC orders, 3% IOC orders, 6% cancel commands, 82% move commands. About 6% of all messages are triggering one or more trades.
  • 1,000 active user accounts.
  • In average ~1,000 limit orders are active, placed in ~750 different price slots.
  • Latency results are only for risk processing and orders matching. Other stuff like network interface latency, IPC, journaling is not included.
  • Test data is not bursty, meaning constant interval between commands (0.2~8µs depending on target throughput).
  • BBO prices are not changing significantly throughout the test. No avalanche orders.
  • No coordinated omission effect for latency benchmark. Any processing delay affects measurements for next following messages.
  • GC is triggered prior/after running every benchmark cycle (3,000,000 messages).
  • RHEL 7.5, network-latency tuned-adm profile, dual X5690 6 cores 3.47GHz, one socket isolated and tickless, spectre/meltdown protection disabled.
  • Java version 8u192, newer Java 8 versions can have a performance bug

Features

  • HFT optimized. Priority is a limit-order-move operation mean latency (currently ~0.5µs). Cancel operation takes ~0.7µs, placing new order ~1.0µs;
  • In-memory working state for accounting data and order books.
  • Event-sourcing - disk journaling and journal replay support, state snapshots (serialization) and restore operations, LZ4 compression.
  • Lock-free and contention-free orders matching and risk control algorithms.
  • No floating-point arithmetic, no loss of significance is possible.
  • Matching engine and risk control operations are atomic and deterministic.
  • Pipelined multi-core processing (based on LMAX Disruptor): each CPU core is responsible for certain processing stage, user accounts shard, or symbol order books shard.
  • Two different risk processing modes (specified per symbol): direct-exchange and margin-trade.
  • Maker/taker fees (defined in quote currency units).
  • Two order books implementations: simple implementation ("Naive") and performance implementation ("Direct").
  • Order types: Immediate-or-Cancel (IOC), Good-till-Cancel (GTC), Fill-or-Kill Budget (FOK-B)
  • Testing - unit-tests, integration tests, stress tests, integrity/consistency tests.
  • Low GC pressure, objects pooling, single ring-buffer.
  • Threads affinity (requires JNA).
  • User suspend/resume operation (reduces memory consumption).
  • Core reports API (user balances, open interest).

Installation

  1. Install library into your Maven's local repository by running mvn install
  2. Add the following Maven dependency to your project's pom.xml:
<dependency>
    <groupId>exchange.core2</groupId>
    <artifactId>exchange-core</artifactId>
    <version>0.5.3</version>
</dependency>

Alternatively, you can clone this repository and run the example test.

Usage examples

Create and start empty exchange core:

// simple async events handler
SimpleEventsProcessor eventsProcessor = new SimpleEventsProcessor(new IEventsHandler() {
    @Override
    public void tradeEvent(TradeEvent tradeEvent) {
        System.out.println("Trade event: " + tradeEvent);
    }

    @Override
    public void reduceEvent(ReduceEvent reduceEvent) {
        System.out.println("Reduce event: " + reduceEvent);
    }

    @Override
    public void rejectEvent(RejectEvent rejectEvent) {
        System.out.println("Reject event: " + rejectEvent);
    }

    @Override
    public void commandResult(ApiCommandResult commandResult) {
        System.out.println("Command result: " + commandResult);
    }

    @Override
    public void orderBook(OrderBook orderBook) {
        System.out.println("OrderBook event: " + orderBook);
    }
});

// default exchange configuration
ExchangeConfiguration conf = ExchangeConfiguration.defaultBuilder().build();

// no serialization
Supplier<ISerializationProcessor> serializationProcessorFactory = () -> DummySerializationProcessor.INSTANCE;

// build exchange core
ExchangeCore exchangeCore = ExchangeCore.builder()
        .resultsConsumer(eventsProcessor)
        .serializationProcessorFactory(serializationProcessorFactory)
        .exchangeConfiguration(conf)
        .build();

// start up disruptor threads
exchangeCore.startup();

// get exchange API for publishing commands
ExchangeApi api = exchangeCore.getApi();

Create new symbol:

// currency code constants
final int currencyCodeXbt = 11;
final int currencyCodeLtc = 15;

// symbol constants
final int symbolXbtLtc = 241;

// create symbol specification and publish it
CoreSymbolSpecification symbolSpecXbtLtc = CoreSymbolSpecification.builder()
        .symbolId(symbolXbtLtc)         // symbol id
        .type(SymbolType.CURRENCY_EXCHANGE_PAIR)
        .baseCurrency(currencyCodeXbt)    // base = satoshi (1E-8)
        .quoteCurrency(currencyCodeLtc)   // quote = litoshi (1E-8)
        .baseScaleK(1_000_000L) // 1 lot = 1M satoshi (0.01 BTC)
        .quoteScaleK(10_000L)   // 1 price step = 10K litoshi
        .takerFee(1900L)        // taker fee 1900 litoshi per 1 lot
        .makerFee(700L)         // maker fee 700 litoshi per 1 lot
        .build();

future = api.submitBinaryDataAsync(new BatchAddSymbolsCommand(symbolSpecXbtLtc));

Create new users:

// create user uid=301
future = api.submitCommandAsync(ApiAddUser.builder()
        .uid(301L)
        .build());

// create user uid=302
future = api.submitCommandAsync(ApiAddUser.builder()
        .uid(302L)
        .build());

Perform deposits:

// first user deposits 20 LTC
future = api.submitCommandAsync(ApiAdjustUserBalance.builder()
        .uid(301L)
        .currency(currencyCodeLtc)
        .amount(2_000_000_000L)
        .transactionId(1L)
        .build());

// second user deposits 0.10 BTC
future = api.submitCommandAsync(ApiAdjustUserBalance.builder()
        .uid(302L)
        .currency(currencyCodeXbt)
        .amount(10_000_000L)
        .transactionId(2L)
        .build());

Place orders:

// first user places Good-till-Cancel Bid order
// he assumes BTCLTC exchange rate 154 LTC for 1 BTC
// bid price for 1 lot (0.01BTC) is 1.54 LTC => 1_5400_0000 litoshi => 10K * 15_400 (in price steps)
future = api.submitCommandAsync(ApiPlaceOrder.builder()
        .uid(301L)
        .orderId(5001L)
        .price(15_400L)
        .reservePrice(15_600L) // can move bid order up to the 1.56 LTC, without replacing it
        .size(12L) // order size is 12 lots
        .action(OrderAction.BID)
        .orderType(OrderType.GTC) // Good-till-Cancel
        .symbol(symbolXbtLtc)
        .build());

// second user places Immediate-or-Cancel Ask (Sell) order
// he assumes wost rate to sell 152.5 LTC for 1 BTC
future = api.submitCommandAsync(ApiPlaceOrder.builder()
        .uid(302L)
        .orderId(5002L)
        .price(15_250L)
        .size(10L) // order size is 10 lots
        .action(OrderAction.ASK)
        .orderType(OrderType.IOC) // Immediate-or-Cancel
        .symbol(symbolXbtLtc)
        .build());

Request order book:

future = api.requestOrderBookAsync(symbolXbtLtc, 10);

GtC orders manipulations:

// first user moves remaining order to price 1.53 LTC
future = api.submitCommandAsync(ApiMoveOrder.builder()
        .uid(301L)
        .orderId(5001L)
        .newPrice(15_300L)
        .symbol(symbolXbtLtc)
        .build());
        
// first user cancel remaining order
future = api.submitCommandAsync(ApiCancelOrder.builder()
        .uid(301L)
        .orderId(5001L)
        .symbol(symbolXbtLtc)
        .build());

Check user balance and GtC orders:

Future<SingleUserReportResult> report = api.processReport(new SingleUserReportQuery(301), 0);

Check system balance:

// check fees collected
Future<TotalCurrencyBalanceReportResult> totalsReport = api.processReport(new TotalCurrencyBalanceReportQuery(), 0);
System.out.println("LTC fees collected: " + totalsReport.get().getFees().get(currencyCodeLtc));

Testing

  • latency test: mvn -Dtest=PerfLatency#testLatencyMargin test
  • throughput test: mvn -Dtest=PerfThroughput#testThroughputMargin test
  • hiccups test: mvn -Dtest=PerfHiccups#testHiccups test
  • serialization test: mvn -Dtest=PerfPersistence#testPersistenceMargin test

TODOs

  • market data feeds (full order log, L2 market data, BBO, trades)
  • clearing and settlement
  • reporting
  • clustering
  • FIX and REST API gateways
  • cryptocurrency payment gateway
  • more tests and benchmarks
  • NUMA-aware and CPU layout custom configuration

Contributing

Exchange-core is an open-source project and contributions are welcome!

Support

exchange-core's People

Contributors

dependabot[bot] avatar engkimbs avatar jiangyongkang avatar kabdeveloper avatar magick93 avatar mzheravin avatar qct avatar sbwdlihao avatar scottjbarr avatar volna80 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  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  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  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

exchange-core's Issues

errors like The blank final field uid may not have been initialized

I downloaded the zip file.. and I imported to downloaded project into STS 4 and I am getting too many errors in java files.

Errors Like :
The blank final field uid may not have been initialized

and there are undefined methods are being called.

I have cleaned the project and I refreshed the project. still, I am getting many errors.

Could you please tell me why I am getting these errors..
And I could you please what is java version. And in which IDE u wrote the code.

Usage example

Could you provide a simple example on the usage of the library.
Just create a 2-3 users
add some bids
get the order book list
get the matches of the bids

I just build it and try to use it on an app, it is not so clear how to do those steps.

Thank you.

Abstract the matching engine

I have a use case where user/balance/execute order systems are already built and I'm looking to only hook into a new order matching engine.

On this regard I have two questions:

  1. Can I abstract user and other services from this code to only work at the buy/sell order level. Output should be transactions to execute.
  2. Does this engine support 1:M matching? If there was 1 user selling 1BTC for USD and 3 users buying 0.3 BTC from USD.

Thanks and any help is greatly appreciated :)
Rohin Gopalakrishnan

I couldn't build

Hello,

First thanks for your contribution!
Actually I got the code from git, and tried to build, but failed.

Could you check the build status in clean workspace?

Thanks. :)


APPLICATION FAILED TO START


Description:

Field resultsConsumer in org.openpredict.exchange.core.ExchangeCore required a bean of type 'java.util.function.Consumer' that could not be found.

Action:

Consider defining a bean of type 'java.util.function.Consumer' in your configuration.

Compilation Failed Error

HI Team,
I am setting up the exchange-core on my local machine. During build, am getting below error.

"The method get(int, Supplier) is ambiguous for the type ObjectsPool." position = objectsPool.get(ObjectsPool.SYMBOL_POSITION_RECORD, SymbolPositionRecord::new);
Class - RiskEngine.java, line 359.

Please help me in resolving this issue.

Regards
Abhishek

Exception in thread "Thread-x" java.lang.IllegalStateException: Thread is already running

Hi @mzheravin
I am running test cases for checking new concepts from new changes, but I always get error as in attachment image?

image

Another question,
In ExchangeCore class when place an order I hold balance by orderAmount (in below image), after that matcher trade I un-hold by handling in "handlerRiskRelease" after callback resultConsumer. It is always delay (it is waiting for new summit order), so it cannot release un-hold orderAmount this here, and So I handled un-hold orderAmount in resultConsumer.
image

exchange-core orderbook

In exchange-core project, where orders are store? If I keep the order inside a database then what should I do?

Thanks

How to improve the core performance of the transaction

Hi mzheravin, I am a developer of Digital Money Corporation. I saw your open source exchange core project on github. I am very interested. I have a few questions I want to ask you.
Is the order suitable for using TreeMap?
Due to the particularly large order, it may cause TreeMap to maintain its own balance, and a large number of rotations will cause performance degradation.
2.UserProfile I will put it in the ChronicleMap, but I don't know if it works,
3. Is it appropriate to use the Chronicle Queue to replace the missing person?
I hope that you can give some advice.
Thank you.

How would journaling work?

I wonder how you'd do it and how it would impact performance? Won't this create a bottleneck (at least per order book)?

InitialStateConfiguration.lastKnownStateFromJournal, and Error continuing

1
String exchangeId = "MY_EXCHANGE" ;
long snapshotBaseSeq = 0 ;
ExchangeConfiguration conf = ExchangeConfiguration.defaultBuilder()
.serializationCfg(SerializationConfiguration.DISK_JOURNALING)
.initStateCfg(InitialStateConfiguration.lastKnownStateFromJournal(exchangeId, 1, snapshotBaseSeq))
.build() ;

And then start the program. And when I add users and orders, It go to error below:
java.lang.IllegalStateException: File already exists: .\dumps\MY_EXCHANGE_journal_1_0001.ecj
at exchange.core2.core.processors.journaling.DiskSerializationProcessor.startNewFile(DiskSerializationProcessor.java:694) ~[classes/:na]
at exchange.core2.core.processors.journaling.DiskSerializationProcessor.writeToJournal(DiskSerializationProcessor.java:270) ~[classes/:na]
at com.lmax.disruptor.BatchEventProcessor.processEvents(BatchEventProcessor.java:168) [disruptor-3.4.2.jar:na]
at com.lmax.disruptor.BatchEventProcessor.run(BatchEventProcessor.java:125) [disruptor-3.4.2.jar:na]
at java.lang.Thread.run(Thread.java:748) ~[na:1.8.0_231]

Provide Initial SyncUp File

Please share inital syncup file state_0_MATCHING_ENGINE_ROUTER_0. Unable to start process without this file.

Expose exchange-core API to accept requests from other applications

Hi,

I noticied that the matching engine and the way to add new users, balances etc. is made from inside the same application like the example you give to us on the readme page.

Why not adding new orders, users, etc. using a requests to the API it self from outside the application ?

This will make it easy to manage the exchange.

I already found an example of REST program related to exchange-core but it is for an old version:
https://github.com/exchange-core/exchange-gateway-rest

Thank you

About account balance

Hello, I noticed that in "ITCoreExample.java", the balance of the account can be increased. How can I get the current balance of the user after the increase is completed? Does the balance matter in the exchange-core?
I try to pass
Future<SingleUserReportResult> report1 = api.processReport(new SingleUserReportQuery(USER1), 0); report1.get().getAccounts();
Get, but return {"empty":false}

exchange-core Trade details

In exchange-core project, how do I get trade details and trade price( which price offer get matched).

Thanks

code problem

Hello, can in your code more explanation, so easy to understand。I can write instructions in Chinese

Confusion about the data type of the Order

Hello, I see that the data type of "price" and "size" of the order is "long". Is there a problem if the value exceeds the maximum value of "long"? For example, the accuracy of "ETH" is 18 (WEI). If 10 "ETH" is "10000000000000000000", it will be greater than the maximum value of "long". Is there a solution, or am I misunderstanding?

Looking forward to your reply. Thank you

Pending balance and some logic bugs

I think you are missing for holding balance:

  1. for action ASK, you will pending size of quote currency, but for action BID, you must be pending size * price of base currency.
  2. for market order, when action ASK like as above, but for action BID, how to choose the price for holding base currency = size * ?price

Thanks,
Huy Bui.

are there any guarantees for in-order processing?

I'd like to run two of these exchange cores, one as the master and one as backup (shadowing the master) in case the first one fails. If each of the matchers are given the same input of orders, would the expected output be the same?

canPlaceMarginOrder

RiskEngine.java line 530, probably bug: freeMargin = position.estimateProfit(spec, lastPriceCache.get(spec.symbolId));

freeMargin += position.estimateProfit(spec, lastPriceCache.get(spec.symbolId)); ?

exchange-core source code

I have imported source code into eclipse but it showing error at code level like " The method builder() is undefined for the type ApiPlaceOrder","The constructor StateHashReportResult(new TreeMap<>()) is undefined". So how do compile and rune the code.

Thanks

Lombok and maven

Hi

I'm trying to use this project as a maven module in another project, however I'm getting the below error which seems to be related to the Lombok Builder annotation.

I'm compiling exchange-core using `mvn clean install' .

java.lang.Error: Unresolved compilation problems: 
	The type org.openpredict.exchange.core.ExchangeCore$ExchangeCoreBuilder cannot be resolved. It is indirectly referenced from required .class files
	The method builder() from the type ExchangeCore refers to the missing type ExchangeCore$ExchangeCoreBuilder

Is there are more correct maven command I should use?

Running tests.

I'm trying to run some of the tests and I get the following error: "java: cannot access sun.misc.Unsafe"

Also, running "mvn -Dtest=PerfThroughput#throughputTest test" gives me the following error:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M3:test (default-test) on project exchange-core: No tests were executed!

Thank you.

Add more order types

Hi! I find your project very interesting.
Is there any plan to support more order types such as stop market or stop limit orders... or maybe iceberg ... conditional orders ... etc ...

Is it possible with your structure while keeping performance ?

Thanks

Pegged Orders

Is there support for pegged order types ? or support for limit orders that dynamically move with the best market quotes ?

Question about putting journaling module in the event handlers?

Hi@mzheravin,
As I can see in the source code, the journaling module is served as an event handler.
All event handlers are executed in order, do you even consider IO operations in the journaling module would
slow down the performance of the whole system.

Is it better to pull the journaling module out of the event handler group and to do the persisting operations before publishing events to ringbuffer.

Concurrency Issue

In multi-threaded environment, getting java.util.ConcurrentException in OrderBucketNative class for below line.
final Map.Entry<Long, Order> next = iterator.next();

In this class LinkedhashMap is being used to collect and remove all matching orders. So can I use any Concurrent Collection instead to avoid ConcurrentException.

Thanks

Find a spelling mistake in README.md

Exchange-core includes:

  • orders matching engine
  • risk control and accounting module
  • disk jouraling and snapshots module
  • trading, admin and reports API

Can I fix it? : )

Issues for Downloading Maven Plugins

Hi, I have trouble when I downloading maven plugins.
It seems that I could not download the file named maven-scm-provider-gitexe-1.9.5.pom.
I tried to change the access area of my network, but I still couldn't download the file.
Waiting for your reply.
Thanks a lot.
image

Testing basic user cases.

For the moment, we would like to validate the full cycle exchange considering our user cases. So, I am moving forward with other tests.

Im trying to implement a few user cases to start to test our user cases and learn how the engine works internally:

  1. Exchange configuration
    ExchangeCore exchangeCore = ExchangeCore.builder()
    .resultsConsumer(eventsProcessor)
    .serializationProcessorFactory(serializationProcessorFactory)
    .exchangeConfiguration(conf)
    .build();

  2. Adding users to exchange.
    We are creating users in our own backoffice. We will push the UID required mapping it with our own ID. api.submitCommandAsync (ApiAddUser.builder ()). Is working well.
    We added two users UID 301 and UID 302 following your examples.

  3. Balance. We are managing deposit and withdrawal into the our own backoffice. We need to maintain syncronized the balance in real-time considering trades and deposit-withdrawals. We are mapping it to the api function api.submitCommandAsync (ApiAdjustUserBalance.builder (). Is working well.

  4. Currency and Symbol definition:
    I would like to define once currency pair to start. So, we are defining BTC-USD using CoreSymbolSpecification as follow:

public static final int SYMBOL_EXCHANGE_FEE = 9340;
public static final int COIN_XBT = 3762; // satoshi, 1E-8
public static final int COIN_USD = 840;

public static final CoreSymbolSpecification SYMBOLSPECFEE_XBT_USD = CoreSymbolSpecification.builder ()
.symbolId (SYMBOL_EXCHANGE_FEE)
.type (SymbolType.CURRENCY_EXCHANGE_PAIR)
.baseCurrency (COIN_XBT) // base = satoshi
.baseScaleK (1_000_000) // 1 lot = 1M satoshi (0.01 BTC)
.quoteCurrency (COIN_USD) // quote = usd
.quoteScaleK (1) // 1 step = 1 usd
.takerFee (0) // taker fee 0 usd per 1 lot
.makerFee (0) // maker fee 0 usd per 1 lot
.build ();

Is this configuration right? I don´t understood so good how baseScale should be configured.

I need to add different FIAT currencies. For ARS (Argentinian pesos) and USD (American Dolares) to be exchanged for BTC and USDT (Tether).

Could I configure the takerFee and makerFee as porcentual? I need to charge 0,25% for each transaction as commission.

  1. Place an order Limit GTC.
    We are having problems placing orders.

Our JSON definition:

"type":"OE",
"data": {
"uid":301,
"orderId": 3432342343534,
"price": 9344,
"size": 1,
"symbol": "9340",
"type": "GTC",
"action": "BID"

We tried two ways to do it.

a) With RiskEngine enabled (default config) but is not working.
matching_1 | 2020-05-19 20: 04: 06.741 WARN 1 --- [Thread-R1_0] e.core2.core.processors.RiskEngine: 3432342343534 risk result = RISK_NSF uid = 301: Can not place OrderCommand (command = PLACE_ORDER, orderId = 3432342343534, symbol = 9340, price = 9344, size = 1, reserveBidPrice = 9344, action = BID, orderType = GTC, uid = 301, timestamp = 0, userCookie = 0, eventsGroup = 4, serviceFlags = 1, resultCode = NEW, matcherEvent = null, marketData = null)
matching_1 | 2020-05-19 20: 04: 06.747 WARN 1 --- [Thread-R1_0] e.core2.core.processors.RiskEngine: 3432342343534 accounts: {3762 = 1, 840 = 20}
matching_1 | Command result: IEventsHandler.ApiCommandResult (command = [ADD o3432342343534 s9340 u301 B: GTC: 9344: 1], resultCode = RISK_NSF, seq = 6)

b) With RiskEngine disabled. We are having compilation problem.
We are using your latest version (0.5.0) and we added the configuration with corresponding dependencies.

OrdersProcessingConfiguration.NO_RISK_PROCESSING. I have the follow message as compilation result:

cannot find symbol
[ERROR] symbol: variable NO_RISK_PROCESSING
[ERROR] location: class exchange.core2.core.common.config.OrdersProcessingConfiguration

At the moment we can’t move forward because of these conflicts, I would really appreciate if you can help me to figure out how to fix it!. I don’t sure if must post it as issue on Git because could be only problems in my side.

Thank a lot for your support!

Can you write a simple description of the system?

Hello, I'm also a java engineer. I'm really happy to find a matchmaking system. Thank you very much for your contribution! Can you explain the operation principle of the system, such as how to ensure the data security when the system crashes, can you explain it briefly? Thank you very much

Adapte it with websockets, updating balances etc.

Hi

It's awesome that your project can process 5M orders per seconds !

But in case we can adopte it like this:

  • Receive new orders from apache KAFKA (Kafka can handle up to 1M messages per second)
  • Send WebSockets to users in order to change browser data like: Orderbook, Latest price, Trade history etc ... (Performances depend on the number of subscribed users and topics, In my case, I am thinking to use RabbitMQ that can handle 1M requests per seconds aswell, and for each order, we can send more than 5 messages: For Seller and Buyer to show updated balance, trade history, orderbook etc...)
  • Update users balances inside NoSQL in memory database like REDIS, and balance is updated each time the order of specific user is updated.

WIth all this, we can say that the number of processed orders will be decreased by more than 5x times.

Can it be customized with this features ? DO you have better approach for better performances ?

Thanks in advance :)

Performance issues when starting the project

Hi Maksim, I hava a question about the core. We are using your core as a dependency. We are trying to run the project taking our first steps to know how it works. Our first issue is related to performance. When the project start our CPU consumption goes too high (more than 500% up). Is this normal? We are running the project in development mode, using a MACBook Pro Core I5 2.9Ghz.

I´m using default configuration as your readme file says
ExchangeConfiguration conf = ExchangeConfiguration.defaultBuilder().build();
If not, could be something related to the configuration?
Or could you suggest me where we can find the possible issue?
Thanks in advance,
JC

How to Compile This Project

Hello,
I want to use your this exchange-core.
But I dont know how to build this source.
Can you help me to build this?
Please give me guide.

Risk engine and balances as optional feature

It is possible to make risk engine as optional feature? Does it make sense from your perspective?
I'm trying to use your engine in distributed ledger environment.(Work like a charm, by the way) . The issue is that balances synchronization is very costly task. The idea is to use "smart contract" as a risk engine on upper layer, because balance on ledger is actual single source of truth.
What do you think? Please advice.

can i matching order with myself?

I tried the tests ITExchangeCoreIntegration.basicFullCycleTestExchange with a same uid(UID_1).
I want to matching my orders by myself, but get a lot of asserts.

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.