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:
-
Exchange configuration
ExchangeCore exchangeCore = ExchangeCore.builder()
.resultsConsumer(eventsProcessor)
.serializationProcessorFactory(serializationProcessorFactory)
.exchangeConfiguration(conf)
.build();
-
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.
-
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.
-
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.
- 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!