Package nxt.ce
Class CoinExchange
java.lang.Object
nxt.ce.CoinExchange
Coin exchange home
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumstatic final classDefine a coin exchange order 'id' and 'fullHash' identify the coin exchange order 'chainId' is the chain identifier for the coin being exchanged 'exchangeId' is the chain identifier for the requested coin 'quantity' is the number of coins being exchanged (updated after each trade) 'bidPrice' is the bid price for the requested coin and is the exchange order price 'askPrice' is the ask price for coin being exchanged and is 1/bidPricestatic final classDefine a coin exchange trade A coin exchange consists of two trades. -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanaddListener(Listener<CoinExchange.Trade> listener, CoinExchange.Event eventType) static CoinExchange.OrdergetOrder(long orderId) Return a coin exchange orderstatic intReturn the number of coin exchange ordersstatic DbIterator<CoinExchange.Order>getOrders(long accountId, int chainId, int exchangeId, int from, int to) Return orders matching the supplied criteria.static CoinExchange.TradegetTrade(byte[] orderFullHash, byte[] matchFullHash) Return a coin exchange tradestatic intReturn the number of coin exchange tradesstatic DbIterator<CoinExchange.Trade>getTrades(long accountId, int chainId, int exchangeId, byte[] orderFullHash, int from, int to) Return trades matching the supplied criteria.static voidinit()static booleanremoveListener(Listener<CoinExchange.Trade> listener, CoinExchange.Event eventType)
-
Field Details
-
AMOUNT_RESERVE
public static final int AMOUNT_RESERVE- See Also:
-
-
Method Details
-
addListener
public static boolean addListener(Listener<CoinExchange.Trade> listener, CoinExchange.Event eventType) -
removeListener
public static boolean removeListener(Listener<CoinExchange.Trade> listener, CoinExchange.Event eventType) -
init
public static void init() -
getOrderCount
public static int getOrderCount()Return the number of coin exchange orders- Returns:
- Order count
-
getOrder
Return a coin exchange order- Parameters:
orderId- Order identifier- Returns:
- Coin exchange order or null if not found
-
getOrders
public static DbIterator<CoinExchange.Order> getOrders(long accountId, int chainId, int exchangeId, int from, int to) Return orders matching the supplied criteria. All orders will be returned if no search criteria are provided. The returned results will be sorted by price in descending order.- Parameters:
accountId- Account identifier (0 if no account criteria)chainId- Chain identifier (0 if no chain criteria)exchangeId- Exchange identifier (0 if no exchange criteria)from- Starting index within search resultsto- Ending index within search results- Returns:
- Database iterator
-
getTrade
Return a coin exchange trade- Parameters:
orderFullHash- Coin exchange order full hashmatchFullHash- Matching order full hash- Returns:
- Coin exchange trade or null if not found
-
getTradeCount
public static int getTradeCount()Return the number of coin exchange trades- Returns:
- Trade coin
-
getTrades
public static DbIterator<CoinExchange.Trade> getTrades(long accountId, int chainId, int exchangeId, byte[] orderFullHash, int from, int to) Return trades matching the supplied criteria. All trades will be returned if no search criteria are provided. The returned results will be sorted by block height in descending order.- Parameters:
accountId- Account identifier (0 if no account criteria)chainId- Chain identifier (0 if no chain criteria)exchangeId- Exchange identifier (0 if no exchange criteria)orderFullHash- Coin exchange order full hash (null or zero-length if no order criteria)from- Starting index within search resultsto- Ending index within search results- Returns:
- Database iterator
-