Class TradeServiceInDryMode
- java.lang.Object
-
- tech.cassandre.trading.bot.service.TradeServiceInDryMode
-
- All Implemented Interfaces:
TradeService
public class TradeServiceInDryMode extends Object implements TradeService
Trade service in dry mode.
-
-
Constructor Summary
Constructors Constructor Description TradeServiceInDryMode()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
cancelOrder(String orderId)
Cancel order.OrderCreationResultDTO
createBuyLimitOrder(CurrencyPairDTO currencyPair, BigDecimal amount, BigDecimal limitPrice)
Creates a buy limit order.OrderCreationResultDTO
createBuyMarketOrder(CurrencyPairDTO currencyPair, BigDecimal amount)
Creates a buy market order.OrderCreationResultDTO
createSellLimitOrder(CurrencyPairDTO currencyPair, BigDecimal amount, BigDecimal limitPrice)
Creates a sell limit order.OrderCreationResultDTO
createSellMarketOrder(CurrencyPairDTO currencyPair, BigDecimal amount)
Creates a sell market order.Optional<OrderDTO>
getOpenOrderByOrderId(String orderId)
Get an open order by its id.Set<OrderDTO>
getOpenOrders()
Get open orders.Set<TradeDTO>
getTrades()
Get last week trades.void
setDependencies(OrderFlux newOrderFlux, TradeFlux newTradeFlux)
Set dependencies.void
tickerUpdate(TickerDTO ticker)
Method called by streams at every ticker update.
-
-
-
Method Detail
-
setDependencies
public void setDependencies(OrderFlux newOrderFlux, TradeFlux newTradeFlux)
Set dependencies.- Parameters:
newOrderFlux
- order fluxnewTradeFlux
- trade flux
-
createBuyMarketOrder
public final OrderCreationResultDTO createBuyMarketOrder(CurrencyPairDTO currencyPair, BigDecimal amount)
Description copied from interface:TradeService
Creates a buy market order.- Specified by:
createBuyMarketOrder
in interfaceTradeService
- Parameters:
currencyPair
- currency pairamount
- amount- Returns:
- order result (order id or error)
-
createSellMarketOrder
public final OrderCreationResultDTO createSellMarketOrder(CurrencyPairDTO currencyPair, BigDecimal amount)
Description copied from interface:TradeService
Creates a sell market order.- Specified by:
createSellMarketOrder
in interfaceTradeService
- Parameters:
currencyPair
- currency pairamount
- amount- Returns:
- order result (order id or error)
-
createBuyLimitOrder
public final OrderCreationResultDTO createBuyLimitOrder(CurrencyPairDTO currencyPair, BigDecimal amount, BigDecimal limitPrice)
Description copied from interface:TradeService
Creates a buy limit order.- Specified by:
createBuyLimitOrder
in interfaceTradeService
- Parameters:
currencyPair
- currency pairamount
- amountlimitPrice
- the highest acceptable price- Returns:
- order result (order id or error)
-
createSellLimitOrder
public final OrderCreationResultDTO createSellLimitOrder(CurrencyPairDTO currencyPair, BigDecimal amount, BigDecimal limitPrice)
Description copied from interface:TradeService
Creates a sell limit order.- Specified by:
createSellLimitOrder
in interfaceTradeService
- Parameters:
currencyPair
- currency pairamount
- amountlimitPrice
- the lowest acceptable price- Returns:
- order result (order id or error)
-
getOpenOrderByOrderId
public final Optional<OrderDTO> getOpenOrderByOrderId(String orderId)
Description copied from interface:TradeService
Get an open order by its id.- Specified by:
getOpenOrderByOrderId
in interfaceTradeService
- Parameters:
orderId
- order id- Returns:
- order
-
getOpenOrders
public final Set<OrderDTO> getOpenOrders()
Description copied from interface:TradeService
Get open orders.- Specified by:
getOpenOrders
in interfaceTradeService
- Returns:
- list of open orders
-
cancelOrder
public final boolean cancelOrder(String orderId)
Description copied from interface:TradeService
Cancel order.- Specified by:
cancelOrder
in interfaceTradeService
- Parameters:
orderId
- order id- Returns:
- true if cancelled
-
getTrades
public final Set<TradeDTO> getTrades()
Description copied from interface:TradeService
Get last week trades.- Specified by:
getTrades
in interfaceTradeService
- Returns:
- trades
-
tickerUpdate
public void tickerUpdate(TickerDTO ticker)
Method called by streams at every ticker update.- Parameters:
ticker
- ticker
-
-